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

Zhongxing Xu xuzhongxing at gmail.com
Mon May 17 17:28:37 PDT 2010


Author: zhongxingxu
Date: Mon May 17 19:28:37 2010
New Revision: 104007

URL: http://llvm.org/viewvc/llvm-project?rev=104007&view=rev
Log:
Add option '-analyzer-max-loop', which specifies the maximum 
number of times the analyzer will go through a loop.

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/Checker/GRExprEngine.cpp
    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=104007&r1=104006&r2=104007&view=diff
==============================================================================
--- cfe/trunk/include/clang/Checker/PathSensitive/AnalysisManager.h (original)
+++ cfe/trunk/include/clang/Checker/PathSensitive/AnalysisManager.h Mon May 17 19:28:37 2010
@@ -37,8 +37,12 @@
 
   enum AnalysisScope { ScopeTU, ScopeDecl } AScope;
 
+  // The maximum number of exploded nodes the analyzer will generate.
   unsigned MaxNodes;
 
+  // The maximum number of times the analyzer will go through a loop.
+  unsigned MaxLoop;
+
   bool VisualizeEGDot;
   bool VisualizeEGUbi;
   bool PurgeDead;
@@ -59,12 +63,13 @@
                   const LangOptions &lang, PathDiagnosticClient *pd,
                   StoreManagerCreator storemgr,
                   ConstraintManagerCreator constraintmgr, unsigned maxnodes,
+                  unsigned maxloop,
                   bool vizdot, bool vizubi, bool purge, bool eager, bool trim,
                   bool inlinecall)
 
     : Ctx(ctx), Diags(diags), LangInfo(lang), PD(pd),
       CreateStoreMgr(storemgr), CreateConstraintMgr(constraintmgr),
-      AScope(ScopeDecl), MaxNodes(maxnodes),
+      AScope(ScopeDecl), MaxNodes(maxnodes), MaxLoop(maxloop),
       VisualizeEGDot(vizdot), VisualizeEGUbi(vizubi), PurgeDead(purge),
       EagerlyAssume(eager), TrimGraph(trim), InlineCall(inlinecall) {}
   
@@ -110,6 +115,8 @@
 
   unsigned getMaxNodes() const { return MaxNodes; }
 
+  unsigned getMaxLoop() const { return MaxLoop; }
+
   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=104007&r1=104006&r2=104007&view=diff
==============================================================================
--- cfe/trunk/include/clang/Driver/CC1Options.td (original)
+++ cfe/trunk/include/clang/Driver/CC1Options.td Mon May 17 19:28:37 2010
@@ -99,6 +99,8 @@
   HelpText<"Experimental transfer function inlining callees when its definition is available.">;
 def analyzer_max_nodes : Separate<"-analyzer-max-nodes">,
   HelpText<"The maximum number of nodes the analyzer can generate">;
+def analyzer_max_loop : Separate<"-analyzer-max-loop">,
+  HelpText<"The maximum number of times the analyzer will go through a loop">;
 
 //===----------------------------------------------------------------------===//
 // 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=104007&r1=104006&r2=104007&view=diff
==============================================================================
--- cfe/trunk/include/clang/Frontend/AnalysisConsumer.h (original)
+++ cfe/trunk/include/clang/Frontend/AnalysisConsumer.h Mon May 17 19:28:37 2010
@@ -61,6 +61,7 @@
   AnalysisDiagClients AnalysisDiagOpt;
   std::string AnalyzeSpecificFunction;
   unsigned MaxNodes;
+  unsigned MaxLoop;
   unsigned AnalyzeAll : 1;
   unsigned AnalyzerDisplayProgress : 1;
   unsigned AnalyzeNestedBlocks : 1;

Modified: cfe/trunk/lib/Checker/GRExprEngine.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Checker/GRExprEngine.cpp?rev=104007&r1=104006&r2=104007&view=diff
==============================================================================
--- cfe/trunk/lib/Checker/GRExprEngine.cpp (original)
+++ cfe/trunk/lib/Checker/GRExprEngine.cpp Mon May 17 19:28:37 2010
@@ -1017,9 +1017,8 @@
 
 bool GRExprEngine::ProcessBlockEntrance(CFGBlock* B, const ExplodedNode *Pred,
                                         GRBlockCounter BC) {
-
   return BC.getNumVisited(Pred->getLocationContext()->getCurrentStackFrame(), 
-                          B->getBlockID()) < 3;
+                          B->getBlockID()) < AMgr.getMaxLoop();
 }
 
 //===----------------------------------------------------------------------===//

Modified: cfe/trunk/lib/Frontend/AnalysisConsumer.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/AnalysisConsumer.cpp?rev=104007&r1=104006&r2=104007&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/AnalysisConsumer.cpp (original)
+++ cfe/trunk/lib/Frontend/AnalysisConsumer.cpp Mon May 17 19:28:37 2010
@@ -174,7 +174,7 @@
     Mgr.reset(new AnalysisManager(*Ctx, PP.getDiagnostics(),
                                   PP.getLangOptions(), PD,
                                   CreateStoreMgr, CreateConstraintMgr,
-                                  Opts.MaxNodes,
+                                  Opts.MaxNodes, Opts.MaxLoop,
                                   Opts.VisualizeEGDot, Opts.VisualizeEGUbi,
                                   Opts.PurgeDead, Opts.EagerlyAssume,
                                   Opts.TrimGraph, Opts.InlineCall));

Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=104007&r1=104006&r2=104007&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Mon May 17 19:28:37 2010
@@ -798,6 +798,7 @@
     Args.hasArg(OPT_analyzer_experimental_internal_checks);
   Opts.TrimGraph = Args.hasArg(OPT_trim_egraph);
   Opts.MaxNodes = getLastArgIntValue(Args, OPT_analyzer_max_nodes,150000,Diags);
+  Opts.MaxLoop = getLastArgIntValue(Args, OPT_analyzer_max_loop, 3, Diags);
   Opts.InlineCall = Args.hasArg(OPT_analyzer_inline_call);
 }
 





More information about the cfe-commits mailing list