[cfe-dev] [PATCH] TypeOfExpr serialization
Zhongxing Xu
xuzhongxing at gmail.com
Wed Dec 24 17:18:00 PST 2008
On Wed, Dec 24, 2008 at 8:13 PM, Sebastian Redl <
sebastian.redl at getdesigned.at> wrote:
> Zhongxing Xu wrote:
>
>
>>
>> On Wed, Dec 24, 2008 at 2:11 PM, Ted Kremenek <kremenek at apple.com<mailto:
>> kremenek at apple.com>> wrote:
>>
>> This looks right to me!
>>
>> On a separate issue, I'm mixed on having TypeOfExpr own the Expr
>> (which I assume is the case right now). VLA types also own their
>> size expressions, but I've never felt that Types should own
>> expressions. This is a long-standing issue, however with the ASTs.
>>
>>
>> Yeah. Having types own decls causes failure of
>> serialization/deserialization on this code:
>>
>> struct s {
>> };
>>
>> The struct is serialized twice: once by translation unit, the other by the
>> type which owns it. When deserialized the second time, RegisterPtr() fails
>> due to that the backpatch map already has final pointer.
>>
> If the Decl is owned twice, then it should also cause crashes on shutdown,
> due to double deletion. Why does the type own the decl anyway? Isn't the
> type produced by the ASTContext on request, from the decl? How can it
> possibly own it?
>
> Of course, types owning expressions is different from types owning decls.
>
> Sebastian
In current AST construction/deconstruction, the Decl is not owned by
TagType. In this code:
typedef struct s{} s_t;
The RecordDecl for 'struct s {}' is leaked, because it's not owned by
anyone.
But in AST serialization, currently we do assume TagType own its Decl.
That's why the crash occurs.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20081225/4f61a77f/attachment.html>
More information about the cfe-dev
mailing list