[cfe-commits] r49108 - /cfe/trunk/utils/scan-build

Ted Kremenek kremenek at apple.com
Wed Apr 2 11:42:49 PDT 2008


Author: kremenek
Date: Wed Apr  2 13:42:49 2008
New Revision: 49108

URL: http://llvm.org/viewvc/llvm-project?rev=49108&view=rev
Log:
Initial work on CSS in generated index.html.
Added "-V/--view" option to view index.html after it has been generated.

Modified:
    cfe/trunk/utils/scan-build

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

==============================================================================
--- cfe/trunk/utils/scan-build (original)
+++ cfe/trunk/utils/scan-build Wed Apr  2 13:42:49 2008
@@ -181,8 +181,25 @@
 print OUT <<ENDTEXT;
 <html>
 <head>
+<style type="text/css">
+ body { color:#000000; background-color:#ffffff }
+ body { font-family: Helvetica, sans-serif; font-size:10pt }
+ h1 { font-size:12pt }
+ .reports { border: 1px #000000 solid }
+ .reports { border-collapse: collapse; border-spacing: 0px }
+ tr { vertical-align:top }
+ td { border-bottom: 1px #000000 dotted }
+ td { padding:5px; padding-left:5px; padding-right:5px }
+ td.header { border-top: 2px solid #000000; }
+ td.header { border-bottom: 2px solid #000000; }
+ td.header { font-weight: bold; font-family: Verdana }
+</style>
 </head>\n<body>
 <table class="reports">
+<tr>
+  <td class="header">Bug Type</td>
+  <td class="header"></td>
+</tr>
 ENDTEXT
 
   for my $row ( sort { $a->[1] cmp $b->[1] } @Index ) {
@@ -196,9 +213,12 @@
     for my $j ( 2 .. $#{$row} ) {
       print OUT "<td>$row->[$j]</td>\n"
     }
+
+    # Emit the "View" link.
+    
+    print OUT " <td><a href=\"$ReportFile#EndPath\">View</a></td>\n";
     
-#    print OUT "<td><input type=\"button\" value=\"View\"></td>\n";
-    print OUT "<td><a href=\"$ReportFile#EndPath\">View</a></td>\n";
+    # End the row.
     print OUT "</tr>\n";
   }
   
@@ -259,6 +279,9 @@
   -v            - Verbose output from $Prog and the analyzer.
                   A second "-v" increases verbosity.
 
+  -V            - View analysis results in a web browser when the build
+  --view          completes.
+
 BUILD OPTIONS
 
   You can specify any build option acceptable to the build command.
@@ -281,6 +304,7 @@
 
 my $HtmlDir;           # Parent directory to store HTML files.
 my $IgnoreErrors = 0;  # Ignore build errors.
+my $ViewResults  = 0;  # View results when the build terminates.
 
 if (!@ARGV) {
   DisplayHelp();
@@ -321,6 +345,12 @@
     next;
   }
   
+  if ($arg eq "-V" or $arg eq "--view") {
+    shift @ARGV;
+    $ViewResults = 1;    
+    next;
+  }
+  
   die "$Prog: unrecognized option '$arg'\n" if ($arg =~ /^-/);
   
   last;
@@ -366,3 +396,9 @@
 # Postprocess the HTML directory.
 
 Postprocess($HtmlDir);
+
+if ($ViewResults and -r "$HtmlDir/index.html") {
+  # Only works on Mac OS X (for now).
+  print "Viewing analysis results: '$HtmlDir/index.html'\n";
+  `open $HtmlDir/index.html`
+}





More information about the cfe-commits mailing list