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

Ted Kremenek kremenek at apple.com
Tue Apr 15 13:47:02 PDT 2008


Author: kremenek
Date: Tue Apr 15 15:47:02 2008
New Revision: 49738

URL: http://llvm.org/viewvc/llvm-project?rev=49738&view=rev
Log:
Added "summary table" to generated index.html page that allows one to
toggle which bug reports are displayed in the report table.

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=49738&r1=49737&r2=49738&view=diff

==============================================================================
--- cfe/trunk/utils/scan-build (original)
+++ cfe/trunk/utils/scan-build Tue Apr 15 15:47:02 2008
@@ -206,6 +206,8 @@
   
   open(OUT, ">$FName") or die "$Prog: Cannot create file '$FName'\n";
   
+  # Print out the header.
+  
 print OUT <<ENDTEXT;
 <html>
 <head>
@@ -229,7 +231,68 @@
  td.View   { padding-left: 10px }
 </style>
 <script src="sorttable.js"></script>
-</head>\n<body>
+<script language='javascript' type="text/javascript">
+function SetDisplay(RowClass, DisplayVal)
+{
+  var Rows = document.getElementsByTagName("tr");
+  for ( var i = 0 ; i < Rows.length; ++i ) {
+    if (Rows[i].className == RowClass) {
+      Rows[i].style.display = DisplayVal;
+    }
+  }
+}
+  
+function ToggleDisplay(CheckButton, ClassName) {
+  window.console.log("writing");
+  if (CheckButton.checked) {
+    SetDisplay(ClassName, "");
+  }
+  else {
+    SetDisplay(ClassName, "none");
+  }
+}
+</script>
+</head>
+<body>
+ENDTEXT
+
+  # Print out the summary table.
+  
+  my %Totals;
+  
+  for my $row ( @Index ) {
+    
+    my $bug_type = lc($row->[1]);
+    
+    if (!defined($Totals{$bug_type})) {
+      $Totals{$bug_type} = 1;
+    }
+    else {
+      $Totals{$bug_type}++;
+    }
+  }
+
+print OUT <<ENDTEXT;
+<h3>Summary</h3>
+<table class="sortable">
+<tr>
+  <td>Bug Type</td>
+  <td>Quantity</td>
+  <td "sorttable_nosort">Display?</td>
+</tr>
+ENDTEXT
+  
+  for my $key ( sort { $a cmp $b } keys %Totals ) {
+    my $x = $key;
+    $x =~ s/\s/_/g;    
+    print OUT "<tr><td>$key</td><td>$Totals{$key}</td><td><input type=\"checkbox\" onClick=\"ToggleDisplay(this,'bt_$x');\" checked/></td></tr>\n";
+  }
+
+  # Print out the table of errors.
+
+print OUT <<ENDTEXT;
+</table>
+<h3>Reports</h3>
 <table class="sortable">
 <tr>
   <td>Bug Type</td>
@@ -242,7 +305,10 @@
 
   for my $row ( sort { $a->[1] cmp $b->[1] } @Index ) {
     
-    print OUT "<tr>\n";
+    my $x = lc($row->[1]);
+    $x =~ s/\s/_/g;    
+    
+    print OUT "<tr class=\"bt_$x\">\n";
 
     my $ReportFile = $row->[0];
 





More information about the cfe-commits mailing list