[PATCH] Expose name mangling to libclang

Eli Bendersky eliben at google.com
Tue Jul 29 17:21:06 PDT 2014


On Tue, Jul 29, 2014 at 5:08 PM, Argyrios Kyrtzidis <kyrtzidis at apple.com>
wrote:

> Hi Eli,
>
> +/**
> + * \brief Represents the different available ABIs for name mangling.
> + */
> +typedef enum { CXMangleABI_Itanium = 0, CXMangleABI_Microsoft = 1 }
> CXMangleABI;
> +
> +/**
> + * \brief Retrieve the CXString representing the mangled name of the
> cursor.
> + */
> +CINDEX_LINKAGE CXString clang_Cursor_getMangling(CXCursor, CXMangleABI);
>
> Why aren’t you just using that appropriate ABI of the translation unit
> that was created ? So to get the MangleContext you can just call
> ASTContext::createMangleContext().
>

Hi Argyrios,

Thanks for the suggestion. This is an interesting idea - I guess I have
been looking at it from a different angle, thinking mostly about a simple
tool that uses Clang to mangle all kinds of names (think a web interface).
So I was detaching standalone symbols from their containers/TUs.

So, I suppose the same thing can be simulated with the approach you
proposing, e.g. by passing a triple flag in the cmdline options
to clang_createTranslationUnitFromSourceFile or something of the sort. What
do you think?

Eli






>
> On Jul 28, 2014, at 6:19 AM, Eli Bendersky <eliben at google.com> wrote:
>
>
>
>
> On Thu, Jul 24, 2014 at 5:48 PM, Eli Bendersky <eliben at google.com> wrote:
>
>> Hi rsmith, rengolin,
>>
>> Exposes a C API to name mangling for a given cursor.
>>
>> This is loosely based on https://gist.github.com/tritao/2766291, and was
>> previously discussed on cfe-dev:
>> http://lists.cs.uiuc.edu/pipermail/cfe-dev/2014-June/037577.html
>>
>> Adding testing capability via c-index-test.
>>
>> 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
>>
>
> Ping ?
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140729/777fc6ce/attachment.html>


More information about the cfe-commits mailing list