diff options
author | Ted Kremenek <kremenek@apple.com> | 2009-07-30 23:55:19 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2009-07-30 23:55:19 +0000 |
commit | e600bedcfea91622a0003fdb5f66c500b2f9f17d (patch) | |
tree | 6d263617dd1567656982e589e5c3a737dd798a21 | |
parent | 9d702ae1cd5cfa19d884cbef77e1df99395138bb (diff) |
Add scan-build option '-no-failure-reports' to supress the creation of a 'failures' subdirectory that includes crash reports, preprocessed files, etc.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77644 91177308-0d34-0410-b5e6-96231b3b80d8
-rwxr-xr-x | utils/ccc-analyzer | 86 | ||||
-rwxr-xr-x | utils/scan-build | 8 |
2 files changed, 54 insertions, 40 deletions
diff --git a/utils/ccc-analyzer b/utils/ccc-analyzer index 73cc47b6ef..e8a9f6f24e 100755 --- a/utils/ccc-analyzer +++ b/utils/ccc-analyzer @@ -22,6 +22,10 @@ use Text::ParseWords; my $CC = $ENV{'CCC_CC'}; if (!defined $CC) { $CC = "gcc"; } + +my $ReportFailures = $ENV{'CCC_REPORT_FAILURES'}; +if (!defined $ReportFailures) { $ReportFailures = 1; } + my $CleanupFile; my $ResultFile; @@ -225,55 +229,57 @@ sub Analyze { my $Result = $?; # Did the command die because of a signal? - if ($Result & 127 and $Cmd eq $ClangCC and defined $HtmlDir) { - ProcessClangFailure($ClangCC, $Lang, $file, \@CmdArgsSansAnalyses, $HtmlDir, - "Crash", $ofile); - } - elsif ($Result) { - if ($IncludeParserRejects && !($file =~/conftest/)) { - ProcessClangFailure($ClangCC, $Lang, $file, \@CmdArgsSansAnalyses, $HtmlDir, - $ParserRejects, $ofile); + if ($ReportFailures) { + if ($Result & 127 and $Cmd eq $ClangCC and defined $HtmlDir) { + ProcessClangFailure($ClangCC, $Lang, $file, \@CmdArgsSansAnalyses, + $HtmlDir, "Crash", $ofile); } - } - else { - # Check if there were any unhandled attributes. - if (open(CHILD, $ofile)) { - my %attributes_not_handled; + elsif ($Result) { + if ($IncludeParserRejects && !($file =~/conftest/)) { + ProcessClangFailure($ClangCC, $Lang, $file, \@CmdArgsSansAnalyses, + $HtmlDir, $ParserRejects, $ofile); + } + } + else { + # Check if there were any unhandled attributes. + if (open(CHILD, $ofile)) { + my %attributes_not_handled; - # Don't flag warnings about the following attributes that we - # know are currently not supported by Clang. - $attributes_not_handled{"cdecl"} = 1; + # Don't flag warnings about the following attributes that we + # know are currently not supported by Clang. + $attributes_not_handled{"cdecl"} = 1; - my $ppfile; - while (<CHILD>) { - next if (! /warning: '([^\']+)' attribute ignored/); + my $ppfile; + while (<CHILD>) { + next if (! /warning: '([^\']+)' attribute ignored/); - # Have we already spotted this unhandled attribute? - next if (defined $attributes_not_handled{$1}); - $attributes_not_handled{$1} = 1; + # Have we already spotted this unhandled attribute? + next if (defined $attributes_not_handled{$1}); + $attributes_not_handled{$1} = 1; - # Get the name of the attribute file. - my $dir = "$HtmlDir/failures"; - my $afile = "$dir/attribute_ignored_$1.txt"; + # Get the name of the attribute file. + my $dir = "$HtmlDir/failures"; + my $afile = "$dir/attribute_ignored_$1.txt"; - # Only create another preprocessed file if the attribute file - # doesn't exist yet. - next if (-e $afile); + # Only create another preprocessed file if the attribute file + # doesn't exist yet. + next if (-e $afile); - # Add this file to the list of files that contained this attribute. - # Generate a preprocessed file if we haven't already. - if (!(defined $ppfile)) { - $ppfile = ProcessClangFailure($ClangCC, $Lang, $file, - \@CmdArgsSansAnalyses, - $HtmlDir, $AttributeIgnored, $ofile); + # Add this file to the list of files that contained this attribute. + # Generate a preprocessed file if we haven't already. + if (!(defined $ppfile)) { + $ppfile = ProcessClangFailure($ClangCC, $Lang, $file, + \@CmdArgsSansAnalyses, + $HtmlDir, $AttributeIgnored, $ofile); + } + + mkpath $dir; + open(AFILE, ">$afile"); + print AFILE "$ppfile\n"; + close(AFILE); } - - mkpath $dir; - open(AFILE, ">$afile"); - print AFILE "$ppfile\n"; - close(AFILE); + close CHILD; } - close CHILD; } } diff --git a/utils/scan-build b/utils/scan-build index d766258fde..acdc4ce9cd 100755 --- a/utils/scan-build +++ b/utils/scan-build @@ -959,6 +959,9 @@ ADVANCED OPTIONS: the 'basic' store model is used. 'region' specifies a field- sensitive store model. Be warned that the 'region' model is still in very early testing phase and may often crash. + + -no-failure-reports - Do not create a 'failures' subdirectory that includes + analyzer crash reports and preprocessed source files. AVAILABLE ANALYSES (multiple analyses may be specified): @@ -1172,6 +1175,11 @@ while (@ARGV) { $OutputFormat = "plist-html"; next; } + + if ($arg eq "-no-failure-reports") { + $ENV{"CCC_REPORT_FAILURES"} = 0; + next; + } DieDiag("unrecognized option '$arg'\n") if ($arg =~ /^-/); |