[cfe-commits] r74802 - in /cfe/trunk: include/clang/Index/ include/clang/Index/Entity.h include/clang/Index/EntityHandler.h include/clang/Index/IndexProvider.h include/clang/Index/Program.h include/clang/Index/TranslationUnit.h lib/CMakeLists.txt lib/Index/ lib/Index/CMakeLists.txt lib/Index/Entity.cpp lib/Index/IndexProvider.cpp lib/Index/Makefile lib/Index/Program.cpp lib/Index/ProgramImpl.h lib/Makefile

Argyrios Kyrtzidis kyrtzidis at apple.com
Sun Jul 12 15:49:13 PDT 2009


Hi Chris,

On Jul 12, 2009, at 3:35 PM, Chris Lattner wrote:

>
>> +class Entity : public llvm::FoldingSetNode {
>> +public:
>
> Why should Entity's be FoldingSetNodes?  There are two reasons to use
> a folding set (instead of a DenseMap<pair<Entity*,void*>, Entity*>):
>
> 1. If you want to derive from Entity, so you may have heterogenous
> keys indexing the map.
> 2. If the key data is large.
>
> I don't think either of these applies here, should Entity's be uniqued
> with a DenseMap instead of a FoldingSet?

The key data is simple now but eventually it will grow, especially for  
supporting C++.
e.g., overloaded functions will be associated with different entities,  
so the key will include info about the parameter types.
And templates will introduce more complexity as well.

-Argiris



More information about the cfe-commits mailing list