r214410 - Exposes a C API to name mangling for a given cursor.

Eli Bendersky eliben at google.com
Fri Aug 1 05:34:24 PDT 2014


On Thu, Jul 31, 2014 at 6:48 PM, Hans Wennborg <hans at chromium.org> wrote:

> 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).
>
>
Yes, but this is not the path I'm going through - I don't have a LLVM
GlobalValue. The Twine-accepting function doesn't do this stripping. See
http://llvm.org/bugs/show_bug.cgi?id=20127 - I'd be able to simplify this
code when it's fixed.

Eli


> Not having to worry about that special prefix seems like a nice
> benefit of using the backend mangler too :)
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140801/8656d0ca/attachment.html>


More information about the cfe-commits mailing list