r214410 - Exposes a C API to name mangling for a given cursor.
Hans Wennborg
hans at chromium.org
Thu Jul 31 18:48:19 PDT 2014
On Thu, Jul 31, 2014 at 2:47 PM, Eli Bendersky <eliben at google.com> wrote:
>
>
>
> On Thu, Jul 31, 2014 at 12:47 PM, Rafael EspĂndola
> <rafael.espindola at gmail.com> wrote:
>>
>> > I'm not sure how to access those parts of LLVM from libclang. Besides,
>> > IIRC
>> > targets are not linked into libclang. Do you have an idea?
>>
>> The LLVM targets? You shouldn't need them. All that you need is the
>> DataLayout. With that you should be able to use lib/IR/Mangler.
>>
>
> Attaching a patch - is this what you had in mind?
> // 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);
> + // prevent further mangling. We stop mangling and strip it for display
> + // purposes.
> + if (FrontendBuf[0] == '\x01') {
> + FrontendBuf.erase(0, 1);
> + return cxstring::createDup(FrontendBuf);
With the approach of using the backend mangler, you wouldn't need to
strip the \01 prefix because the backend mangler does that anyway (see
lib/IR/Mangler.cpp:105).
Not having to worry about that special prefix seems like a nice
benefit of using the backend mangler too :)
- Hans
More information about the cfe-commits
mailing list