<br><br><div class="gmail_quote">On Wed, Dec 24, 2008 at 8:13 PM, Sebastian Redl <span dir="ltr"><<a href="mailto:sebastian.redl@getdesigned.at">sebastian.redl@getdesigned.at</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Zhongxing Xu wrote:<div><div></div><div class="Wj3C7c"><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
<br>
On Wed, Dec 24, 2008 at 2:11 PM, Ted Kremenek <<a href="mailto:kremenek@apple.com" target="_blank">kremenek@apple.com</a> <mailto:<a href="mailto:kremenek@apple.com" target="_blank">kremenek@apple.com</a>>> wrote:<br>

<br>
    This looks right to me!<br>
<br>
    On a separate issue, I'm mixed on having TypeOfExpr own the Expr<br>
    (which I assume is the case right now).  VLA types also own their<br>
    size expressions, but I've never felt that Types should own<br>
    expressions.  This is a long-standing issue, however with the ASTs.<br>
<br>
<br>
Yeah. Having types own decls causes failure of serialization/deserialization on this code:<br>
<br>
struct s {<br>
};<br>
<br>
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.<br>
</blockquote></div></div>
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?<br>

<br>
Of course, types owning expressions is different from types owning decls.<br><font color="#888888">
<br>
Sebastian</font></blockquote><div><br><br>In current AST construction/deconstruction, the Decl is not owned by TagType. In this code:<br><br>typedef struct s{} s_t;<br><br>The RecordDecl for 'struct s {}' is leaked, because it's not owned by anyone.<br>
<br>But in AST serialization, currently we do assume TagType own its Decl. That's why the crash occurs.<br></div></div><br>