scan-build/ccc-analyzer now also report clang parser failures.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54931 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Ted Kremenek 2008-08-18 18:38:29 +00:00
Родитель 77e8b53fe3
Коммит 5d31f83bbe
2 изменённых файлов: 19 добавлений и 10 удалений

Просмотреть файл

@ -28,18 +28,19 @@ sub GetPPExt {
return ".i";
}
sub ProcessClangCrash {
my ($Clang, $Lang, $file, $Args, $HtmlDir) = @_;
sub ProcessClangFailure {
my ($Lang, $file, $Args, $HtmlDir, $ErrorType) = @_;
my $Dir = "$HtmlDir/crashes";
mkpath $Dir;
my ($PPH, $PPFile) = tempfile("clang_crash_XXXXXX",
SUFFIX => GetPPExt($Lang),
DIR => $Dir);
system $Clang, @$Args, "-E", "-o", $PPFile;
system "gcc", @$Args, "-E", "-o", $PPFile;
close ($PPH);
open (OUT, ">", "$PPFile.info") or die "Cannot open $PPFile.info\n";
print OUT "$file";
print OUT "$file\n";
print OUT "$ErrorType\n";
close OUT;
}
@ -52,7 +53,7 @@ sub Analyze {
# Skip anything related to C++.
return if ($Lang =~ /c[+][+]/);
my $RunAnalyzer = 0;
my $Cmd;
my @CmdArgs;
@ -105,7 +106,12 @@ sub Analyze {
# Did the command die because of a signal?
if ($? & 127 and $Cmd eq $Clang and defined $HtmlDir) {
ProcessClangCrash($Clang, $Lang, $file, \@CmdArgsSansAnalyses, $HtmlDir);
ProcessClangFailure($Lang, $file, \@CmdArgsSansAnalyses, $HtmlDir,
"Crash");
}
elsif ($?) {
ProcessClangFailure($Lang, $file, \@CmdArgsSansAnalyses, $HtmlDir,
"Parser Rejects");
}
}

Просмотреть файл

@ -567,12 +567,12 @@ ENDTEXT
if (scalar(@files)) {
print OUT <<ENDTEXT;
<h3>Analyzer Crashes</h3>
<h3>Analyzer Failures</h3>
<p>The analyzer crashed while processing the following files:</p>
<p>The analyzer had problems processing the following files:</p>
<table>
<thead><tr><td>Source File</td><td>Preprocessed File</td></tr></thead>
<thead><tr><td>Problem</td><td>Source File</td><td>Preprocessed File</td></tr></thead>
ENDTEXT
foreach my $file (sort @files) {
@ -583,9 +583,12 @@ ENDTEXT
open (INFO, "$Dir/crashes/$file") or
die "Cannot open $Dir/crashes/$file\n";
my $srcfile = <INFO>;
chomp $srcfile;
my $problem = <INFO>;
chomp $problem;
close (INFO);
# Print the information in the table.
print OUT "<tr><td>$srcfile</td><td class=\"View\"><a href=\"crashes/$ppfile\">View</a></td></tr>\n";
print OUT "<tr><td>$problem</td><td>$srcfile</td><td class=\"View\"><a href=\"crashes/$ppfile\">View</a></td></tr>\n";
}
print OUT <<ENDTEXT;