[cfe-commits] r151656 - in /cfe/trunk: lib/StaticAnalyzer/Core/ExprEngine.cpp test/Analysis/stats.c

Anna Zaks ganna at apple.com
Tue Feb 28 13:49:04 PST 2012


Author: zaks
Date: Tue Feb 28 15:49:04 2012
New Revision: 151656

URL: http://llvm.org/viewvc/llvm-project?rev=151656&view=rev
Log:
[analyzer] Stats: Add the stats about remove dead bindings, correct the
test.

Modified:
    cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp
    cfe/trunk/test/Analysis/stats.c

Modified: cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp?rev=151656&r1=151655&r2=151656&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp Tue Feb 28 15:49:04 2012
@@ -13,6 +13,8 @@
 //
 //===----------------------------------------------------------------------===//
 
+#define DEBUG_TYPE "ExprEngine"
+
 #include "clang/StaticAnalyzer/Core/CheckerManager.h"
 #include "clang/StaticAnalyzer/Core/BugReporter/BugType.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/AnalysisManager.h"
@@ -27,6 +29,7 @@
 #include "clang/Basic/PrettyStackTrace.h"
 #include "llvm/Support/raw_ostream.h"
 #include "llvm/ADT/ImmutableList.h"
+#include "llvm/ADT/Statistic.h"
 
 #ifndef NDEBUG
 #include "llvm/Support/GraphWriter.h"
@@ -36,6 +39,11 @@
 using namespace ento;
 using llvm::APSInt;
 
+STATISTIC(NumRemoveDeadBindings,
+            "The # of times RemoveDeadBindings is called");
+STATISTIC(NumRemoveDeadBindingsSkipped,
+            "The # of times RemoveDeadBindings is skipped");
+
 //===----------------------------------------------------------------------===//
 // Utility functions.
 //===----------------------------------------------------------------------===//
@@ -261,6 +269,7 @@
   SymbolReaper SymReaper(LC, currentStmt, SymMgr, getStoreManager());
 
   if (shouldRemoveDeadBindings(AMgr, S, Pred, LC)) {
+    NumRemoveDeadBindings++;
     getCheckerManager().runCheckersForLiveSymbols(CleanedState, SymReaper);
 
     const StackFrameContext *SFC = LC->getCurrentStackFrame();
@@ -269,6 +278,8 @@
     // and the store. TODO: The function should just return new env and store,
     // not a new state.
     CleanedState = StateMgr.removeDeadBindings(CleanedState, SFC, SymReaper);
+  } else {
+    NumRemoveDeadBindingsSkipped++;
   }
 
   // Process any special transfer function for dead symbols.

Modified: cfe/trunk/test/Analysis/stats.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/stats.c?rev=151656&r1=151655&r2=151656&view=diff
==============================================================================
--- cfe/trunk/test/Analysis/stats.c (original)
+++ cfe/trunk/test/Analysis/stats.c Tue Feb 28 15:49:04 2012
@@ -1,7 +1,7 @@
-// RUN: %clang_cc1 -analyze -analyzer-stats %s 2>&1 | FileCheck %s
-// XFAIL: *
+// RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-stats %s > FileCheck %s
 
 void foo() {
-  ;
+  int x;
 }
 // CHECK: ... Statistics Collected ...
+// CHECK:The # of times RemoveDeadBindings is called





More information about the cfe-commits mailing list