aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2008-11-04 00:02:53 +0000
committerTed Kremenek <kremenek@apple.com>2008-11-04 00:02:53 +0000
commitdb4f5f26182c522e659af655e2582cc5ea35a971 (patch)
tree51f991123e94e1ecb7ca88e268f79eddd29089d0
parentd0e2f83f958322d32e28bed3bffb20af36cf5693 (diff)
Allow user toggling between plist and html output with scan-build/ccc-analyzer.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58657 91177308-0d34-0410-b5e6-96231b3b80d8
-rwxr-xr-xutils/ccc-analyzer7
-rwxr-xr-xutils/scan-build45
2 files changed, 40 insertions, 12 deletions
diff --git a/utils/ccc-analyzer b/utils/ccc-analyzer
index 9f07009f15..e03a78bed3 100755
--- a/utils/ccc-analyzer
+++ b/utils/ccc-analyzer
@@ -244,6 +244,9 @@ if (!defined($Analyses)) { $Analyses = '-checker-cfref'; }
# Get the store model.
my $StoreModel = $ENV{'CCC_ANALYZER_STORE_MODEL'};
+# Get the output format.
+my $OutputFormat = $ENV{'CCC_ANALYZER_OUTPUT_FORMAT'};
+
# Determine the level of verbosity.
my $Verbose = 0;
if (defined $ENV{CCC_ANALYZER_VERBOSE}) { $Verbose = 1; }
@@ -422,6 +425,10 @@ if ($Action eq 'compile' or $Action eq 'link') {
if (defined $StoreModel) {
push @AnalyzeArgs, $StoreModel;
}
+
+ if (defined $OutputFormat) {
+ push @AnalyzeArgs, "-analyzer-output-" . $OutputFormat;
+ }
push @AnalyzeArgs,@CompileOpts;
push @AnalyzeArgs,$file;
diff --git a/utils/scan-build b/utils/scan-build
index 0d4bc90d06..f598bb0eaa 100755
--- a/utils/scan-build
+++ b/utils/scan-build
@@ -856,7 +856,7 @@ OPTIONS:
will be created as needed to represent separate "runs" of
the analyzer. If this option is not specified, a directory
is created in /tmp (TMPDIR on Mac OS X) to store the reports.
-
+
-h - Display this message.
--help
@@ -868,6 +868,9 @@ OPTIONS:
--html-title [title] - Specify the title used on generated HTML pages.
--html-title=[title] If not specified, a default title will be used.
+ -plist - By default the output of scan-build is a set of HTML files.
+ This option outputs the results as a set of .plist files.
+
--status-bugs - By default, the exit status of $Prog is the same as the
executed build command. Specifying this option causes the
exit status of $Prog to be 1 if it found potential bugs
@@ -960,6 +963,7 @@ my $ViewResults = 0; # View results when the build terminates.
my $ExitStatusFoundBugs = 0; # Exit status reflects whether bugs were found
my @AnalysesToRun;
my $StoreModel;
+my $OutputFormat;
if (!@ARGV) {
DisplayHelp();
@@ -1079,6 +1083,12 @@ while (@ARGV) {
next;
}
+ if ($arg eq "-plist") {
+ shift @ARGV;
+ $OutputFormat = "plist";
+ next;
+ }
+
DieDiag("unrecognized option '$arg'\n") if ($arg =~ /^-/);
last;
@@ -1146,23 +1156,34 @@ if (defined $StoreModel) {
$ENV{'CCC_ANALYZER_STORE_MODEL'} = $StoreModel;
}
+if (defined $OutputFormat) {
+ $ENV{'CCC_ANALYZER_OUTPUT_FORMAT'} = $OutputFormat;
+}
+
+
# Run the build.
my $ExitStatus = RunBuildCommand(\@ARGV, $IgnoreErrors, $Cmd);
-# Postprocess the HTML directory.
-my $NumBugs = Postprocess($HtmlDir, $BaseDir);
-
-if ($ViewResults and -r "$HtmlDir/index.html") {
+if ($OutputFormat eq "plist") {
Diag "Analysis run complete.\n";
- Diag "Viewing analysis results in '$HtmlDir' using scan-view.\n";
- my $ScanView = Cwd::realpath("$RealBin/scan-view");
- if (! -x $ScanView) { $ScanView = "scan-view"; }
- exec $ScanView, "$HtmlDir";
+ Diag "Analysis results (plist files) deposited in '$HtmlDir'\n";
}
+else {
+ # Postprocess the HTML directory.
+ my $NumBugs = Postprocess($HtmlDir, $BaseDir);
+
+ if ($ViewResults and -r "$HtmlDir/index.html") {
+ Diag "Analysis run complete.\n";
+ Diag "Viewing analysis results in '$HtmlDir' using scan-view.\n";
+ my $ScanView = Cwd::realpath("$RealBin/scan-view");
+ if (! -x $ScanView) { $ScanView = "scan-view"; }
+ exec $ScanView, "$HtmlDir";
+ }
-if ($ExitStatusFoundBugs) {
- exit 1 if ($NumBugs > 0);
- exit 0;
+ if ($ExitStatusFoundBugs) {
+ exit 1 if ($NumBugs > 0);
+ exit 0;
+ }
}
exit $ExitStatus;