From: Anna Zaks Date: Mon, 7 Nov 2011 22:38:10 +0000 (+0000) Subject: [analyzer] Make sure scan-build catches all clang failures. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1a8a8cbea639d0519f06285e12f64904d1158305;p=clang [analyzer] Make sure scan-build catches all clang failures. 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 --- diff --git a/tools/scan-build/ccc-analyzer b/tools/scan-build/ccc-analyzer index c39e417951..fa2bff091c 100755 --- a/tools/scan-build/ccc-analyzer +++ b/tools/scan-build/ccc-analyzer @@ -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 {