diff options
Diffstat (limited to 'include/clang')
-rw-r--r-- | include/clang/Index/Entity.h | 4 | ||||
-rw-r--r-- | include/clang/Index/Indexer.h | 7 |
2 files changed, 11 insertions, 0 deletions
diff --git a/include/clang/Index/Entity.h b/include/clang/Index/Entity.h index c2aab62e23..9863963ff2 100644 --- a/include/clang/Index/Entity.h +++ b/include/clang/Index/Entity.h @@ -17,6 +17,7 @@ #include "llvm/ADT/PointerUnion.h" #include "llvm/ADT/DenseMap.h" +#include "llvm/ADT/StringRef.h" #include <string> namespace clang { @@ -71,6 +72,9 @@ public: /// \returns invalid Entity if an Entity cannot refer to this Decl. static Entity get(Decl *D, Program &Prog); + /// \brief Get an Entity associated with a name in the global namespace. + static Entity get(llvm::StringRef Name, Program &Prog); + /// \brief true if the Entity is not visible outside the trasnlation unit. bool isInternalToTU() const { assert(isValid() && "This Entity is not valid!"); diff --git a/include/clang/Index/Indexer.h b/include/clang/Index/Indexer.h index 361e729fea..96c585df24 100644 --- a/include/clang/Index/Indexer.h +++ b/include/clang/Index/Indexer.h @@ -23,6 +23,7 @@ namespace clang { class ASTContext; + class FunctionDecl; namespace idx { class Program; @@ -35,6 +36,7 @@ public: typedef llvm::DenseMap<ASTContext *, TranslationUnit *> CtxTUMapTy; typedef std::map<Entity, TUSetTy> MapTy; typedef std::map<GlobalSelector, TUSetTy> SelMapTy; + typedef std::map<Entity, std::pair<FunctionDecl*,TranslationUnit*> > DefMapTy; explicit Indexer(Program &prog) : Prog(prog) { } @@ -49,10 +51,15 @@ public: virtual void GetTranslationUnitsFor(GlobalSelector Sel, TranslationUnitHandler &Handler); + std::pair<FunctionDecl*, TranslationUnit*> getDefinitionFor(Entity Ent); + private: Program &Prog; MapTy Map; + // Map a function Entity to the its definition. + DefMapTy DefMap; + CtxTUMapTy CtxTUMap; SelMapTy SelMap; }; |