aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJordan Rose <jordan_rose@apple.com>2013-03-14 17:18:30 +0000
committerJordan Rose <jordan_rose@apple.com>2013-03-14 17:18:30 +0000
commit4a374f9a58a5b350ec2e4123b20c9884ed1f5f15 (patch)
tree319f7cc85772b62b94492a1665cd40e0cc30ad9e
parent374516c8ec4f0fcf5a8b65ef9cf029f862d11096 (diff)
[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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177084 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--test/Analysis/analyzer-stats.c2
-rwxr-xr-xtools/scan-build/scan-build17
2 files changed, 10 insertions, 9 deletions
diff --git a/test/Analysis/analyzer-stats.c b/test/Analysis/analyzer-stats.c
index 9eeaade793..63073b7e40 100644
--- a/test/Analysis/analyzer-stats.c
+++ b/test/Analysis/analyzer-stats.c
@@ -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;
diff --git a/tools/scan-build/scan-build b/tools/scan-build/scan-build
index 4965dbdc7a..ff82e129d1 100755
--- a/tools/scan-build/scan-build
+++ b/tools/scan-build/scan-build
@@ -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;
}