[cfe-dev] Entity of static functions

Ted Kremenek kremenek at apple.com
Mon Jul 20 14:22:41 PDT 2009


On Jul 20, 2009, at 1:52 PM, Argyrios Kyrtzidis wrote:

> On Jul 20, 2009, at 1:11 PM, Ted Kremenek wrote:
>
>> I think Entity is meant to mainly represent concepts that cross
>> translation units.  When reasoning about the specifics of a
>> translation unit (including static functions) we have the ASTs.  I
>> think the right solution is for CallGraph to represent functions with
>> something like an llvm::PointerUnion that acts as a variant type.
>
> Static functions were disallowed to avoid the complexity of having  
> to encode "translation unit that the decl came from"
> so that compare semantics for Entities are correct.
>
> I think a better way is for Entity to be just a wrapper to a  
> PointerUnion (either pointer to "not crossing" Decl or pointer to an  
> internal Entity implementation).
> That way comparing Entities is correct also for Decls that don't  
> cross translation units.
>
> Does it make sense ?
>
> -Argiris

That sounds like a great solution to me.



More information about the cfe-dev mailing list