[PATCH] D68917: [Demangle] Add a few more options to the microsoft demangler

Reid Kleckner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 14 13:26:19 PDT 2019


rnk added inline comments.


================
Comment at: llvm/include/llvm/Demangle/Demangle.h:39
+  MSDF_NoAccessSpecifiers = 1 << 1,
+  MSDF_NoAllocationLanguage = 1 << 2,
+  MSDF_NoFunctionReturns = 1 << 3,
----------------
Any reason not to say `MSDF_NoCallingConvention` instead? I see it's consistent with the UnDecorateSymbolName flag, but "allocation language" is pretty opaque. It's not like we're being compatible with undname here, we might as well use descriptive command line flag names.


================
Comment at: llvm/include/llvm/Demangle/Demangle.h:40
+  MSDF_NoAllocationLanguage = 1 << 2,
+  MSDF_NoFunctionReturns = 1 << 3,
+  MSDF_NoMemberType = 1 << 4,
----------------
"Function returns" could be "return types", but I don't feel as strongly about it.


================
Comment at: llvm/lib/Demangle/MicrosoftDemangleNodes.cpp:588
+  if (!(Flags & OF_NoAccessSpecifier)) {
+    switch (SC) {
+    case StorageClass::PrivateStatic:
----------------
Code golf suggestion:
```
StringRef AccessSpec;
bool IsStatic = true;
switch (SC) {
  case StorageClass::PrivateStatic:
    AccessSpec = "private";
    break;
  case StorageClass::ProtectedStatic:
    AccessSpec = "protected";
    break;
  case StorageClass::PublicStatic:
    AccessSpec = "public";
    break;
  default:
    IsStatic = false;
    break;
}
if (!(Flags & OF_NoAccessSpecifier) && !AccessSpec.empty())
  OS << AccessSpec << ": ";
if (!(Flags & OF_NoNoMemberType) && IsStatic)
  OS << "static";
```


================
Comment at: llvm/tools/llvm-undname/llvm-undname.cpp:37
+                                 cl::init(false));
+cl::opt<bool> NoAllocationLanguage("no-allocation-language", cl::Optional,
+                                   cl::desc("skip calling convention"),
----------------
Ditto, we should consider a more descriptive name.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68917/new/

https://reviews.llvm.org/D68917





More information about the llvm-commits mailing list