Entity of static functions

Current EntityGetter does not create entities for static functions.
But CallGraph represents functions with Entities uniquely. Static
functions should also appear in the call graph. So could EntityGetter
also create entities for static functions. This should not do any harm
to other parts of clang.

-Zhongxing

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.

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.

Yeah, that's a good solution.

This is commited, and static functions get Entities now.

Thanks for the feedback Zhongxing!

-Argiris

Great! Thanks for the quick response.