[PATCH] D49552: Add a Microsoft Demangler library and utility.

David Majnemer via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 19 20:21:38 PDT 2018


majnemer accepted this revision.
majnemer added a comment.
This revision is now accepted and ready to land.

I'm worried about some extreme template stuff (function templates are not considered for back-referencing but other templates and normal functions are OK) but you are gonna work thru the rest of mangle-ms-* so you'll get there ;)



================
Comment at: llvm/lib/Demangle/MicrosoftDemangle.cpp:83
+  char C = OS.back();
+  if (isalnum(C) || C == '>')
+    OS << " ";
----------------
isAlnum


================
Comment at: llvm/lib/Demangle/MicrosoftDemangle.cpp:494-495
+
+  // if (Ty.Quals & Q_Pointer64)
+  //  OS << " __ptr64";
+  if (Quals & Q_Restrict)
----------------
?


================
Comment at: llvm/lib/Demangle/MicrosoftDemangle.cpp:706-707
+      (void)BackRefName;
+    } else
+      ExtraChildQuals = demanglQ_ifiers(false);
+    FTy->ReturnType->Quals =
----------------
Brace this


================
Comment at: llvm/lib/Demangle/MicrosoftDemangle.cpp:731
+// <hex-digit>            ::= [A-P]           # A = 0, B = 1, ...
+int Demangler::demangleNumber() {
+  bool neg = MangledName.consumeFront("?");
----------------
Clang uses an int64 here. I think this should do the same.
A good test might be:
`??$f@$0?IAAAAAAAAAAAAAAA@@@YAXXZ`
Another good one:
`??$g@$0HPPPPPPPPPPPPPPP@@@YAXXZ`


================
Comment at: llvm/lib/Demangle/MicrosoftDemangle.cpp:1242-1299
+  switch (MangledName.popFront()) {
+  case 'X':
+    Ty->Prim = PrimTy::Void;
+    break;
+  case 'D':
+    Ty->Prim = PrimTy::Char;
+    break;
----------------
Both switches don't cover all cases. Maybe add assert(false) ?


https://reviews.llvm.org/D49552





More information about the llvm-commits mailing list