[PATCH] Expose name mangling to libclang
Argyrios Kyrtzidis
kyrtzidis at apple.com
Wed Jul 30 19:16:38 PDT 2014
+ // Mangling only works for functions and variables.
+ if (!D || !(llvm::isa<FunctionDecl>(D) || llvm::isa<VarDecl>(D)))
+ return cxstring::createEmpty();
+
+ const NamedDecl *ND = llvm::cast<NamedDecl>(D);
This is a minor nitpick but could you remove "llvm::” from isa<> and cast<>, these are used everywhere unqualified.
+ // The Microsoft mangler may insert a special character in the beginning to
+ // prevent further mangling. We can strip that for display purposes.
+ if (Buf[0] == '\x01') {
+ Buf.erase(0, 1);
+ }
It’s not clear to me, is this character part of the final mangled name or not ?
If this is part of the actual mangled name shouldn’t we keep it to be correct and let the display printer handle it (e.g. by displaying it as “\x01” or something) ?
> On Jul 30, 2014, at 10:44 AM, Eli Bendersky <eliben at google.com> wrote:
>
> Following Argyrios's advice, infer the mangling context from AST context
>
> http://reviews.llvm.org/D4663
>
> Files:
> include/clang-c/Index.h
> test/Index/print-mangled-name.cpp
> tools/c-index-test/c-index-test.c
> tools/libclang/CIndex.cpp
> tools/libclang/libclang.exports
> <D4663.12035.patch>_______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
More information about the cfe-commits
mailing list