Ted Kremenek | 9cc8c2c | 2008-04-01 20:47:38 +0000 | [diff] [blame] | 1 | #!/usr/bin/env perl |
| 2 | # |
| 3 | # The LLVM Compiler Infrastructure |
| 4 | # |
| 5 | # This file is distributed under the University of Illinois Open Source |
| 6 | # License. See LICENSE.TXT for details. |
| 7 | # |
| 8 | ##===----------------------------------------------------------------------===## |
| 9 | # |
| 10 | # A script designed to wrap a build so that all calls to gcc are intercepted |
| 11 | # and piped to the static analyzer. |
| 12 | # |
| 13 | ##===----------------------------------------------------------------------===## |
| 14 | |
| 15 | use strict; |
| 16 | use warnings; |
| 17 | use File::Temp qw/ :mktemp /; |
Ted Kremenek | 22d6a63 | 2008-04-02 20:43:36 +0000 | [diff] [blame] | 18 | use FindBin qw($RealBin); |
Ted Kremenek | a6e2481 | 2008-04-19 18:05:48 +0000 | [diff] [blame] | 19 | use Digest::MD5; |
Ted Kremenek | 7a4648d | 2008-05-02 22:04:53 +0000 | [diff] [blame] | 20 | use File::Basename; |
Ted Kremenek | 9cc8c2c | 2008-04-01 20:47:38 +0000 | [diff] [blame] | 21 | |
| 22 | my $Verbose = 0; # Verbose output from this script. |
| 23 | my $Prog = "scan-build"; |
Ted Kremenek | f4cdf41 | 2008-05-23 18:17:05 +0000 | [diff] [blame] | 24 | my $BuildName; |
| 25 | my $BuildDate; |
Ted Kremenek | 9cc8c2c | 2008-04-01 20:47:38 +0000 | [diff] [blame] | 26 | |
| 27 | ##----------------------------------------------------------------------------## |
| 28 | # GetHTMLRunDir - Construct an HTML directory name for the current run. |
| 29 | ##----------------------------------------------------------------------------## |
| 30 | |
Sam Bishop | a0e2266 | 2008-04-02 03:35:43 +0000 | [diff] [blame] | 31 | sub GetHTMLRunDir { |
Ted Kremenek | 9cc8c2c | 2008-04-01 20:47:38 +0000 | [diff] [blame] | 32 | |
| 33 | die "Not enough arguments." if (@_ == 0); |
| 34 | |
| 35 | my $Dir = shift @_; |
| 36 | |
| 37 | # Get current date and time. |
| 38 | |
| 39 | my @CurrentTime = localtime(); |
| 40 | |
| 41 | my $year = $CurrentTime[5] + 1900; |
| 42 | my $day = $CurrentTime[3]; |
| 43 | my $month = $CurrentTime[4] + 1; |
| 44 | |
Ted Kremenek | 9d7405f | 2008-05-14 17:23:56 +0000 | [diff] [blame] | 45 | my $DateString = sprintf("%d-%02d-%02d", $year, $month, $day); |
Ted Kremenek | 9cc8c2c | 2008-04-01 20:47:38 +0000 | [diff] [blame] | 46 | |
| 47 | # Determine the run number. |
| 48 | |
| 49 | my $RunNumber; |
| 50 | |
| 51 | if (-d $Dir) { |
| 52 | |
| 53 | if (! -r $Dir) { |
Sam Bishop | a0e2266 | 2008-04-02 03:35:43 +0000 | [diff] [blame] | 54 | die "error: '$Dir' exists but is not readable.\n"; |
Ted Kremenek | 9cc8c2c | 2008-04-01 20:47:38 +0000 | [diff] [blame] | 55 | } |
| 56 | |
| 57 | # Iterate over all files in the specified directory. |
| 58 | |
| 59 | my $max = 0; |
| 60 | |
| 61 | opendir(DIR, $Dir); |
| 62 | my @FILES= readdir(DIR); |
| 63 | closedir(DIR); |
| 64 | |
| 65 | foreach my $f (@FILES) { |
| 66 | |
| 67 | my @x = split/-/, $f; |
| 68 | |
| 69 | next if (scalar(@x) != 4); |
| 70 | next if ($x[0] != $year); |
| 71 | next if ($x[1] != $month); |
| 72 | next if ($x[2] != $day); |
| 73 | |
| 74 | if ($x[3] > $max) { |
| 75 | $max = $x[3]; |
| 76 | } |
| 77 | } |
| 78 | |
| 79 | $RunNumber = $max + 1; |
| 80 | } |
| 81 | else { |
| 82 | |
| 83 | if (-x $Dir) { |
Sam Bishop | a0e2266 | 2008-04-02 03:35:43 +0000 | [diff] [blame] | 84 | die "error: '$Dir' exists but is not a directory.\n"; |
Ted Kremenek | 9cc8c2c | 2008-04-01 20:47:38 +0000 | [diff] [blame] | 85 | } |
| 86 | |
| 87 | # $Dir does not exist. It will be automatically created by the |
| 88 | # clang driver. Set the run number to 1. |
| 89 | |
| 90 | $RunNumber = 1; |
| 91 | } |
| 92 | |
| 93 | die "RunNumber must be defined!" if (!defined($RunNumber)); |
| 94 | |
| 95 | # Append the run number. |
| 96 | |
| 97 | return "$Dir/$DateString-$RunNumber"; |
| 98 | } |
| 99 | |
Sam Bishop | a0e2266 | 2008-04-02 03:35:43 +0000 | [diff] [blame] | 100 | sub SetHtmlEnv { |
Ted Kremenek | 9cc8c2c | 2008-04-01 20:47:38 +0000 | [diff] [blame] | 101 | |
| 102 | die "Wrong number of arguments." if (scalar(@_) != 2); |
| 103 | |
| 104 | my $Args = shift; |
| 105 | my $Dir = shift; |
| 106 | |
| 107 | die "No build command." if (scalar(@$Args) == 0); |
| 108 | |
| 109 | my $Cmd = $$Args[0]; |
| 110 | |
| 111 | if ($Cmd =~ /configure/) { |
| 112 | return; |
| 113 | } |
| 114 | |
| 115 | if ($Verbose) { |
| 116 | print "$Prog: Emitting reports for this run to '$Dir'.\n"; |
| 117 | } |
| 118 | |
| 119 | $ENV{'CCC_ANALYZER_HTML'} = $Dir; |
| 120 | } |
| 121 | |
| 122 | ##----------------------------------------------------------------------------## |
Ted Kremenek | 57cf446 | 2008-04-18 15:09:30 +0000 | [diff] [blame] | 123 | # ComputeDigest - Compute a digest of the specified file. |
| 124 | ##----------------------------------------------------------------------------## |
| 125 | |
| 126 | sub ComputeDigest { |
| 127 | my $FName = shift; |
| 128 | die "Cannot read $FName" if (! -r $FName); |
Ted Kremenek | a6e2481 | 2008-04-19 18:05:48 +0000 | [diff] [blame] | 129 | |
| 130 | # Use Digest::MD5. We don't have to be cryptographically secure. We're |
Ted Kremenek | 7ea02e6 | 2008-04-19 18:07:44 +0000 | [diff] [blame] | 131 | # just looking for duplicate files that come from a non-malicious source. |
| 132 | # We use Digest::MD5 because it is a standard Perl module that should |
Ted Kremenek | a6e2481 | 2008-04-19 18:05:48 +0000 | [diff] [blame] | 133 | # come bundled on most systems. |
| 134 | |
| 135 | open(FILE, $FName) or die "Cannot open $FName."; |
| 136 | binmode FILE; |
| 137 | my $Result = Digest::MD5->new->addfile(*FILE)->hexdigest; |
| 138 | close(FILE); |
| 139 | |
| 140 | # Return the digest. |
| 141 | |
| 142 | return $Result; |
Ted Kremenek | 57cf446 | 2008-04-18 15:09:30 +0000 | [diff] [blame] | 143 | } |
| 144 | |
| 145 | ##----------------------------------------------------------------------------## |
Ted Kremenek | 7a4648d | 2008-05-02 22:04:53 +0000 | [diff] [blame] | 146 | # UpdatePrefix - Compute the common prefix of files. |
| 147 | ##----------------------------------------------------------------------------## |
| 148 | |
| 149 | my $Prefix; |
| 150 | |
| 151 | sub UpdatePrefix { |
| 152 | |
| 153 | my $x = shift; |
| 154 | my $y = basename($x); |
| 155 | $x =~ s/\Q$y\E$//; |
| 156 | |
| 157 | # Ignore /usr, /Library, /System, /Developer |
| 158 | |
| 159 | return if ( $x =~ /^\/usr/ or $x =~ /^\/Library/ |
| 160 | or $x =~ /^\/System/ or $x =~ /^\/Developer/); |
| 161 | |
| 162 | |
| 163 | if (!defined $Prefix) { |
| 164 | $Prefix = $x; |
| 165 | return; |
| 166 | } |
| 167 | |
| 168 | chop $Prefix while (!($x =~ /^$Prefix/)); |
| 169 | } |
| 170 | |
| 171 | sub GetPrefix { |
| 172 | return $Prefix; |
| 173 | } |
| 174 | |
| 175 | ##----------------------------------------------------------------------------## |
| 176 | # UpdateInFilePath - Update the path in the report file. |
| 177 | ##----------------------------------------------------------------------------## |
| 178 | |
| 179 | sub UpdateInFilePath { |
| 180 | my $fname = shift; |
| 181 | my $regex = shift; |
| 182 | my $newtext = shift; |
| 183 | |
| 184 | open (RIN, $fname) or die "cannot open $fname"; |
| 185 | open (ROUT, ">$fname.tmp") or die "cannot open $fname.tmp"; |
| 186 | |
| 187 | while (<RIN>) { |
| 188 | s/$regex/$newtext/; |
| 189 | print ROUT $_; |
| 190 | } |
| 191 | |
| 192 | close (ROUT); |
| 193 | close (RIN); |
| 194 | `mv $fname.tmp $fname`; |
| 195 | } |
| 196 | |
| 197 | ##----------------------------------------------------------------------------## |
Ted Kremenek | 5744dc2 | 2008-04-02 18:03:36 +0000 | [diff] [blame] | 198 | # ScanFile - Scan a report file for various identifying attributes. |
| 199 | ##----------------------------------------------------------------------------## |
| 200 | |
Ted Kremenek | 57cf446 | 2008-04-18 15:09:30 +0000 | [diff] [blame] | 201 | # Sometimes a source file is scanned more than once, and thus produces |
| 202 | # multiple error reports. We use a cache to solve this problem. |
| 203 | |
| 204 | my %AlreadyScanned; |
| 205 | |
Ted Kremenek | 5744dc2 | 2008-04-02 18:03:36 +0000 | [diff] [blame] | 206 | sub ScanFile { |
| 207 | |
| 208 | my $Index = shift; |
| 209 | my $Dir = shift; |
| 210 | my $FName = shift; |
| 211 | |
Ted Kremenek | 57cf446 | 2008-04-18 15:09:30 +0000 | [diff] [blame] | 212 | # Compute a digest for the report file. Determine if we have already |
| 213 | # scanned a file that looks just like it. |
| 214 | |
| 215 | my $digest = ComputeDigest("$Dir/$FName"); |
| 216 | |
| 217 | if (defined($AlreadyScanned{$digest})) { |
| 218 | # Redundant file. Remove it. |
| 219 | `rm -f $Dir/$FName`; |
| 220 | return; |
| 221 | } |
| 222 | |
| 223 | $AlreadyScanned{$digest} = 1; |
| 224 | |
Ted Kremenek | 809709f | 2008-04-18 16:58:34 +0000 | [diff] [blame] | 225 | # At this point the report file is not world readable. Make it happen. |
Ted Kremenek | 684bb09 | 2008-04-18 15:18:20 +0000 | [diff] [blame] | 226 | `chmod 644 $Dir/$FName`; |
| 227 | |
| 228 | # Scan the report file for tags. |
Ted Kremenek | 5744dc2 | 2008-04-02 18:03:36 +0000 | [diff] [blame] | 229 | open(IN, "$Dir/$FName") or die "$Prog: Cannot open '$Dir/$FName'\n"; |
| 230 | |
| 231 | my $BugDesc = ""; |
Ted Kremenek | 22d6a63 | 2008-04-02 20:43:36 +0000 | [diff] [blame] | 232 | my $BugFile = ""; |
| 233 | my $BugPathLength = 1; |
| 234 | my $BugLine = 0; |
Ted Kremenek | 5744dc2 | 2008-04-02 18:03:36 +0000 | [diff] [blame] | 235 | |
| 236 | while (<IN>) { |
| 237 | |
| 238 | if (/<!-- BUGDESC (.*) -->$/) { |
| 239 | $BugDesc = $1; |
Ted Kremenek | 5744dc2 | 2008-04-02 18:03:36 +0000 | [diff] [blame] | 240 | } |
Ted Kremenek | 22d6a63 | 2008-04-02 20:43:36 +0000 | [diff] [blame] | 241 | elsif (/<!-- BUGFILE (.*) -->$/) { |
| 242 | $BugFile = $1; |
Ted Kremenek | 7a4648d | 2008-05-02 22:04:53 +0000 | [diff] [blame] | 243 | UpdatePrefix($BugFile); |
Ted Kremenek | 22d6a63 | 2008-04-02 20:43:36 +0000 | [diff] [blame] | 244 | } |
| 245 | elsif (/<!-- BUGPATHLENGTH (.*) -->$/) { |
| 246 | $BugPathLength = $1; |
| 247 | } |
| 248 | elsif (/<!-- BUGLINE (.*) -->$/) { |
| 249 | $BugLine = $1; |
| 250 | } |
Ted Kremenek | 5744dc2 | 2008-04-02 18:03:36 +0000 | [diff] [blame] | 251 | } |
| 252 | |
| 253 | close(IN); |
| 254 | |
Ted Kremenek | 22d6a63 | 2008-04-02 20:43:36 +0000 | [diff] [blame] | 255 | push @$Index,[ $FName, $BugDesc, $BugFile, $BugLine, $BugPathLength ]; |
| 256 | } |
| 257 | |
| 258 | ##----------------------------------------------------------------------------## |
| 259 | # CopyJS - Copy JavaScript code to target directory. |
| 260 | ##----------------------------------------------------------------------------## |
| 261 | |
| 262 | sub CopyJS { |
| 263 | |
| 264 | my $Dir = shift; |
| 265 | |
| 266 | die "$Prog: Cannot find 'sorttable.js'.\n" |
| 267 | if (! -r "$RealBin/sorttable.js"); |
| 268 | |
| 269 | `cp $RealBin/sorttable.js $Dir`; |
| 270 | |
| 271 | die "$Prog: Could not copy 'sorttable.js' to '$Dir'." |
| 272 | if (! -r "$Dir/sorttable.js"); |
Ted Kremenek | 5744dc2 | 2008-04-02 18:03:36 +0000 | [diff] [blame] | 273 | } |
| 274 | |
| 275 | ##----------------------------------------------------------------------------## |
Ted Kremenek | 9cc8c2c | 2008-04-01 20:47:38 +0000 | [diff] [blame] | 276 | # Postprocess - Postprocess the results of an analysis scan. |
| 277 | ##----------------------------------------------------------------------------## |
| 278 | |
Sam Bishop | a0e2266 | 2008-04-02 03:35:43 +0000 | [diff] [blame] | 279 | sub Postprocess { |
Ted Kremenek | 9cc8c2c | 2008-04-01 20:47:38 +0000 | [diff] [blame] | 280 | |
| 281 | my $Dir = shift; |
Ted Kremenek | 684bb09 | 2008-04-18 15:18:20 +0000 | [diff] [blame] | 282 | my $BaseDir = shift; |
Ted Kremenek | 9cc8c2c | 2008-04-01 20:47:38 +0000 | [diff] [blame] | 283 | |
| 284 | die "No directory specified." if (!defined($Dir)); |
Ted Kremenek | 684bb09 | 2008-04-18 15:18:20 +0000 | [diff] [blame] | 285 | die "No base directory specified." if (!defined($BaseDir)); |
Ted Kremenek | 9cc8c2c | 2008-04-01 20:47:38 +0000 | [diff] [blame] | 286 | |
| 287 | if (! -d $Dir) { |
| 288 | return; |
| 289 | } |
| 290 | |
| 291 | opendir(DIR, $Dir); |
| 292 | my @files = grep(/^report-.*\.html$/,readdir(DIR)); |
| 293 | closedir(DIR); |
| 294 | |
| 295 | if (scalar(@files) == 0) { |
Ted Kremenek | 0249378 | 2008-04-02 07:05:07 +0000 | [diff] [blame] | 296 | print "$Prog: Removing directory '$Dir' because it contains no reports.\n"; |
Ted Kremenek | 9cc8c2c | 2008-04-01 20:47:38 +0000 | [diff] [blame] | 297 | `rm -fR $Dir`; |
| 298 | return; |
| 299 | } |
Ted Kremenek | 5744dc2 | 2008-04-02 18:03:36 +0000 | [diff] [blame] | 300 | |
| 301 | # Scan each report file and build an index. |
| 302 | |
| 303 | my @Index; |
| 304 | |
| 305 | foreach my $file (@files) { ScanFile(\@Index, $Dir, $file); } |
| 306 | |
| 307 | # Generate an index.html file. |
| 308 | |
| 309 | my $FName = "$Dir/index.html"; |
| 310 | |
| 311 | open(OUT, ">$FName") or die "$Prog: Cannot create file '$FName'\n"; |
| 312 | |
Ted Kremenek | 6e6eff7 | 2008-04-15 20:47:02 +0000 | [diff] [blame] | 313 | # Print out the header. |
| 314 | |
Ted Kremenek | 5744dc2 | 2008-04-02 18:03:36 +0000 | [diff] [blame] | 315 | print OUT <<ENDTEXT; |
| 316 | <html> |
| 317 | <head> |
Ted Kremenek | 7f8a325 | 2008-04-02 18:42:49 +0000 | [diff] [blame] | 318 | <style type="text/css"> |
| 319 | body { color:#000000; background-color:#ffffff } |
Ted Kremenek | 22d6a63 | 2008-04-02 20:43:36 +0000 | [diff] [blame] | 320 | body { font-family: Helvetica, sans-serif; font-size:9pt } |
Ted Kremenek | 7f8a325 | 2008-04-02 18:42:49 +0000 | [diff] [blame] | 321 | h1 { font-size:12pt } |
Ted Kremenek | 22d6a63 | 2008-04-02 20:43:36 +0000 | [diff] [blame] | 322 | table.sortable thead { |
| 323 | background-color:#eee; color:#666666; |
| 324 | font-weight: bold; cursor: default; |
Ted Kremenek | bba1cf5 | 2008-04-03 05:50:51 +0000 | [diff] [blame] | 325 | text-align:center; |
| 326 | border-top: 2px solid #000000; |
| 327 | border-bottom: 2px solid #000000; |
| 328 | font-weight: bold; font-family: Verdana |
| 329 | } |
Ted Kremenek | 22d6a63 | 2008-04-02 20:43:36 +0000 | [diff] [blame] | 330 | table.sortable { border: 1px #000000 solid } |
| 331 | table.sortable { border-collapse: collapse; border-spacing: 0px } |
Ted Kremenek | 7f8a325 | 2008-04-02 18:42:49 +0000 | [diff] [blame] | 332 | td { border-bottom: 1px #000000 dotted } |
Ted Kremenek | 22d6a63 | 2008-04-02 20:43:36 +0000 | [diff] [blame] | 333 | td { padding:5px; padding-left:8px; padding-right:8px } |
Ted Kremenek | d8c6d0c | 2008-04-07 23:50:07 +0000 | [diff] [blame] | 334 | td { text-align:left; font-size:9pt } |
Ted Kremenek | 22d6a63 | 2008-04-02 20:43:36 +0000 | [diff] [blame] | 335 | td.View { padding-left: 10px } |
Ted Kremenek | 7f8a325 | 2008-04-02 18:42:49 +0000 | [diff] [blame] | 336 | </style> |
Ted Kremenek | 22d6a63 | 2008-04-02 20:43:36 +0000 | [diff] [blame] | 337 | <script src="sorttable.js"></script> |
Ted Kremenek | 6e6eff7 | 2008-04-15 20:47:02 +0000 | [diff] [blame] | 338 | <script language='javascript' type="text/javascript"> |
| 339 | function SetDisplay(RowClass, DisplayVal) |
| 340 | { |
| 341 | var Rows = document.getElementsByTagName("tr"); |
| 342 | for ( var i = 0 ; i < Rows.length; ++i ) { |
| 343 | if (Rows[i].className == RowClass) { |
| 344 | Rows[i].style.display = DisplayVal; |
| 345 | } |
| 346 | } |
| 347 | } |
| 348 | |
| 349 | function ToggleDisplay(CheckButton, ClassName) { |
Ted Kremenek | 6e6eff7 | 2008-04-15 20:47:02 +0000 | [diff] [blame] | 350 | if (CheckButton.checked) { |
| 351 | SetDisplay(ClassName, ""); |
| 352 | } |
| 353 | else { |
| 354 | SetDisplay(ClassName, "none"); |
| 355 | } |
| 356 | } |
| 357 | </script> |
| 358 | </head> |
| 359 | <body> |
| 360 | ENDTEXT |
| 361 | |
| 362 | # Print out the summary table. |
| 363 | |
| 364 | my %Totals; |
| 365 | |
| 366 | for my $row ( @Index ) { |
| 367 | |
Ted Kremenek | 432af59 | 2008-05-06 18:11:36 +0000 | [diff] [blame] | 368 | #my $bug_type = lc($row->[1]); |
| 369 | my $bug_type = ($row->[1]); |
Ted Kremenek | 6e6eff7 | 2008-04-15 20:47:02 +0000 | [diff] [blame] | 370 | |
| 371 | if (!defined($Totals{$bug_type})) { |
| 372 | $Totals{$bug_type} = 1; |
| 373 | } |
| 374 | else { |
| 375 | $Totals{$bug_type}++; |
| 376 | } |
| 377 | } |
Ted Kremenek | f4cdf41 | 2008-05-23 18:17:05 +0000 | [diff] [blame] | 378 | |
| 379 | print OUT "<h3>Summary</h3>"; |
| 380 | |
| 381 | if (defined($BuildName)) { |
| 382 | print OUT "\n<p>Results in this analysis run are based on analyzer build <b>$BuildName</b>.</p>\n" |
| 383 | } |
| 384 | |
Ted Kremenek | 6e6eff7 | 2008-04-15 20:47:02 +0000 | [diff] [blame] | 385 | print OUT <<ENDTEXT; |
Ted Kremenek | 6e6eff7 | 2008-04-15 20:47:02 +0000 | [diff] [blame] | 386 | <table class="sortable"> |
| 387 | <tr> |
| 388 | <td>Bug Type</td> |
| 389 | <td>Quantity</td> |
| 390 | <td "sorttable_nosort">Display?</td> |
| 391 | </tr> |
| 392 | ENDTEXT |
| 393 | |
| 394 | for my $key ( sort { $a cmp $b } keys %Totals ) { |
Ted Kremenek | bdf66c7 | 2008-05-06 23:51:45 +0000 | [diff] [blame] | 395 | my $x = lc($key); |
| 396 | $x =~ s/\s[,]/_/g; |
Ted Kremenek | 6e6eff7 | 2008-04-15 20:47:02 +0000 | [diff] [blame] | 397 | print OUT "<tr><td>$key</td><td>$Totals{$key}</td><td><input type=\"checkbox\" onClick=\"ToggleDisplay(this,'bt_$x');\" checked/></td></tr>\n"; |
| 398 | } |
| 399 | |
| 400 | # Print out the table of errors. |
| 401 | |
| 402 | print OUT <<ENDTEXT; |
| 403 | </table> |
| 404 | <h3>Reports</h3> |
Ted Kremenek | 22d6a63 | 2008-04-02 20:43:36 +0000 | [diff] [blame] | 405 | <table class="sortable"> |
Ted Kremenek | 7f8a325 | 2008-04-02 18:42:49 +0000 | [diff] [blame] | 406 | <tr> |
Ted Kremenek | bba1cf5 | 2008-04-03 05:50:51 +0000 | [diff] [blame] | 407 | <td>Bug Type</td> |
| 408 | <td>File</td> |
| 409 | <td>Line</td> |
| 410 | <td>Path Length</td> |
| 411 | <td "sorttable_nosort"></td> |
Ted Kremenek | 7f8a325 | 2008-04-02 18:42:49 +0000 | [diff] [blame] | 412 | </tr> |
Ted Kremenek | 5744dc2 | 2008-04-02 18:03:36 +0000 | [diff] [blame] | 413 | ENDTEXT |
Ted Kremenek | 9cc8c2c | 2008-04-01 20:47:38 +0000 | [diff] [blame] | 414 | |
Ted Kremenek | 7a4648d | 2008-05-02 22:04:53 +0000 | [diff] [blame] | 415 | my $prefix = GetPrefix(); |
| 416 | my $regex; |
| 417 | my $InFileRegex; |
| 418 | my $InFilePrefix = "File:</td><td>"; |
| 419 | |
| 420 | if (defined($prefix)) { |
| 421 | $regex = qr/^\Q$prefix\E/is; |
| 422 | $InFileRegex = qr/\Q$InFilePrefix$prefix\E/is; |
| 423 | } |
| 424 | |
Ted Kremenek | 5744dc2 | 2008-04-02 18:03:36 +0000 | [diff] [blame] | 425 | for my $row ( sort { $a->[1] cmp $b->[1] } @Index ) { |
| 426 | |
Ted Kremenek | 6e6eff7 | 2008-04-15 20:47:02 +0000 | [diff] [blame] | 427 | my $x = lc($row->[1]); |
Ted Kremenek | bdf66c7 | 2008-05-06 23:51:45 +0000 | [diff] [blame] | 428 | $x =~ s/\s[,]/_/g; |
Ted Kremenek | 6e6eff7 | 2008-04-15 20:47:02 +0000 | [diff] [blame] | 429 | |
| 430 | print OUT "<tr class=\"bt_$x\">\n"; |
Ted Kremenek | 9cc8c2c | 2008-04-01 20:47:38 +0000 | [diff] [blame] | 431 | |
Ted Kremenek | 5744dc2 | 2008-04-02 18:03:36 +0000 | [diff] [blame] | 432 | my $ReportFile = $row->[0]; |
| 433 | |
Ted Kremenek | 22d6a63 | 2008-04-02 20:43:36 +0000 | [diff] [blame] | 434 | print OUT " <td class=\"DESC\">"; |
Ted Kremenek | 432af59 | 2008-05-06 18:11:36 +0000 | [diff] [blame] | 435 | #print OUT lc($row->[1]); |
| 436 | print OUT $row->[1]; |
Ted Kremenek | 22d6a63 | 2008-04-02 20:43:36 +0000 | [diff] [blame] | 437 | print OUT "</td>\n"; |
Ted Kremenek | 5744dc2 | 2008-04-02 18:03:36 +0000 | [diff] [blame] | 438 | |
Ted Kremenek | 7a4648d | 2008-05-02 22:04:53 +0000 | [diff] [blame] | 439 | # Update the file prefix. |
| 440 | |
| 441 | my $fname = $row->[2]; |
| 442 | if (defined($regex)) { |
| 443 | $fname =~ s/$regex//; |
| 444 | UpdateInFilePath("$Dir/$ReportFile", $InFileRegex, $InFilePrefix) |
| 445 | } |
Ted Kremenek | 3e56e0b | 2008-05-02 23:40:49 +0000 | [diff] [blame] | 446 | |
Ted Kremenek | 7a4648d | 2008-05-02 22:04:53 +0000 | [diff] [blame] | 447 | print OUT "<td>$fname</td>\n"; |
| 448 | |
| 449 | # Print the rest of the columns. |
| 450 | |
| 451 | for my $j ( 3 .. $#{$row} ) { |
Ted Kremenek | 5744dc2 | 2008-04-02 18:03:36 +0000 | [diff] [blame] | 452 | print OUT "<td>$row->[$j]</td>\n" |
| 453 | } |
Ted Kremenek | 7f8a325 | 2008-04-02 18:42:49 +0000 | [diff] [blame] | 454 | |
| 455 | # Emit the "View" link. |
Ted Kremenek | 5744dc2 | 2008-04-02 18:03:36 +0000 | [diff] [blame] | 456 | |
Ted Kremenek | 22d6a63 | 2008-04-02 20:43:36 +0000 | [diff] [blame] | 457 | print OUT " <td class=\"View\"><a href=\"$ReportFile#EndPath\">View</a></td>\n"; |
Ted Kremenek | 7f8a325 | 2008-04-02 18:42:49 +0000 | [diff] [blame] | 458 | |
| 459 | # End the row. |
Ted Kremenek | 5744dc2 | 2008-04-02 18:03:36 +0000 | [diff] [blame] | 460 | print OUT "</tr>\n"; |
| 461 | } |
| 462 | |
| 463 | print OUT "</table>\n</body></html>\n"; |
| 464 | close(OUT); |
Ted Kremenek | 22d6a63 | 2008-04-02 20:43:36 +0000 | [diff] [blame] | 465 | |
Ted Kremenek | 22d6a63 | 2008-04-02 20:43:36 +0000 | [diff] [blame] | 466 | CopyJS($Dir); |
Ted Kremenek | 684bb09 | 2008-04-18 15:18:20 +0000 | [diff] [blame] | 467 | |
| 468 | # Make sure $Dir and $BaseDir is world readable/executable. |
| 469 | `chmod 755 $Dir`; |
| 470 | `chmod 755 $BaseDir`; |
Ted Kremenek | 9cc8c2c | 2008-04-01 20:47:38 +0000 | [diff] [blame] | 471 | } |
| 472 | |
| 473 | ##----------------------------------------------------------------------------## |
Ted Kremenek | dab1110 | 2008-04-02 04:43:42 +0000 | [diff] [blame] | 474 | # RunBuildCommand - Run the build command. |
| 475 | ##----------------------------------------------------------------------------## |
| 476 | |
Ted Kremenek | 6b62898 | 2008-04-30 23:47:12 +0000 | [diff] [blame] | 477 | sub AddIfNotPresent { |
| 478 | my $Args = shift; |
| 479 | my $Arg = shift; |
| 480 | my $found = 0; |
| 481 | |
| 482 | foreach my $k (@$Args) { |
| 483 | if ($k eq $Arg) { |
| 484 | $found = 1; |
| 485 | last; |
| 486 | } |
| 487 | } |
| 488 | |
| 489 | if ($found == 0) { |
| 490 | push @$Args, $Arg; |
| 491 | } |
| 492 | } |
| 493 | |
Ted Kremenek | dab1110 | 2008-04-02 04:43:42 +0000 | [diff] [blame] | 494 | sub RunBuildCommand { |
| 495 | |
| 496 | my $Args = shift; |
Ted Kremenek | 7442ca6 | 2008-04-02 16:04:51 +0000 | [diff] [blame] | 497 | my $IgnoreErrors = shift; |
Ted Kremenek | dab1110 | 2008-04-02 04:43:42 +0000 | [diff] [blame] | 498 | my $Cmd = $Args->[0]; |
| 499 | |
Ted Kremenek | 6a43ba9 | 2008-04-02 15:34:12 +0000 | [diff] [blame] | 500 | if ($Cmd eq "gcc" or $Cmd eq "cc" or $Cmd eq "llvm-gcc") { |
Ted Kremenek | dab1110 | 2008-04-02 04:43:42 +0000 | [diff] [blame] | 501 | shift @$Args; |
| 502 | unshift @$Args, "ccc-analyzer" |
| 503 | } |
Ted Kremenek | 7442ca6 | 2008-04-02 16:04:51 +0000 | [diff] [blame] | 504 | elsif ($IgnoreErrors) { |
| 505 | if ($Cmd eq "make" or $Cmd eq "gmake") { |
Ted Kremenek | 6b62898 | 2008-04-30 23:47:12 +0000 | [diff] [blame] | 506 | AddIfNotPresent($Args,"-k"); |
Ted Kremenek | 8912b54 | 2008-05-13 21:28:02 +0000 | [diff] [blame] | 507 | AddIfNotPresent($Args,"-i"); |
Ted Kremenek | 7442ca6 | 2008-04-02 16:04:51 +0000 | [diff] [blame] | 508 | } |
| 509 | elsif ($Cmd eq "xcodebuild") { |
Ted Kremenek | 6b62898 | 2008-04-30 23:47:12 +0000 | [diff] [blame] | 510 | AddIfNotPresent($Args,"-PBXBuildsContinueAfterErrors=YES"); |
Ted Kremenek | 7442ca6 | 2008-04-02 16:04:51 +0000 | [diff] [blame] | 511 | } |
Ted Kremenek | 6b62898 | 2008-04-30 23:47:12 +0000 | [diff] [blame] | 512 | } |
| 513 | |
Ted Kremenek | 6b62898 | 2008-04-30 23:47:12 +0000 | [diff] [blame] | 514 | if ($Cmd eq "xcodebuild") { |
Ted Kremenek | cfd4c7b | 2008-05-23 22:18:16 +0000 | [diff] [blame] | 515 | # Disable distributed builds for xcodebuild. |
Ted Kremenek | 6b62898 | 2008-04-30 23:47:12 +0000 | [diff] [blame] | 516 | AddIfNotPresent($Args,"-nodistribute"); |
Ted Kremenek | cfd4c7b | 2008-05-23 22:18:16 +0000 | [diff] [blame] | 517 | |
| 518 | # Disable PCH files until clang supports them. |
| 519 | AddIfNotPresent($Args,"GCC_PRECOMPILE_PREFIX_HEADER=NO"); |
Ted Kremenek | 915e972 | 2008-05-27 23:18:07 +0000 | [diff] [blame^] | 520 | |
| 521 | # When 'CC' is set, xcodebuild uses it to do all linking, even if we are |
| 522 | # linking C++ object files. Set 'LDPLUSPLUS' so that xcodebuild uses 'g++' |
| 523 | # when linking such files. |
| 524 | my $LDPLUSPLUS = `which g++`; |
| 525 | $LDPLUSPLUS =~ s/\015?\012//; # strip newlines |
| 526 | $ENV{'LDPLUSPLUS'} = $LDPLUSPLUS; |
Ted Kremenek | 6b62898 | 2008-04-30 23:47:12 +0000 | [diff] [blame] | 527 | } |
Ted Kremenek | dab1110 | 2008-04-02 04:43:42 +0000 | [diff] [blame] | 528 | |
| 529 | system(@$Args); |
| 530 | } |
| 531 | |
Ted Kremenek | dab1110 | 2008-04-02 04:43:42 +0000 | [diff] [blame] | 532 | ##----------------------------------------------------------------------------## |
Ted Kremenek | 9cc8c2c | 2008-04-01 20:47:38 +0000 | [diff] [blame] | 533 | # DisplayHelp - Utility function to display all help options. |
| 534 | ##----------------------------------------------------------------------------## |
| 535 | |
Sam Bishop | a0e2266 | 2008-04-02 03:35:43 +0000 | [diff] [blame] | 536 | sub DisplayHelp { |
Ted Kremenek | 9cc8c2c | 2008-04-01 20:47:38 +0000 | [diff] [blame] | 537 | |
Ted Kremenek | 5744dc2 | 2008-04-02 18:03:36 +0000 | [diff] [blame] | 538 | print <<ENDTEXT; |
Sam Bishop | a0e2266 | 2008-04-02 03:35:43 +0000 | [diff] [blame] | 539 | USAGE: $Prog [options] <build command> [build options] |
Ted Kremenek | 2b74ab6 | 2008-04-01 21:22:03 +0000 | [diff] [blame] | 540 | |
Ted Kremenek | f4cdf41 | 2008-05-23 18:17:05 +0000 | [diff] [blame] | 541 | ENDTEXT |
| 542 | |
| 543 | if (defined($BuildName)) { |
| 544 | print "ANALYZER BUILD: $BuildName ($BuildDate)\n\n"; |
| 545 | } |
| 546 | |
| 547 | print <<ENDTEXT; |
Ted Kremenek | 2b74ab6 | 2008-04-01 21:22:03 +0000 | [diff] [blame] | 548 | OPTIONS: |
| 549 | |
Ted Kremenek | 1262fc4 | 2008-05-14 20:10:33 +0000 | [diff] [blame] | 550 | -a - The analysis to run. The default is 'checker-cfref'. |
| 551 | Valid options are: 'checker-cfref', 'fsyntax-only' |
| 552 | |
Ted Kremenek | 2b74ab6 | 2008-04-01 21:22:03 +0000 | [diff] [blame] | 553 | -o - Target directory for HTML report files. Subdirectories |
Sam Bishop | a0e2266 | 2008-04-02 03:35:43 +0000 | [diff] [blame] | 554 | will be created as needed to represent separate "runs" of |
Ted Kremenek | 2b74ab6 | 2008-04-01 21:22:03 +0000 | [diff] [blame] | 555 | the analyzer. If this option is not specified, a directory |
| 556 | is created in /tmp to store the reports. |
Ted Kremenek | 1262fc4 | 2008-05-14 20:10:33 +0000 | [diff] [blame] | 557 | |
Ted Kremenek | 10f883f | 2008-04-03 07:11:44 +0000 | [diff] [blame] | 558 | -h - Display this message. |
Ted Kremenek | 2b74ab6 | 2008-04-01 21:22:03 +0000 | [diff] [blame] | 559 | --help |
Ted Kremenek | 1262fc4 | 2008-05-14 20:10:33 +0000 | [diff] [blame] | 560 | |
Ted Kremenek | af08f64 | 2008-04-02 16:31:58 +0000 | [diff] [blame] | 561 | -k - Add a "keep on going" option to the specified build command. |
Ted Kremenek | f02e8db | 2008-04-02 16:41:25 +0000 | [diff] [blame] | 562 | --keep-going This option currently supports make and xcodebuild. |
| 563 | This is a convenience option; one can specify this |
| 564 | behavior directly using build options. |
Ted Kremenek | 2b74ab6 | 2008-04-01 21:22:03 +0000 | [diff] [blame] | 565 | |
Ted Kremenek | dab1110 | 2008-04-02 04:43:42 +0000 | [diff] [blame] | 566 | -v - Verbose output from $Prog and the analyzer. |
| 567 | A second "-v" increases verbosity. |
Ted Kremenek | 2b74ab6 | 2008-04-01 21:22:03 +0000 | [diff] [blame] | 568 | |
Ted Kremenek | 7f8a325 | 2008-04-02 18:42:49 +0000 | [diff] [blame] | 569 | -V - View analysis results in a web browser when the build |
| 570 | --view completes. |
| 571 | |
Ted Kremenek | 2b74ab6 | 2008-04-01 21:22:03 +0000 | [diff] [blame] | 572 | BUILD OPTIONS |
| 573 | |
Ted Kremenek | 39eefde | 2008-04-02 16:47:27 +0000 | [diff] [blame] | 574 | You can specify any build option acceptable to the build command. |
| 575 | |
Ted Kremenek | 5744dc2 | 2008-04-02 18:03:36 +0000 | [diff] [blame] | 576 | EXAMPLE |
Ted Kremenek | 2b74ab6 | 2008-04-01 21:22:03 +0000 | [diff] [blame] | 577 | |
Ted Kremenek | 5744dc2 | 2008-04-02 18:03:36 +0000 | [diff] [blame] | 578 | $Prog -o /tmp/myhtmldir make -j4 |
Ted Kremenek | 2b74ab6 | 2008-04-01 21:22:03 +0000 | [diff] [blame] | 579 | |
Ted Kremenek | 39eefde | 2008-04-02 16:47:27 +0000 | [diff] [blame] | 580 | The above example causes analysis reports to be deposited into |
| 581 | a subdirectory of "/tmp/myhtmldir" and to run "make" with the "-j4" option. |
| 582 | A different subdirectory is created each time $Prog analyzes a project. |
| 583 | The analyzer should support most parallel builds, but not distributed builds. |
Ted Kremenek | 2b74ab6 | 2008-04-01 21:22:03 +0000 | [diff] [blame] | 584 | |
| 585 | ENDTEXT |
Ted Kremenek | 9cc8c2c | 2008-04-01 20:47:38 +0000 | [diff] [blame] | 586 | } |
| 587 | |
| 588 | ##----------------------------------------------------------------------------## |
| 589 | # Process command-line arguments. |
| 590 | ##----------------------------------------------------------------------------## |
| 591 | |
| 592 | my $HtmlDir; # Parent directory to store HTML files. |
| 593 | my $IgnoreErrors = 0; # Ignore build errors. |
Ted Kremenek | 7f8a325 | 2008-04-02 18:42:49 +0000 | [diff] [blame] | 594 | my $ViewResults = 0; # View results when the build terminates. |
Ted Kremenek | 1262fc4 | 2008-05-14 20:10:33 +0000 | [diff] [blame] | 595 | my $Analysis = "checker-cfref"; |
Ted Kremenek | 9cc8c2c | 2008-04-01 20:47:38 +0000 | [diff] [blame] | 596 | |
| 597 | if (!@ARGV) { |
| 598 | DisplayHelp(); |
Sam Bishop | a0e2266 | 2008-04-02 03:35:43 +0000 | [diff] [blame] | 599 | exit 1; |
Ted Kremenek | 9cc8c2c | 2008-04-01 20:47:38 +0000 | [diff] [blame] | 600 | } |
| 601 | |
| 602 | while (@ARGV) { |
| 603 | |
| 604 | # Scan for options we recognize. |
| 605 | |
| 606 | my $arg = $ARGV[0]; |
| 607 | |
Sam Bishop | 2f2418e | 2008-04-03 14:29:47 +0000 | [diff] [blame] | 608 | if ($arg eq "-h" or $arg eq "--help") { |
Ted Kremenek | 9cc8c2c | 2008-04-01 20:47:38 +0000 | [diff] [blame] | 609 | DisplayHelp(); |
Sam Bishop | a0e2266 | 2008-04-02 03:35:43 +0000 | [diff] [blame] | 610 | exit 0; |
Ted Kremenek | 9cc8c2c | 2008-04-01 20:47:38 +0000 | [diff] [blame] | 611 | } |
| 612 | |
Ted Kremenek | 1262fc4 | 2008-05-14 20:10:33 +0000 | [diff] [blame] | 613 | if ($arg eq "-a") { |
| 614 | shift @ARGV; |
| 615 | |
| 616 | if (!@ARGV) { |
| 617 | die "$Prog: '-a' option requires an analysis type.\n"; |
| 618 | } |
| 619 | |
| 620 | $Analysis = shift @ARGV; |
| 621 | |
| 622 | if (!($Analysis eq "checker-cfref" or $Analysis eq "fsyntax-only")) { |
| 623 | die "$Prog: Invalid argument '$Analysis' to -a.\n"; |
| 624 | } |
| 625 | |
| 626 | next; |
| 627 | } |
| 628 | |
Ted Kremenek | 9cc8c2c | 2008-04-01 20:47:38 +0000 | [diff] [blame] | 629 | if ($arg eq "-o") { |
| 630 | shift @ARGV; |
| 631 | |
| 632 | if (!@ARGV) { |
Ted Kremenek | 0062ad4 | 2008-04-02 16:35:01 +0000 | [diff] [blame] | 633 | die "$Prog: '-o' option requires a target directory name.\n"; |
Ted Kremenek | 9cc8c2c | 2008-04-01 20:47:38 +0000 | [diff] [blame] | 634 | } |
| 635 | |
| 636 | $HtmlDir = shift @ARGV; |
| 637 | next; |
| 638 | } |
| 639 | |
Ted Kremenek | 2b74ab6 | 2008-04-01 21:22:03 +0000 | [diff] [blame] | 640 | if ($arg eq "-k" or $arg eq "--keep-going") { |
Ted Kremenek | 9cc8c2c | 2008-04-01 20:47:38 +0000 | [diff] [blame] | 641 | shift @ARGV; |
| 642 | $IgnoreErrors = 1; |
| 643 | next; |
| 644 | } |
| 645 | |
| 646 | if ($arg eq "-v") { |
| 647 | shift @ARGV; |
| 648 | $Verbose++; |
| 649 | next; |
| 650 | } |
| 651 | |
Ted Kremenek | 7f8a325 | 2008-04-02 18:42:49 +0000 | [diff] [blame] | 652 | if ($arg eq "-V" or $arg eq "--view") { |
| 653 | shift @ARGV; |
| 654 | $ViewResults = 1; |
| 655 | next; |
| 656 | } |
| 657 | |
Ted Kremenek | 0062ad4 | 2008-04-02 16:35:01 +0000 | [diff] [blame] | 658 | die "$Prog: unrecognized option '$arg'\n" if ($arg =~ /^-/); |
| 659 | |
Ted Kremenek | 9cc8c2c | 2008-04-01 20:47:38 +0000 | [diff] [blame] | 660 | last; |
| 661 | } |
| 662 | |
| 663 | if (!@ARGV) { |
| 664 | print STDERR "$Prog: No build command specified.\n\n"; |
| 665 | DisplayHelp(); |
Sam Bishop | a0e2266 | 2008-04-02 03:35:43 +0000 | [diff] [blame] | 666 | exit 1; |
Ted Kremenek | 9cc8c2c | 2008-04-01 20:47:38 +0000 | [diff] [blame] | 667 | } |
| 668 | |
| 669 | # Determine the output directory for the HTML reports. |
| 670 | |
| 671 | if (!defined($HtmlDir)) { |
| 672 | |
Sam Bishop | a0e2266 | 2008-04-02 03:35:43 +0000 | [diff] [blame] | 673 | $HtmlDir = mkdtemp("/tmp/$Prog-XXXXXX"); |
Ted Kremenek | 9cc8c2c | 2008-04-01 20:47:38 +0000 | [diff] [blame] | 674 | |
| 675 | if (!defined($HtmlDir)) { |
Sam Bishop | a0e2266 | 2008-04-02 03:35:43 +0000 | [diff] [blame] | 676 | die "error: Cannot create HTML directory in /tmp.\n"; |
Ted Kremenek | 9cc8c2c | 2008-04-01 20:47:38 +0000 | [diff] [blame] | 677 | } |
| 678 | |
| 679 | if (!$Verbose) { |
| 680 | print "$Prog: Using '$HtmlDir' as base HTML report directory.\n"; |
| 681 | } |
| 682 | } |
| 683 | |
Ted Kremenek | 684bb09 | 2008-04-18 15:18:20 +0000 | [diff] [blame] | 684 | my $BaseDir = $HtmlDir; |
Sam Bishop | a0e2266 | 2008-04-02 03:35:43 +0000 | [diff] [blame] | 685 | $HtmlDir = GetHTMLRunDir($HtmlDir); |
Ted Kremenek | 9cc8c2c | 2008-04-01 20:47:38 +0000 | [diff] [blame] | 686 | |
| 687 | # Set the appropriate environment variables. |
| 688 | |
Sam Bishop | a0e2266 | 2008-04-02 03:35:43 +0000 | [diff] [blame] | 689 | SetHtmlEnv(\@ARGV, $HtmlDir); |
Ted Kremenek | 9cc8c2c | 2008-04-01 20:47:38 +0000 | [diff] [blame] | 690 | |
Ted Kremenek | 0b6c153 | 2008-04-08 20:22:12 +0000 | [diff] [blame] | 691 | my $Cmd = "$RealBin/ccc-analyzer"; |
| 692 | |
| 693 | die "$Prog: Executable 'ccc-analyzer' does not exist at '$Cmd'\n" |
| 694 | if (! -x $Cmd); |
Ted Kremenek | f22eacb | 2008-04-18 22:00:56 +0000 | [diff] [blame] | 695 | |
| 696 | my $Clang = "$RealBin/clang"; |
| 697 | |
| 698 | if (! -x $Clang) { |
| 699 | print "$Prog: 'clang' executable not found in '$RealBin'. Using 'clang' from path.\n"; |
| 700 | $Clang = "clang"; |
| 701 | } |
Ted Kremenek | 0b6c153 | 2008-04-08 20:22:12 +0000 | [diff] [blame] | 702 | |
Ted Kremenek | 4f4b17d | 2008-04-03 20:08:18 +0000 | [diff] [blame] | 703 | $ENV{'CC'} = $Cmd; |
Ted Kremenek | f22eacb | 2008-04-18 22:00:56 +0000 | [diff] [blame] | 704 | $ENV{'CLANG'} = $Clang; |
Ted Kremenek | 9cc8c2c | 2008-04-01 20:47:38 +0000 | [diff] [blame] | 705 | |
| 706 | if ($Verbose >= 2) { |
| 707 | $ENV{'CCC_ANALYZER_VERBOSE'} = 1; |
| 708 | } |
| 709 | |
Ted Kremenek | a9525c9 | 2008-05-12 22:07:14 +0000 | [diff] [blame] | 710 | if ($Verbose >= 3) { |
| 711 | $ENV{'CCC_ANALYZER_LOG'} = 1; |
| 712 | } |
| 713 | |
Ted Kremenek | 1262fc4 | 2008-05-14 20:10:33 +0000 | [diff] [blame] | 714 | $ENV{'CCC_ANALYZER_ANALYSIS'} = $Analysis; |
| 715 | |
Ted Kremenek | 9cc8c2c | 2008-04-01 20:47:38 +0000 | [diff] [blame] | 716 | # Run the build. |
| 717 | |
Ted Kremenek | 7442ca6 | 2008-04-02 16:04:51 +0000 | [diff] [blame] | 718 | RunBuildCommand(\@ARGV, $IgnoreErrors); |
Ted Kremenek | 9cc8c2c | 2008-04-01 20:47:38 +0000 | [diff] [blame] | 719 | |
| 720 | # Postprocess the HTML directory. |
| 721 | |
Ted Kremenek | 684bb09 | 2008-04-18 15:18:20 +0000 | [diff] [blame] | 722 | Postprocess($HtmlDir, $BaseDir); |
Ted Kremenek | 7f8a325 | 2008-04-02 18:42:49 +0000 | [diff] [blame] | 723 | |
| 724 | if ($ViewResults and -r "$HtmlDir/index.html") { |
| 725 | # Only works on Mac OS X (for now). |
| 726 | print "Viewing analysis results: '$HtmlDir/index.html'\n"; |
| 727 | `open $HtmlDir/index.html` |
| 728 | } |