diff options
Diffstat (limited to 'lib/Analysis/AnalysisDeclContext.cpp')
-rw-r--r-- | lib/Analysis/AnalysisDeclContext.cpp | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/lib/Analysis/AnalysisDeclContext.cpp b/lib/Analysis/AnalysisDeclContext.cpp index 36d1dba5e3..5ff7842407 100644 --- a/lib/Analysis/AnalysisDeclContext.cpp +++ b/lib/Analysis/AnalysisDeclContext.cpp @@ -28,6 +28,7 @@ #include "clang/Analysis/Support/BumpVector.h" #include "llvm/ADT/SmallPtrSet.h" #include "llvm/Support/ErrorHandling.h" +#include "llvm/Support/raw_ostream.h" #include "llvm/Support/SaveAndRestore.h" using namespace clang; @@ -66,13 +67,15 @@ AnalysisDeclContextManager::AnalysisDeclContextManager(bool useUnoptimizedCFG, bool addImplicitDtors, bool addInitializers, bool addTemporaryDtors, - bool synthesizeBodies) + bool synthesizeBodies, + bool addStaticInitBranch) : SynthesizeBodies(synthesizeBodies) { cfgBuildOptions.PruneTriviallyFalseEdges = !useUnoptimizedCFG; cfgBuildOptions.AddImplicitDtors = addImplicitDtors; cfgBuildOptions.AddInitializers = addInitializers; cfgBuildOptions.AddTemporaryDtors = addTemporaryDtors; + cfgBuildOptions.AddStaticInitBranches = addStaticInitBranch; } void AnalysisDeclContextManager::clear() { @@ -384,6 +387,31 @@ bool LocationContext::isParentOf(const LocationContext *LC) const { return false; } +void LocationContext::dumpStack() const { + ASTContext &Ctx = getAnalysisDeclContext()->getASTContext(); + PrintingPolicy PP(Ctx.getLangOpts()); + PP.TerseOutput = 1; + + unsigned Frame = 0; + for (const LocationContext *LCtx = this; LCtx; LCtx = LCtx->getParent()) { + switch (LCtx->getKind()) { + case StackFrame: + llvm::errs() << '#' << Frame++ << ' '; + cast<StackFrameContext>(LCtx)->getDecl()->print(llvm::errs(), PP); + llvm::errs() << '\n'; + break; + case Scope: + llvm::errs() << " (scope)\n"; + break; + case Block: + llvm::errs() << " (block context: " + << cast<BlockInvocationContext>(LCtx)->getContextData() + << ")\n"; + break; + } + } +} + //===----------------------------------------------------------------------===// // Lazily generated map to query the external variables referenced by a Block. //===----------------------------------------------------------------------===// |