blob: 736cf1d7b18a2c408025043ac8d9552216d558a3 [file] [log] [blame]
Zhongxing Xuc6238d22010-07-19 01:31:21 +00001//===-- AnalysisManager.cpp -------------------------------------*- C++ -*-===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
Argyrios Kyrtzidis98cabba2010-12-22 18:51:49 +000010#include "clang/GR/PathSensitive/AnalysisManager.h"
Zhongxing Xuc6238d22010-07-19 01:31:21 +000011#include "clang/Index/Entity.h"
12#include "clang/Index/Indexer.h"
13
14using namespace clang;
15
Zhongxing Xu19b78d92010-11-24 08:53:20 +000016AnalysisContext *
Zhongxing Xuc6238d22010-07-19 01:31:21 +000017AnalysisManager::getAnalysisContextInAnotherTU(const Decl *D) {
18 idx::Entity Ent = idx::Entity::get(const_cast<Decl *>(D),
19 Idxer->getProgram());
20 FunctionDecl *FuncDef;
21 idx::TranslationUnit *TU;
22 llvm::tie(FuncDef, TU) = Idxer->getDefinitionFor(Ent);
23
24 if (FuncDef == 0)
25 return 0;
26
27 // This AnalysisContext wraps function definition in another translation unit.
28 // But it is still owned by the AnalysisManager associated with the current
29 // translation unit.
30 return AnaCtxMgr.getContext(FuncDef, TU);
31}