[cfe-dev] Entity of static functions

Zhongxing Xu xuzhongxing at gmail.com
Mon Jul 20 19:06:54 PDT 2009


On Tue, Jul 21, 2009 at 4:52 AM, Argyrios Kyrtzidis<kyrtzidis at apple.com> 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 ?

Yeah, that's a good solution.




More information about the cfe-dev mailing list