OSDN Git Service

[MS Demangler] Rework the way operators are demangled.
authorZachary Turner <zturner@google.com>
Fri, 17 Aug 2018 16:14:05 +0000 (16:14 +0000)
committerZachary Turner <zturner@google.com>
Fri, 17 Aug 2018 16:14:05 +0000 (16:14 +0000)
commit6c36cc6f616e306af242f8a3d4fc24f16d65f20c
treec39a1280fa03b4bbd3959e51df32535260ad83ce
parent8f7838928556d2512d850d4b33608afc3b4a2fc5
[MS Demangler] Rework the way operators are demangled.

Previously, some of the code for actually parsing mangled
operator names was more like formatting code in nature,
and was interspersed with the demangling code which builds
the AST.  This means that by the time we got to the printing
code, we had lost all information about what type of operator
we had, and all we were left with was a string that we just
had to print.  However, not all operators are actually even
operators.  it's basically just a catch-all mangling for
"special names", and for some of the other types it helps
to know when we're actually doing the printing what it is.

This patch changes the way things work by introducing an
OperatorInfo structure and corresponding enumeration.  When
we demangle we store the enumeration value and demangled
components separately.  This gives more flexibility during
printing.

In doing so, some demanglings of special names which we didn't
previously support come out of this for free, so we now demangle
those.

A few are more complex and are better left for a followup patch
though.

An exhaustive test of every possible operator code is included,
with the ones that don't yet work commented out.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340046 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Demangle/MicrosoftDemangle.cpp
test/Demangle/ms-operators.test [new file with mode: 0644]
test/Demangle/ms-string-literals.test