[cfe-dev] Normalizing the AST across languages
Chris Lattner
clattner at apple.com
Thu Oct 30 16:02:37 PDT 2008
On Oct 30, 2008, at 12:52 PM, Doug Gregor wrote:
>>> The intent of CXXRecordDecl is clear: since C++ requires us to keep
>>> additional information about classes in the AST (which isn't
>>> needed in
>>> C), all that extra information goes into CXXRecordDecl so that we
>>> don't bloat the C compilation with unused data. This means that
>>> compiling a C program as C++ uses different ASTs and requires more
>>> memory.
>>
>> Right, this is something I asked Argiris to do. The intent was for
>> "C like"
>> struct definitions in C++ to use the lighter weight RecordDecl when
>> possible
>> (which is what the fixme is about).
>
> I don't see how it can work. The problem is that we need to allocate
> the RecordDecl as soon as we see the "struct Blah". After we've done
> that, we can't go back and make it into a CXXRecordDecl if we then
> find out that it has friend declarations.
Yep, this is a very good point. Perhaps Argiris' suggestion of making
*all* instance variables be a separate allocation from the decl would
help?
-Chris
More information about the cfe-dev
mailing list