[PATCH] D13317: clang_Cursor_getMangling shouldn't mangle if the declaration isn't mangled

Richard Smith via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 30 17:41:22 PDT 2015


rsmith added a subscriber: rsmith.

================
Comment at: tools/libclang/CIndex.cpp:3895
@@ +3894,3 @@
+  // Don't mangle if we don't need to.
+  if (!MC->shouldMangleCXXName(ND))
+    return cxstring::createEmpty();
----------------
You should use `shouldMangleDeclName` here instead; this will do the wrong thing if there's an asm label on the declaration (where presumably we do want to list a "mangling").

================
Comment at: tools/libclang/CIndex.cpp:3896
@@ +3895,3 @@
+  if (!MC->shouldMangleCXXName(ND))
+    return cxstring::createEmpty();
+
----------------
In this case, we should presumably use the decl's identifier as the "mangled name" rather than just giving up; there could still be backend mangling that applies here, and we should be producing the final symbol name here. In fact, `MangleContext::mangleName` should probably be changed to produce the identifier name in this case, rather than handling it here.


http://reviews.llvm.org/D13317





More information about the cfe-commits mailing list