llvm::BumpPtrAllocator A;
bool UseUnoptimizedCFG;
bool AddEHEdges;
+ bool AddImplicitDtors;
+ bool AddInitializers;
public:
AnalysisContext(const Decl *d, idx::TranslationUnit *tu,
bool useUnoptimizedCFG = false,
- bool addehedges = false)
+ bool addehedges = false,
+ bool addImplicitDtors = false,
+ bool addInitializers = false)
: D(d), TU(tu), cfg(0), completeCFG(0),
builtCFG(false), builtCompleteCFG(false),
liveness(0), relaxedLiveness(0), PM(0), PCA(0),
ReferencedBlockVars(0), UseUnoptimizedCFG(useUnoptimizedCFG),
- AddEHEdges(addehedges) {}
+ AddEHEdges(addehedges), AddImplicitDtors(addImplicitDtors),
+ AddInitializers(addInitializers) {}
~AnalysisContext();
bool getAddEHEdges() const { return AddEHEdges; }
bool getUseUnoptimizedCFG() const { return UseUnoptimizedCFG; }
+ bool getAddImplicitDtors() const { return AddImplicitDtors; }
+ bool getAddInitializers() const { return AddInitializers; }
Stmt *getBody();
CFG *getCFG();
typedef llvm::DenseMap<const Decl*, AnalysisContext*> ContextMap;
ContextMap Contexts;
bool UseUnoptimizedCFG;
+ bool AddImplicitDtors;
+ bool AddInitializers;
public:
- AnalysisContextManager(bool useUnoptimizedCFG = false)
- : UseUnoptimizedCFG(useUnoptimizedCFG) {}
+ AnalysisContextManager(bool useUnoptimizedCFG = false,
+ bool addImplicitDtors = false, bool addInitializers = false)
+ : UseUnoptimizedCFG(useUnoptimizedCFG), AddImplicitDtors(addImplicitDtors),
+ AddInitializers(addInitializers) {}
~AnalysisContextManager();
AnalysisContext *getContext(const Decl *D, idx::TranslationUnit *TU = 0);
bool getUseUnoptimizedCFG() const { return UseUnoptimizedCFG; }
+ bool getAddImplicitDtors() const { return AddImplicitDtors; }
+ bool getAddInitializers() const { return AddInitializers; }
// Discard all previously created AnalysisContexts.
void clear();
idx::Indexer *idxer,
unsigned maxnodes, unsigned maxvisit,
bool vizdot, bool vizubi, bool purge, bool eager, bool trim,
- bool inlinecall, bool useUnoptimizedCFG)
+ bool inlinecall, bool useUnoptimizedCFG,
+ bool addImplicitDtors, bool addInitializers)
- : AnaCtxMgr(useUnoptimizedCFG), Ctx(ctx), Diags(diags), LangInfo(lang),
- PD(pd),
+ : AnaCtxMgr(useUnoptimizedCFG, addImplicitDtors, addInitializers),
+ Ctx(ctx), Diags(diags), LangInfo(lang), PD(pd),
CreateStoreMgr(storemgr), CreateConstraintMgr(constraintmgr),Idxer(idxer),
AScope(ScopeDecl), MaxNodes(maxnodes), MaxVisit(maxvisit),
VisualizeEGDot(vizdot), VisualizeEGUbi(vizubi), PurgeDead(purge),
HelpText<"View Control-Flow Graphs using GraphViz">;
def analysis_UnoptimizedCFG : Flag<"-unoptimized-cfg">,
HelpText<"Generate unoptimized CFGs for all analyses">;
+def analysis_CFGAddImplicitDtors : Flag<"-cfg-add-implicit-dtors">,
+ HelpText<"Add C++ implicit destructors to CFGs for all analyses">;
+def analysis_CFGAddInitializers : Flag<"-cfg-add-initializers">,
+ HelpText<"Add C++ initializers to CFGs for all analyses">;
def analysis_DisplayLiveVariables : Flag<"-dump-live-variables">,
HelpText<"Print results of live variable analysis">;
def analysis_LLVMConventionChecker : Flag<"-analyzer-check-llvm-conventions">,
unsigned EnableExperimentalInternalChecks : 1;
unsigned InlineCall : 1;
unsigned UnoptimizedCFG : 1;
+ unsigned CFGAddImplicitDtors : 1;
+ unsigned CFGAddInitializers : 1;
public:
AnalyzerOptions() {
EnableExperimentalChecks = 0;
EnableExperimentalInternalChecks = 0;
UnoptimizedCFG = 0;
+ CFGAddImplicitDtors = 0;
+ CFGAddInitializers = 0;
}
};
if (!builtCFG) {
CFG::BuildOptions B;
B.AddEHEdges = AddEHEdges;
+ B.AddImplicitDtors = AddImplicitDtors;
+ B.AddInitializers = AddInitializers;
cfg = CFG::buildCFG(D, getBody(), &D->getASTContext(), B);
// Even when the cfg is not successfully built, we don't
// want to try building it again.
CFG::BuildOptions B;
B.PruneTriviallyFalseEdges = false;
B.AddEHEdges = AddEHEdges;
+ B.AddImplicitDtors = AddImplicitDtors;
+ B.AddInitializers = AddInitializers;
completeCFG = CFG::buildCFG(D, getBody(), &D->getASTContext(), B);
// Even when the cfg is not successfully built, we don't
// want to try building it again.
idx::TranslationUnit *TU) {
AnalysisContext *&AC = Contexts[D];
if (!AC)
- AC = new AnalysisContext(D, TU, UseUnoptimizedCFG);
+ AC = new AnalysisContext(D, TU, UseUnoptimizedCFG, false,
+ AddImplicitDtors, AddInitializers);
return AC;
}
Opts.VisualizeEGDot, Opts.VisualizeEGUbi,
Opts.PurgeDead, Opts.EagerlyAssume,
Opts.TrimGraph, Opts.InlineCall,
- Opts.UnoptimizedCFG));
+ Opts.UnoptimizedCFG, Opts.CFGAddImplicitDtors,
+ Opts.CFGAddInitializers));
}
virtual void HandleTranslationUnit(ASTContext &C);
OldMgr.shouldEagerlyAssume(),
OldMgr.shouldTrimGraph(),
OldMgr.shouldInlineCall(),
- OldMgr.getAnalysisContextManager().getUseUnoptimizedCFG());
+ OldMgr.getAnalysisContextManager().getUseUnoptimizedCFG(),
+ OldMgr.getAnalysisContextManager().getAddImplicitDtors(),
+ OldMgr.getAnalysisContextManager().getAddInitializers());
llvm::OwningPtr<GRTransferFuncs> TF(MakeCFRefCountTF(AMgr.getASTContext(),
/* GCEnabled */ false,
AMgr.getLangOptions()));
Opts.EagerlyAssume = Args.hasArg(OPT_analyzer_eagerly_assume);
Opts.AnalyzeSpecificFunction = Args.getLastArgValue(OPT_analyze_function);
Opts.UnoptimizedCFG = Args.hasArg(OPT_analysis_UnoptimizedCFG);
+ Opts.CFGAddImplicitDtors = Args.hasArg(OPT_analysis_CFGAddImplicitDtors);
+ Opts.CFGAddInitializers = Args.hasArg(OPT_analysis_CFGAddInitializers);
Opts.EnableExperimentalChecks = Args.hasArg(OPT_analyzer_experimental_checks);
Opts.EnableExperimentalInternalChecks =
Args.hasArg(OPT_analyzer_experimental_internal_checks);