sylvestre.ledru created this revision. sylvestre.ledru added reviewers: zaks.anna, rizsotto.mailinglist. sylvestre.ledru added a subscriber: cfe-commits.
This patch adds an option //--show-description// to add the defect description to the list of defect. This helps to get a better understanding of the defect without opening the page. For example, this is used for Firefox: https://people.mozilla.org/~sledru/reports/fx-scan-build/ https://reviews.llvm.org/D22810 Files: tools/scan-build/bin/scan-build Index: tools/scan-build/bin/scan-build =================================================================== --- tools/scan-build/bin/scan-build +++ tools/scan-build/bin/scan-build @@ -53,6 +53,7 @@ IgnoreErrors => 0, # Ignore build errors. ViewResults => 0, # View results when the build terminates. ExitStatusFoundBugs => 0, # Exit status reflects whether bugs were found + ShowDescription => 0, # Display the description of the defect in the list KeepEmpty => 0, # Don't remove output directory even with 0 results. EnableCheckers => {}, DisableCheckers => {}, @@ -453,6 +454,10 @@ push @$Index,[ $FName, $BugCategory, $BugType, $BugFile, $BugFunction, $BugLine, $BugPathLength ]; + + if ($Options{ShowDescription}) { + push @{ $Index->[-1] }, $BugDescription + } } ##----------------------------------------------------------------------------## @@ -746,6 +751,15 @@ <td>Function/Method</td> <td class="Q">Line</td> <td class="Q">Path Length</td> +ENDTEXT + +if ($Options{ShowDescription}) { +print OUT <<ENDTEXT; + <td class="Q">Description</td> +ENDTEXT +} + +print OUT <<ENDTEXT; <td class="sorttable_nosort"></td> <!-- REPORTBUGCOL --> </tr></thead> @@ -771,10 +785,10 @@ print OUT "<tr class=\"bt_$x\">"; print OUT "<td class=\"DESC\">"; - print OUT $row->[1]; + print OUT $row->[1]; # $BugCategory print OUT "</td>"; print OUT "<td class=\"DESC\">"; - print OUT $row->[2]; + print OUT $row->[2]; # $BugType print OUT "</td>"; # Update the file prefix. @@ -802,11 +816,11 @@ print OUT "</td>"; print OUT "<td class=\"DESC\">"; - print OUT $row->[4]; + print OUT $row->[4]; # Function print OUT "</td>"; # Print out the quantities. - for my $j ( 5 .. 6 ) { + for my $j ( 5 .. 6 ) { # Line & Path length print OUT "<td class=\"Q\">$row->[$j]</td>"; } @@ -1150,6 +1164,10 @@ Specify the title used on generated HTML pages. If not specified, a default title will be used. + --show-description + + Display the description of defects in the list + -plist By default the output of scan-build is a set of HTML files. This option @@ -1586,6 +1604,12 @@ next; } + if ($arg eq "--show-description") { + shift @$Args; + $Options{ShowDescription} = 1; + next; + } + if ($arg eq "-store") { shift @$Args; $Options{StoreModel} = shift @$Args;
Index: tools/scan-build/bin/scan-build =================================================================== --- tools/scan-build/bin/scan-build +++ tools/scan-build/bin/scan-build @@ -53,6 +53,7 @@ IgnoreErrors => 0, # Ignore build errors. ViewResults => 0, # View results when the build terminates. ExitStatusFoundBugs => 0, # Exit status reflects whether bugs were found + ShowDescription => 0, # Display the description of the defect in the list KeepEmpty => 0, # Don't remove output directory even with 0 results. EnableCheckers => {}, DisableCheckers => {}, @@ -453,6 +454,10 @@ push @$Index,[ $FName, $BugCategory, $BugType, $BugFile, $BugFunction, $BugLine, $BugPathLength ]; + + if ($Options{ShowDescription}) { + push @{ $Index->[-1] }, $BugDescription + } } ##----------------------------------------------------------------------------## @@ -746,6 +751,15 @@ <td>Function/Method</td> <td class="Q">Line</td> <td class="Q">Path Length</td> +ENDTEXT + +if ($Options{ShowDescription}) { +print OUT <<ENDTEXT; + <td class="Q">Description</td> +ENDTEXT +} + +print OUT <<ENDTEXT; <td class="sorttable_nosort"></td> <!-- REPORTBUGCOL --> </tr></thead> @@ -771,10 +785,10 @@ print OUT "<tr class=\"bt_$x\">"; print OUT "<td class=\"DESC\">"; - print OUT $row->[1]; + print OUT $row->[1]; # $BugCategory print OUT "</td>"; print OUT "<td class=\"DESC\">"; - print OUT $row->[2]; + print OUT $row->[2]; # $BugType print OUT "</td>"; # Update the file prefix. @@ -802,11 +816,11 @@ print OUT "</td>"; print OUT "<td class=\"DESC\">"; - print OUT $row->[4]; + print OUT $row->[4]; # Function print OUT "</td>"; # Print out the quantities. - for my $j ( 5 .. 6 ) { + for my $j ( 5 .. 6 ) { # Line & Path length print OUT "<td class=\"Q\">$row->[$j]</td>"; } @@ -1150,6 +1164,10 @@ Specify the title used on generated HTML pages. If not specified, a default title will be used. + --show-description + + Display the description of defects in the list + -plist By default the output of scan-build is a set of HTML files. This option @@ -1586,6 +1604,12 @@ next; } + if ($arg eq "--show-description") { + shift @$Args; + $Options{ShowDescription} = 1; + next; + } + if ($arg eq "-store") { shift @$Args; $Options{StoreModel} = shift @$Args;
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits