aboutsummaryrefslogtreecommitdiff
path: root/lib/EntoSA/AnalysisManager.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2010-12-23 07:22:02 +0000
committerTed Kremenek <kremenek@apple.com>2010-12-23 07:22:02 +0000
commit3a8f40ed5e86a97e07d255976a95d2f3ad792b6d (patch)
tree117254bbdb2b4fbee6911be73d204642e1f5e17e /lib/EntoSA/AnalysisManager.cpp
parent9ef6537a894c33003359b1f9b9676e9178e028b7 (diff)
Rename headers: 'clang/GR' 'clang/EntoSA' and
update Makefile. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122493 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/EntoSA/AnalysisManager.cpp')
-rw-r--r--lib/EntoSA/AnalysisManager.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/lib/EntoSA/AnalysisManager.cpp b/lib/EntoSA/AnalysisManager.cpp
new file mode 100644
index 0000000000..fa64f472f7
--- /dev/null
+++ b/lib/EntoSA/AnalysisManager.cpp
@@ -0,0 +1,32 @@
+//===-- AnalysisManager.cpp -------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "clang/EntoSA/PathSensitive/AnalysisManager.h"
+#include "clang/Index/Entity.h"
+#include "clang/Index/Indexer.h"
+
+using namespace clang;
+using namespace ento;
+
+AnalysisContext *
+AnalysisManager::getAnalysisContextInAnotherTU(const Decl *D) {
+ idx::Entity Ent = idx::Entity::get(const_cast<Decl *>(D),
+ Idxer->getProgram());
+ FunctionDecl *FuncDef;
+ idx::TranslationUnit *TU;
+ llvm::tie(FuncDef, TU) = Idxer->getDefinitionFor(Ent);
+
+ if (FuncDef == 0)
+ return 0;
+
+ // This AnalysisContext wraps function definition in another translation unit.
+ // But it is still owned by the AnalysisManager associated with the current
+ // translation unit.
+ return AnaCtxMgr.getContext(FuncDef, TU);
+}