[cfe-dev] Type>>isObjCInterfaceType() blows up

Ted Kremenek kremenek at apple.com
Wed Apr 23 08:46:42 PDT 2008


On Apr 23, 2008, at 8:17 AM, Sam Bishop wrote:

> Ted Kremenek wrote:
>> One aside: if TranslationUnit always owns ASTContext, then it doesn't
>> have to be explicitly allocated in TranslationUnit, just kept as a
>> field.  TranslationUnit can in turn be stack or heap allocated.
>
> I see where I was confused now.  I was under the impression that
> deserialized non-POD types had to be heap allocated.  And indeed, the
> heap versus stack problem I mentioned earlier would go away if
> ASTContext objects were always created (however that may be) as a
> TranslationUnit member.

That's right; non-POD types don't have to be heap allocated to work  
with the deserializer.

For such objects we don't use EmitOwnedPtr/ReadOwnedPtr, but instead  
manually register their persistent references using EmitPtr (which  
only writes an integer to the bitcode file representing a serialized  
handle for the object, not the contents of the object itself).  In  
fact, EmitOwnedPtr and ReadOwnedPtr are implemented on top of EmitPtr  
and ReadPtr.

This allows us to handle in the serializer cases where an object A has  
references to fields in an object B.



More information about the cfe-dev mailing list