summaryrefslogtreecommitdiffstats
path: root/contrib/llvm/tools/clang/include/clang/Index/DeclReferenceMap.h
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/llvm/tools/clang/include/clang/Index/DeclReferenceMap.h')
-rw-r--r--contrib/llvm/tools/clang/include/clang/Index/DeclReferenceMap.h50
1 files changed, 50 insertions, 0 deletions
diff --git a/contrib/llvm/tools/clang/include/clang/Index/DeclReferenceMap.h b/contrib/llvm/tools/clang/include/clang/Index/DeclReferenceMap.h
new file mode 100644
index 0000000..73f2fe5
--- /dev/null
+++ b/contrib/llvm/tools/clang/include/clang/Index/DeclReferenceMap.h
@@ -0,0 +1,50 @@
+//===--- DeclReferenceMap.h - Map Decls to their references -----*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// DeclReferenceMap creates a mapping from Decls to the ASTLocations that
+// reference them.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_CLANG_INDEX_DECLREFERENCEMAP_H
+#define LLVM_CLANG_INDEX_DECLREFERENCEMAP_H
+
+#include "clang/Index/ASTLocation.h"
+#include "clang/Index/STLExtras.h"
+#include <map>
+
+namespace clang {
+ class ASTContext;
+ class NamedDecl;
+
+namespace idx {
+
+/// \brief Maps NamedDecls with the ASTLocations that reference them.
+///
+/// References are mapped and retrieved using the canonical decls.
+class DeclReferenceMap {
+public:
+ explicit DeclReferenceMap(ASTContext &Ctx);
+
+ typedef std::multimap<NamedDecl*, ASTLocation> MapTy;
+ typedef pair_value_iterator<MapTy::iterator> astlocation_iterator;
+
+ astlocation_iterator refs_begin(NamedDecl *D) const;
+ astlocation_iterator refs_end(NamedDecl *D) const;
+ bool refs_empty(NamedDecl *D) const;
+
+private:
+ mutable MapTy Map;
+};
+
+} // end idx namespace
+
+} // end clang namespace
+
+#endif
OpenPOWER on IntegriCloud