[cfe-commits] r56601 - /cfe/trunk/utils/ccc-analyzer

Ted Kremenek kremenek at apple.com
Wed Sep 24 17:51:44 PDT 2008


Author: kremenek
Date: Wed Sep 24 19:51:44 2008
New Revision: 56601

URL: http://llvm.org/viewvc/llvm-project?rev=56601&view=rev
Log:
Include clang preprocessed sources as well with "crashes" output.

Modified:
    cfe/trunk/utils/ccc-analyzer

Modified: cfe/trunk/utils/ccc-analyzer
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/ccc-analyzer?rev=56601&r1=56600&r2=56601&view=diff

==============================================================================
--- cfe/trunk/utils/ccc-analyzer (original)
+++ cfe/trunk/utils/ccc-analyzer Wed Sep 24 19:51:44 2008
@@ -32,15 +32,24 @@
 }
 
 sub ProcessClangFailure {
-  my ($Lang, $file, $Args, $HtmlDir, $ErrorType, $ofile) = @_;
+  my ($Clang, $Lang, $file, $Args, $HtmlDir, $ErrorType, $ofile) = @_;
   my $Dir = "$HtmlDir/crashes";
   mkpath $Dir;
+
+  # Generate the preprocessed file with cc (i.e., gcc).
   my ($PPH, $PPFile) = tempfile("clang_crash_XXXXXX",
                                   SUFFIX => GetPPExt($Lang),
                                   DIR => $Dir);
 
   system $CC, @$Args, "-E", "-o", $PPFile;
   close ($PPH);
+
+  # Generate the preprocessed file with clang.
+  my $PPFile_Clang = $PPFile;
+  $PPFile_Clang =~ s/[.](.+)$/.clang.$1/;  
+  system $Clang, @$Args, "-E", "-o", "$PPFile_Clang";
+  
+  # Create the info file.
   open (OUT, ">", "$PPFile.info.txt") or die "Cannot open $PPFile.info.txt\n";
   print OUT abs_path($file), "\n";
   print OUT "$ErrorType\n";
@@ -139,11 +148,11 @@
 
   # Did the command die because of a signal?
   if ($Result & 127 and $Cmd eq $Clang and defined $HtmlDir) {
-    ProcessClangFailure($Lang, $file, \@CmdArgsSansAnalyses, $HtmlDir,
+    ProcessClangFailure($Clang, $Lang, $file, \@CmdArgsSansAnalyses, $HtmlDir,
                         "Crash", $ofile);
   }
   elsif ($Result) {
-    ProcessClangFailure($Lang, $file, \@CmdArgsSansAnalyses, $HtmlDir,
+    ProcessClangFailure($Clang, $Lang, $file, \@CmdArgsSansAnalyses, $HtmlDir,
                         "Parser Rejects", $ofile);
   }
   





More information about the cfe-commits mailing list