aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Demangle/MicrosoftDemangle.cpp
diff options
context:
space:
mode:
authorMartin Storsjo <martin@martin.st>2019-10-15 08:29:56 +0000
committerMartin Storsjo <martin@martin.st>2019-10-15 08:29:56 +0000
commitda92ed8365aa5506c4991b9075f57aeeb7f6f70a (patch)
treed146d71ca6dfda940eb2eced670e4ec8e16e53a2 /llvm/lib/Demangle/MicrosoftDemangle.cpp
parentbbb8eade6976c56869f7d06d14fb429fdd6538d3 (diff)
downloadllvm-da92ed8365aa5506c4991b9075f57aeeb7f6f70a.zip
llvm-da92ed8365aa5506c4991b9075f57aeeb7f6f70a.tar.gz
llvm-da92ed8365aa5506c4991b9075f57aeeb7f6f70a.tar.bz2
[Demangle] Add a few more options to the microsoft demangler
This corresponds to commonly used options to UnDecorateSymbolName within llvm. Add them as hidden options in llvm-undname. MS undname.exe takes numeric flags, corresponding to the UNDNAME_* constants, but instead of hardcoding in mappings for those numbers, just add textual options instead, as it the use of them here is primarily intended for testing. Differential Revision: https://reviews.llvm.org/D68917 llvm-svn: 374865
Diffstat (limited to 'llvm/lib/Demangle/MicrosoftDemangle.cpp')
-rw-r--r--llvm/lib/Demangle/MicrosoftDemangle.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/llvm/lib/Demangle/MicrosoftDemangle.cpp b/llvm/lib/Demangle/MicrosoftDemangle.cpp
index 8c58254..c681d6e 100644
--- a/llvm/lib/Demangle/MicrosoftDemangle.cpp
+++ b/llvm/lib/Demangle/MicrosoftDemangle.cpp
@@ -2346,12 +2346,22 @@ char *llvm::microsoftDemangle(const char *MangledName, char *Buf, size_t *N,
if (Flags & MSDF_DumpBackrefs)
D.dumpBackReferences();
+ OutputFlags OF = OF_Default;
+ if (Flags & MSDF_NoCallingConvention)
+ OF = OutputFlags(OF | OF_NoCallingConvention);
+ if (Flags & MSDF_NoAccessSpecifier)
+ OF = OutputFlags(OF | OF_NoAccessSpecifier);
+ if (Flags & MSDF_NoReturnType)
+ OF = OutputFlags(OF | OF_NoReturnType);
+ if (Flags & MSDF_NoMemberType)
+ OF = OutputFlags(OF | OF_NoMemberType);
+
if (D.Error)
InternalStatus = demangle_invalid_mangled_name;
else if (!initializeOutputStream(Buf, N, S, 1024))
InternalStatus = demangle_memory_alloc_failure;
else {
- AST->output(S, OF_Default);
+ AST->output(S, OF);
S += '\0';
if (N != nullptr)
*N = S.getCurrentPosition();