[cfe-commits] r77644 - in /cfe/trunk/utils: ccc-analyzer scan-build

Ted Kremenek kremenek at apple.com
Thu Jul 30 16:55:19 PDT 2009


Author: kremenek
Date: Thu Jul 30 18:55:19 2009
New Revision: 77644

URL: http://llvm.org/viewvc/llvm-project?rev=77644&view=rev
Log:
Add scan-build option '-no-failure-reports' to supress the creation of a 'failures' subdirectory that includes crash reports, preprocessed files, etc.

Modified:
    cfe/trunk/utils/ccc-analyzer
    cfe/trunk/utils/scan-build

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

==============================================================================
--- cfe/trunk/utils/ccc-analyzer (original)
+++ cfe/trunk/utils/ccc-analyzer Thu Jul 30 18:55:19 2009
@@ -22,6 +22,10 @@
 
 my $CC = $ENV{'CCC_CC'};
 if (!defined $CC) { $CC = "gcc"; }
+
+my $ReportFailures = $ENV{'CCC_REPORT_FAILURES'};
+if (!defined $ReportFailures) { $ReportFailures = 1; }
+
 my $CleanupFile;
 my $ResultFile;
 
@@ -225,55 +229,57 @@
   my $Result = $?;
 
   # Did the command die because of a signal?
-  if ($Result & 127 and $Cmd eq $ClangCC and defined $HtmlDir) {
-    ProcessClangFailure($ClangCC, $Lang, $file, \@CmdArgsSansAnalyses, $HtmlDir,
-                        "Crash", $ofile);
-  }
-  elsif ($Result) {
-    if ($IncludeParserRejects && !($file =~/conftest/)) {
-      ProcessClangFailure($ClangCC, $Lang, $file, \@CmdArgsSansAnalyses, $HtmlDir,
-                          $ParserRejects, $ofile);
+  if ($ReportFailures) {
+    if ($Result & 127 and $Cmd eq $ClangCC and defined $HtmlDir) {
+      ProcessClangFailure($ClangCC, $Lang, $file, \@CmdArgsSansAnalyses,
+                          $HtmlDir, "Crash", $ofile);
+    }
+    elsif ($Result) {
+      if ($IncludeParserRejects && !($file =~/conftest/)) {
+        ProcessClangFailure($ClangCC, $Lang, $file, \@CmdArgsSansAnalyses,
+                            $HtmlDir, $ParserRejects, $ofile);
+      }
     }
-  }
-  else {
-    # Check if there were any unhandled attributes.
-    if (open(CHILD, $ofile)) {
-      my %attributes_not_handled;
+    else {
+      # Check if there were any unhandled attributes.
+      if (open(CHILD, $ofile)) {
+        my %attributes_not_handled;
       
-      # Don't flag warnings about the following attributes that we
-      # know are currently not supported by Clang.
-      $attributes_not_handled{"cdecl"} = 1;
+        # Don't flag warnings about the following attributes that we
+        # know are currently not supported by Clang.
+        $attributes_not_handled{"cdecl"} = 1;
       
-      my $ppfile;
-      while (<CHILD>) {
-        next if (! /warning: '([^\']+)' attribute ignored/);
-
-        # Have we already spotted this unhandled attribute?
-        next if (defined $attributes_not_handled{$1});
-        $attributes_not_handled{$1} = 1;
+        my $ppfile;
+        while (<CHILD>) {
+          next if (! /warning: '([^\']+)' attribute ignored/);
+
+          # Have we already spotted this unhandled attribute?
+          next if (defined $attributes_not_handled{$1});
+          $attributes_not_handled{$1} = 1;
         
-        # Get the name of the attribute file.
-        my $dir = "$HtmlDir/failures";
-        my $afile = "$dir/attribute_ignored_$1.txt";
+          # Get the name of the attribute file.
+          my $dir = "$HtmlDir/failures";
+          my $afile = "$dir/attribute_ignored_$1.txt";
         
-        # Only create another preprocessed file if the attribute file
-        # doesn't exist yet.
-        next if (-e $afile);
+          # Only create another preprocessed file if the attribute file
+          # doesn't exist yet.
+          next if (-e $afile);
         
-        # Add this file to the list of files that contained this attribute.
-        # Generate a preprocessed file if we haven't already.
-        if (!(defined $ppfile)) {
-          $ppfile = ProcessClangFailure($ClangCC, $Lang, $file,
-                                        \@CmdArgsSansAnalyses,
-                                        $HtmlDir, $AttributeIgnored, $ofile);
+          # Add this file to the list of files that contained this attribute.
+          # Generate a preprocessed file if we haven't already.
+          if (!(defined $ppfile)) {
+            $ppfile = ProcessClangFailure($ClangCC, $Lang, $file,
+                                          \@CmdArgsSansAnalyses,
+                                          $HtmlDir, $AttributeIgnored, $ofile);
+          }
+
+          mkpath $dir;
+          open(AFILE, ">$afile");
+          print AFILE "$ppfile\n";
+          close(AFILE);
         }
-
-        mkpath $dir;
-        open(AFILE, ">$afile");
-        print AFILE "$ppfile\n";
-        close(AFILE);
+        close CHILD;
       }
-      close CHILD;
     }
   }
   

Modified: cfe/trunk/utils/scan-build
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/scan-build?rev=77644&r1=77643&r2=77644&view=diff

==============================================================================
--- cfe/trunk/utils/scan-build (original)
+++ cfe/trunk/utils/scan-build Thu Jul 30 18:55:19 2009
@@ -959,6 +959,9 @@
                   the 'basic' store model is used. 'region' specifies a field-
                   sensitive store model. Be warned that the 'region' model
                   is still in very early testing phase and may often crash.
+                  
+ -no-failure-reports - Do not create a 'failures' subdirectory that includes
+                       analyzer crash reports and preprocessed source files.
 
 AVAILABLE ANALYSES (multiple analyses may be specified):
 
@@ -1172,6 +1175,11 @@
     $OutputFormat = "plist-html";
     next;
   }
+  
+  if ($arg eq "-no-failure-reports") {
+    $ENV{"CCC_REPORT_FAILURES"} = 0;
+    next;
+  }
 
   DieDiag("unrecognized option '$arg'\n") if ($arg =~ /^-/);
   





More information about the cfe-commits mailing list