]> granicus.if.org Git - clang/commitdiff
Add scan-build support for 'plist-html', a hybrid mode that supports the
authorTed Kremenek <kremenek@apple.com>
Mon, 27 Jul 2009 22:10:34 +0000 (22:10 +0000)
committerTed Kremenek <kremenek@apple.com>
Mon, 27 Jul 2009 22:10:34 +0000 (22:10 +0000)
creation of both HTML and plist files. Plist files are currently not generated
using the same layout algorithm as just specifying '-plist', so this is mainly
intended to help support automated runs of the analyzer.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77263 91177308-0d34-0410-b5e6-96231b3b80d8

utils/ccc-analyzer
utils/scan-build

index e4bf415b163f46201abd16a24a574b42b3e0e689..6355abcd192be0f7ad48db6e71edd3511156a5ae 100755 (executable)
@@ -584,7 +584,7 @@ if ($Action eq 'compile' or $Action eq 'link') {
 
     if (defined $OutputFormat) {
       push @AnalyzeArgs, "-analyzer-output=" . $OutputFormat;
-      if ($OutputFormat eq "plist") {
+      if ($OutputFormat =~ /plist/) {
         # Change "Output" to be a file.
         my ($h, $f) = tempfile("report-XXXXXX", SUFFIX => ".plist",
                                DIR => $HtmlDir);
index 79421caba91fc4dcc684236ec882ef9c2631c67b..d7b74e34111b9a5cb05e5428d972974e73b59a3a 100755 (executable)
@@ -1167,7 +1167,12 @@ while (@ARGV) {
     $OutputFormat = "plist";
     next;
   }
-  
+  if ($arg eq "-plist-html") {
+    shift @ARGV;
+    $OutputFormat = "plist-html";
+    next;
+  }
+
   DieDiag("unrecognized option '$arg'\n") if ($arg =~ /^-/);
   
   last;
@@ -1253,25 +1258,27 @@ if (defined $OutputFormat) {
 # Run the build.
 my $ExitStatus = RunBuildCommand(\@ARGV, $IgnoreErrors, $Cmd);
 
-if (defined $OutputFormat and $OutputFormat eq "plist") {
-  Diag "Analysis run complete.\n";
-  Diag "Analysis results (plist files) deposited in '$HtmlDir'\n";
-}
-else {
-  # Postprocess the HTML directory.
-  my $NumBugs = Postprocess($HtmlDir, $BaseDir);
+if (defined $OutputFormat) {
+  if ($OutputFormat =~ /html/) {
+    # 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 ($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;
+  elsif ($OutputFormat =~ /plist/) {
+    Diag "Analysis run complete.\n";
+    Diag "Analysis results (plist files) deposited in '$HtmlDir'\n";
   }
 }