[PATCH] D13317: clang_Cursor_getMangling shouldn't mangle if the declaration isn't mangled
Michael Wu via cfe-commits
cfe-commits at lists.llvm.org
Tue Oct 6 12:31:18 PDT 2015
michaelwu updated this revision to Diff 36645.
michaelwu added a comment.
Turns out clang_isUnexposed is what I wanted, rather than clang_isInvalid. I remember seeing clang_isInvalid work though..
http://reviews.llvm.org/D13317
Files:
test/Index/print-mangled-name.cpp
tools/c-index-test/c-index-test.c
tools/libclang/CIndex.cpp
Index: tools/libclang/CIndex.cpp
===================================================================
--- tools/libclang/CIndex.cpp
+++ tools/libclang/CIndex.cpp
@@ -3890,7 +3890,11 @@
std::string FrontendBuf;
llvm::raw_string_ostream FrontendBufOS(FrontendBuf);
- MC->mangleName(ND, FrontendBufOS);
+ if (MC->shouldMangleDeclName(ND)) {
+ MC->mangleName(ND, FrontendBufOS);
+ } else {
+ ND->printName(FrontendBufOS);
+ }
// Now apply backend mangling.
std::unique_ptr<llvm::DataLayout> DL(
Index: tools/c-index-test/c-index-test.c
===================================================================
--- tools/c-index-test/c-index-test.c
+++ tools/c-index-test/c-index-test.c
@@ -1429,6 +1429,8 @@
static enum CXChildVisitResult PrintMangledName(CXCursor cursor, CXCursor p,
CXClientData d) {
+ if (clang_isUnexposed(clang_getCursorKind(cursor)))
+ return CXChildVisit_Recurse;
CXString MangledName;
PrintCursor(cursor, NULL);
MangledName = clang_Cursor_getMangling(cursor);
Index: test/Index/print-mangled-name.cpp
===================================================================
--- test/Index/print-mangled-name.cpp
+++ test/Index/print-mangled-name.cpp
@@ -29,3 +29,8 @@
// ITANIUM: mangled=_Z3foo1SRS_
// MACHO: mangled=__Z3foo1SRS_
// MICROSOFT: mangled=?foo@@YAHUS
+
+extern "C" int foo(int);
+// ITANIUM: mangled=foo
+// MACHO: mangled=_foo
+// MICROSOFT: mangled=_foo
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D13317.36645.patch
Type: text/x-patch
Size: 1473 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20151006/1d35f33f/attachment.bin>
More information about the cfe-commits
mailing list