summaryrefslogtreecommitdiff
path: root/include/clang/Index
diff options
context:
space:
mode:
authorRoman Divacky <rdivacky@FreeBSD.org>2010-07-13 17:21:42 +0000
committerRoman Divacky <rdivacky@FreeBSD.org>2010-07-13 17:21:42 +0000
commit4ba675006b5a8edfc48b6a9bd3dcf54a70cc08f2 (patch)
tree48b44512b5db8ced345df4a1a56b5065cf2a14d9 /include/clang/Index
parentd7279c4c177bca357ef96ff1379fd9bc420bfe83 (diff)
Diffstat (limited to 'include/clang/Index')
-rw-r--r--include/clang/Index/CallGraph.h4
-rw-r--r--include/clang/Index/Entity.h4
-rw-r--r--include/clang/Index/Indexer.h7
-rw-r--r--include/clang/Index/TranslationUnit.h2
4 files changed, 15 insertions, 2 deletions
diff --git a/include/clang/Index/CallGraph.h b/include/clang/Index/CallGraph.h
index 5edfe6fea8db6..336bf47a2efc6 100644
--- a/include/clang/Index/CallGraph.h
+++ b/include/clang/Index/CallGraph.h
@@ -54,7 +54,7 @@ public:
class CallGraph {
/// Program manages all Entities.
- idx::Program Prog;
+ idx::Program &Prog;
typedef std::map<idx::Entity, CallGraphNode *> FunctionMapTy;
@@ -71,7 +71,7 @@ class CallGraph {
CallGraphNode *ExternalCallingNode;
public:
- CallGraph();
+ CallGraph(idx::Program &P);
~CallGraph();
typedef FunctionMapTy::iterator iterator;
diff --git a/include/clang/Index/Entity.h b/include/clang/Index/Entity.h
index c2aab62e23f2a..9863963ff2172 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 361e729feab2d..96c585df2478c 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;
};
diff --git a/include/clang/Index/TranslationUnit.h b/include/clang/Index/TranslationUnit.h
index bf9e78f72892c..b86ba3ee8a581 100644
--- a/include/clang/Index/TranslationUnit.h
+++ b/include/clang/Index/TranslationUnit.h
@@ -16,6 +16,7 @@
namespace clang {
class ASTContext;
+ class Preprocessor;
namespace idx {
class DeclReferenceMap;
@@ -26,6 +27,7 @@ class TranslationUnit {
public:
virtual ~TranslationUnit();
virtual ASTContext &getASTContext() = 0;
+ virtual Preprocessor &getPreprocessor() = 0;
virtual DeclReferenceMap &getDeclReferenceMap() = 0;
virtual SelectorMap &getSelectorMap() = 0;
};