]> granicus.if.org Git - clang/commitdiff
[analyzer] Make sure scan-build catches all clang failures.
authorAnna Zaks <ganna@apple.com>
Mon, 7 Nov 2011 22:38:10 +0000 (22:38 +0000)
committerAnna Zaks <ganna@apple.com>
Mon, 7 Nov 2011 22:38:10 +0000 (22:38 +0000)
scan-build ignores clang failures in some cases, which might lead to
silent failure suppression. For example, if clang command line
argument is wrong. (Addresses radar://10406598)

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

tools/scan-build/ccc-analyzer

index c39e4179514e6338e743abfcf6e5513ddf3aac79..fa2bff091ceee2cca0770b82a2dc73c164236860 100755 (executable)
@@ -78,8 +78,8 @@ sub GetPPExt {
 # Set this to 1 if we want to include 'parser rejects' files.
 my $IncludeParserRejects = 0;
 my $ParserRejects = "Parser Rejects";
-
 my $AttributeIgnored = "Attribute Ignored";
+my $OtherError = "Other Error";
 
 sub ProcessClangFailure {
   my ($Clang, $Lang, $file, $Args, $HtmlDir, $ErrorType, $ofile) = @_;
@@ -93,6 +93,9 @@ sub ProcessClangFailure {
   elsif ($ErrorType eq $AttributeIgnored) {
     $prefix = "clang_attribute_ignored";
   }
+  elsif ($ErrorType eq $OtherError) {
+    $prefix = "clang_other_error";
+  }
 
   # Generate the preprocessed file with Clang.
   my ($PPH, $PPFile) = tempfile( $prefix . "_XXXXXX",
@@ -259,6 +262,9 @@ sub Analyze {
       if ($IncludeParserRejects && !($file =~/conftest/)) {
         ProcessClangFailure($Clang, $Lang, $file, \@CmdArgsSansAnalyses,
                             $HtmlDir, $ParserRejects, $ofile);
+      } else {
+        ProcessClangFailure($Clang, $Lang, $file, \@CmdArgsSansAnalyses,
+                            $HtmlDir, $OtherError, $ofile);            
       }
     }
     else {