AnalysisManager.cpp 1.1 KB

1234567891011121314151617181920212223242526272829303132
  1. //===-- 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. #include "clang/StaticAnalyzer/PathSensitive/AnalysisManager.h"
  10. #include "clang/Index/Entity.h"
  11. #include "clang/Index/Indexer.h"
  12. using namespace clang;
  13. using namespace ento;
  14. AnalysisContext *
  15. AnalysisManager::getAnalysisContextInAnotherTU(const Decl *D) {
  16. idx::Entity Ent = idx::Entity::get(const_cast<Decl *>(D),
  17. Idxer->getProgram());
  18. FunctionDecl *FuncDef;
  19. idx::TranslationUnit *TU;
  20. llvm::tie(FuncDef, TU) = Idxer->getDefinitionFor(Ent);
  21. if (FuncDef == 0)
  22. return 0;
  23. // This AnalysisContext wraps function definition in another translation unit.
  24. // But it is still owned by the AnalysisManager associated with the current
  25. // translation unit.
  26. return AnaCtxMgr.getContext(FuncDef, TU);
  27. }