[cfe-commits] r58657 - in /cfe/trunk/utils: ccc-analyzer scan-build

Ted Kremenek kremenek at apple.com
Mon Nov 3 16:02:53 PST 2008


Author: kremenek
Date: Mon Nov  3 18:02:53 2008
New Revision: 58657

URL: http://llvm.org/viewvc/llvm-project?rev=58657&view=rev
Log:
Allow user toggling between plist and html output with scan-build/ccc-analyzer.

Modified:
    cfe/trunk/utils/ccc-analyzer
    cfe/trunk/utils/scan-build

Modified: cfe/trunk/utils/ccc-analyzer
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/ccc-analyzer?rev=58657&r1=58656&r2=58657&view=diff

==============================================================================
--- cfe/trunk/utils/ccc-analyzer (original)
+++ cfe/trunk/utils/ccc-analyzer Mon Nov  3 18:02:53 2008
@@ -244,6 +244,9 @@
 # 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 (defined $StoreModel) {
       push @AnalyzeArgs, $StoreModel;
     }
+    
+    if (defined $OutputFormat) {
+      push @AnalyzeArgs, "-analyzer-output-" . $OutputFormat;
+    }
 
     push @AnalyzeArgs, at CompileOpts;
     push @AnalyzeArgs,$file;

Modified: cfe/trunk/utils/scan-build
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/scan-build?rev=58657&r1=58656&r2=58657&view=diff

==============================================================================
--- cfe/trunk/utils/scan-build (original)
+++ cfe/trunk/utils/scan-build Mon Nov  3 18:02:53 2008
@@ -856,7 +856,7 @@
                   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 @@
  --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 $ExitStatusFoundBugs = 0; # Exit status reflects whether bugs were found
 my @AnalysesToRun;
 my $StoreModel;
+my $OutputFormat;
 
 if (!@ARGV) {
   DisplayHelp();
@@ -1079,6 +1083,12 @@
     next;
   }
   
+  if ($arg eq "-plist") {
+    shift @ARGV;
+    $OutputFormat = "plist";
+    next;
+  }
+  
   DieDiag("unrecognized option '$arg'\n") if ($arg =~ /^-/);
   
   last;
@@ -1146,23 +1156,34 @@
   $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 ($ExitStatusFoundBugs) {
-  exit 1 if ($NumBugs > 0);
-  exit 0;
+  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;
+  }
 }
 
 exit $ExitStatus;





More information about the cfe-commits mailing list