[cfe-commits] Unique'ing VariableArrayType

Argiris Kirtzidis akyrtzi at gmail.com
Wed Oct 8 17:41:57 PDT 2008


Ted Kremenek wrote:
>
> If the rewriter (or some other refactoring) decides to change the Expr 
> referenced by the VariableArrayType, what happens to the 
> VariableArrayType?  If the VariableArrayType is uniqued by using the 
> Expr* value, then if that Expr is replaced then all of a sudden the 
> VariableArrayType might be incorrectly placed in the FoldingSet that 
> we use to unique types (within ASTContext).

If the Expr changes this also semantically changes the type, and is more 
like the client changing the type of a variable.
It seems to me that the Expr of VariableArrayType should not be allowed 
to change and clients should instead use a new VariableArrayType with 
the new Expr.

-Argiris

>  A refactoring client would have to get this corner case right when 
> making changes to an AST, potentially by removing the 
> VariableArrayType from the foldingset before changing it's underlying 
> Expr and then reinserting it into the FoldingSet after changing the 
> underlying Expr.  Requiring this would be strangely burdensome on 
> clients changing the AST, nor do we currently expose the FoldingSet 
> implementation for uniquing types in the public interface of 
> ASTContext (and my belief is that we shouldn't expose this 
> implementation detail).
>
> Thoughts?
>
> Ted



More information about the cfe-commits mailing list