[cfe-commits] r101120 - in /cfe/trunk: include/clang/Checker/PathSensitive/AnalysisManager.h include/clang/Driver/CC1Options.td include/clang/Frontend/AnalysisConsumer.h lib/Frontend/AnalysisConsumer.cpp lib/Frontend/CompilerInvocation.cpp

Zhongxing Xu xuzhongxing at gmail.com
Mon Apr 12 23:44:31 PDT 2010


Author: zhongxingxu
Date: Tue Apr 13 01:44:31 2010
New Revision: 101120

URL: http://llvm.org/viewvc/llvm-project?rev=101120&view=rev
Log:
Add a cc1 option to specify the max number of nodes the analyzer can explore.

Modified:
    cfe/trunk/include/clang/Checker/PathSensitive/AnalysisManager.h
    cfe/trunk/include/clang/Driver/CC1Options.td
    cfe/trunk/include/clang/Frontend/AnalysisConsumer.h
    cfe/trunk/lib/Frontend/AnalysisConsumer.cpp
    cfe/trunk/lib/Frontend/CompilerInvocation.cpp

Modified: cfe/trunk/include/clang/Checker/PathSensitive/AnalysisManager.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Checker/PathSensitive/AnalysisManager.h?rev=101120&r1=101119&r2=101120&view=diff
==============================================================================
--- cfe/trunk/include/clang/Checker/PathSensitive/AnalysisManager.h (original)
+++ cfe/trunk/include/clang/Checker/PathSensitive/AnalysisManager.h Tue Apr 13 01:44:31 2010
@@ -37,6 +37,8 @@
 
   enum AnalysisScope { ScopeTU, ScopeDecl } AScope;
 
+  unsigned MaxNodes;
+
   bool VisualizeEGDot;
   bool VisualizeEGUbi;
   bool PurgeDead;
@@ -55,12 +57,12 @@
   AnalysisManager(ASTContext &ctx, Diagnostic &diags, 
                   const LangOptions &lang, PathDiagnosticClient *pd,
                   StoreManagerCreator storemgr,
-                  ConstraintManagerCreator constraintmgr,
+                  ConstraintManagerCreator constraintmgr, unsigned maxnodes,
                   bool vizdot, bool vizubi, bool purge, bool eager, bool trim)
 
     : Ctx(ctx), Diags(diags), LangInfo(lang), PD(pd),
       CreateStoreMgr(storemgr), CreateConstraintMgr(constraintmgr),
-      AScope(ScopeDecl),
+      AScope(ScopeDecl), MaxNodes(maxnodes),
       VisualizeEGDot(vizdot), VisualizeEGUbi(vizubi), PurgeDead(purge),
       EagerlyAssume(eager), TrimGraph(trim) {}
   
@@ -104,6 +106,8 @@
       PD->FlushDiagnostics();
   }
 
+  unsigned getMaxNodes() const { return MaxNodes; }
+
   bool shouldVisualizeGraphviz() const { return VisualizeEGDot; }
 
   bool shouldVisualizeUbigraph() const { return VisualizeEGUbi; }

Modified: cfe/trunk/include/clang/Driver/CC1Options.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/CC1Options.td?rev=101120&r1=101119&r2=101120&view=diff
==============================================================================
--- cfe/trunk/include/clang/Driver/CC1Options.td (original)
+++ cfe/trunk/include/clang/Driver/CC1Options.td Tue Apr 13 01:44:31 2010
@@ -97,6 +97,8 @@
   HelpText<"Display exploded graph using GraphViz">;
 def analyzer_viz_egraph_ubigraph : Flag<"-analyzer-viz-egraph-ubigraph">,
   HelpText<"Display exploded graph using Ubigraph">;
+def analyzer_max_nodes : Separate<"-analyzer-max-nodes">,
+  HelpText<"The maximum number of nodes the analyzer can generate">;
 
 //===----------------------------------------------------------------------===//
 // CodeGen Options

Modified: cfe/trunk/include/clang/Frontend/AnalysisConsumer.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/AnalysisConsumer.h?rev=101120&r1=101119&r2=101120&view=diff
==============================================================================
--- cfe/trunk/include/clang/Frontend/AnalysisConsumer.h (original)
+++ cfe/trunk/include/clang/Frontend/AnalysisConsumer.h Tue Apr 13 01:44:31 2010
@@ -60,6 +60,7 @@
   AnalysisConstraints AnalysisConstraintsOpt;
   AnalysisDiagClients AnalysisDiagOpt;
   std::string AnalyzeSpecificFunction;
+  unsigned MaxNodes;
   unsigned AnalyzeAll : 1;
   unsigned AnalyzerDisplayProgress : 1;
   unsigned AnalyzeNestedBlocks : 1;

Modified: cfe/trunk/lib/Frontend/AnalysisConsumer.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/AnalysisConsumer.cpp?rev=101120&r1=101119&r2=101120&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/AnalysisConsumer.cpp (original)
+++ cfe/trunk/lib/Frontend/AnalysisConsumer.cpp Tue Apr 13 01:44:31 2010
@@ -176,6 +176,7 @@
     Mgr.reset(new AnalysisManager(*Ctx, PP.getDiagnostics(),
                                   PP.getLangOptions(), PD,
                                   CreateStoreMgr, CreateConstraintMgr,
+                                  Opts.MaxNodes,
                                   Opts.VisualizeEGDot, Opts.VisualizeEGUbi,
                                   Opts.PurgeDead, Opts.EagerlyAssume,
                                   Opts.TrimGraph));
@@ -358,7 +359,7 @@
   }
 
   // Execute the worklist algorithm.
-  Eng.ExecuteWorkList(mgr.getStackFrame(D));
+  Eng.ExecuteWorkList(mgr.getStackFrame(D), mgr.getMaxNodes());
 
   // Release the auditor (if any) so that it doesn't monitor the graph
   // created BugReporter.

Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=101120&r1=101119&r2=101120&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Tue Apr 13 01:44:31 2010
@@ -762,6 +762,7 @@
   Opts.EnableExperimentalInternalChecks =
     Args.hasArg(OPT_analyzer_experimental_internal_checks);
   Opts.TrimGraph = Args.hasArg(OPT_trim_egraph);
+  Opts.MaxNodes = getLastArgIntValue(Args, OPT_analyzer_max_nodes,150000,Diags);
 }
 
 static void ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args,





More information about the cfe-commits mailing list