[cfe-commits] [patch] CXXABI getter/setter

João Matos ripzonetriton at gmail.com
Sun Aug 19 16:24:28 PDT 2012


Thanks for the explanation, makes total sense.

I'll just update my code to parse code for each ABI.

On Mon, Aug 20, 2012 at 12:14 AM, Sean Silva <silvas at purdue.edu> wrote:

> > By the way, is there any reason ABI dependent stuff could not be
> abstracted
> > from the actual AST? It just feels wasteful to have to parse code twice
> to
> > get layout and mangling information.
>
> Consider:
>
> char arr[sizeof(class Foo) == sizeof_foo_with_itanium_ABI ? 1 : -1 ];
>
> or
>
> struct what_size_am_i {
> char arr[sizeof(class Foo) == sizeof_foo_with_itanium_ABI ? 5 : 10 ];
> };
>
> So to get back to your original question of
>
> > By the way, is there any reason ABI dependent stuff could not be
> abstracted
> > from the actual AST?
>
> There is a good reason, and that is that struct layout (and mangling
> too, considering templates) can be made to depend on the ABI in
> arbitrarily complicated ways.
>
> --Sean Silva
>
> On Sun, Aug 19, 2012 at 6:50 PM, João Matos <ripzonetriton at gmail.com>
> wrote:
> > I am creating my own mangler instance. The problem is that it takes an
> AST
> > context, which has it's own CXXABI object, and it can't be changed.
> >
> > And you are right, it's probably not correct under all the circumstances,
> > I'll change my code to make an AST for each different ABI. I had not
> > remembered about template parameters, that is a good reason.
> >
> > By the way, is there any reason ABI dependent stuff could not be
> abstracted
> > from the actual AST? It just feels wasteful to have to parse code twice
> to
> > get layout and mangling information.
> >
> > On Sun, Aug 19, 2012 at 10:41 PM, John McCall <rjmccall at apple.com>
> wrote:
> >>
> >> On Aug 19, 2012, at 2:55 AM, João Matos wrote:
> >> > Well, my use case is for doing name mangling correctly with the MS and
> >> > Itanium manglers.
> >>
> >> You want to take an existing AST and apply both MS and Itanium manglings
> >> to it,
> >> regardless of which ABI it was parsed under?  I think the correct
> approach
> >> is to
> >> explicitly create your own mangler instance, rather than relying on the
> >> information
> >> from the ASTContext to make one.
> >>
> >> Whether this is actually sensible depends on what you're really trying
> to
> >> do.
> >> Sean's point that the ABI can substantially affect the AST isn't just
> >> notional —
> >> most of the time, things like sizes aren't mangled, but if they're used
> as
> >> a
> >> template argument they certainly will be.
> >>
> >> John.
> >
> >
> >
> >
> > --
> > João Matos
>



-- 
João Matos
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120820/caa46bbc/attachment.html>


More information about the cfe-commits mailing list