r177084 - [analyzer] Fix scan-build's -stats mode.

Jordan Rose jordan_rose at apple.com
Thu Mar 14 10:18:30 PDT 2013


Author: jrose
Date: Thu Mar 14 12:18:30 2013
New Revision: 177084

URL: http://llvm.org/viewvc/llvm-project?rev=177084&view=rev
Log:
[analyzer] Fix scan-build's -stats mode.

We were failing to match the output line, which led to us collecting no
stats at all, which led to a divide-by-zero error.

Fixes PR15510.

Modified:
    cfe/trunk/test/Analysis/analyzer-stats.c
    cfe/trunk/tools/scan-build/scan-build

Modified: cfe/trunk/test/Analysis/analyzer-stats.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/analyzer-stats.c?rev=177084&r1=177083&r2=177084&view=diff
==============================================================================
--- cfe/trunk/test/Analysis/analyzer-stats.c (original)
+++ cfe/trunk/test/Analysis/analyzer-stats.c Thu Mar 14 12:18:30 2013
@@ -2,7 +2,7 @@
 
 int foo();
 
-int test() { // expected-warning{{Total CFGBlocks}}
+int test() { // expected-warning-re{{test -> Total CFGBlocks: [0-9]+ \| Unreachable CFGBlocks: 0 \| Exhausted Block: no \| Empty WorkList: yes}}
   int a = 1;
   a = 34 / 12;
 

Modified: cfe/trunk/tools/scan-build/scan-build
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/scan-build/scan-build?rev=177084&r1=177083&r2=177084&view=diff
==============================================================================
--- cfe/trunk/tools/scan-build/scan-build (original)
+++ cfe/trunk/tools/scan-build/scan-build Thu Mar 14 12:18:30 2013
@@ -284,10 +284,11 @@ sub UpdateInFilePath {
 sub AddStatLine {
   my $Line  = shift;
   my $Stats = shift;
+  my $File  = shift;
 
   print $Line . "\n";
 
-  my $Regex = qr/(.*?)\ :\ (.*?)\ ->\ Total\ CFGBlocks:\ (\d+)\ \|\ Unreachable
+  my $Regex = qr/(.*?)\ ->\ Total\ CFGBlocks:\ (\d+)\ \|\ Unreachable
       \ CFGBlocks:\ (\d+)\ \|\ Exhausted\ Block:\ (yes|no)\ \|\ Empty\ WorkList:
       \ (yes|no)/x;
 
@@ -297,12 +298,12 @@ sub AddStatLine {
 
   # Create a hash of the interesting fields
   my $Row = {
-    Filename    => $1,
-    Function    => $2,
-    Total       => $3,
-    Unreachable => $4,
-    Aborted     => $5,
-    Empty       => $6
+    Filename    => $File,
+    Function    => $1,
+    Total       => $2,
+    Unreachable => $3,
+    Aborted     => $4,
+    Empty       => $5
   };
 
   # Add them to the stats array
@@ -383,7 +384,7 @@ sub ScanFile {
 
   # Don't add internal statistics to the bug reports
   if ($BugCategory =~ /statistics/i) {
-    AddStatLine($BugDescription, $Stats);
+    AddStatLine($BugDescription, $Stats, $BugFile);
     return;
   }
   





More information about the cfe-commits mailing list