r182981 - [analyzer] Add --override-compiler option to scan-build.

Anna Zaks ganna at apple.com
Thu May 30 19:31:07 PDT 2013


Author: zaks
Date: Thu May 30 21:31:07 2013
New Revision: 182981

URL: http://llvm.org/viewvc/llvm-project?rev=182981&view=rev
Log:
[analyzer] Add --override-compiler option to scan-build.

The new advanced option ensures ccc-analyze is used even when better
interposition methods are available.

Modified:
    cfe/trunk/tools/scan-build/scan-build

Modified: cfe/trunk/tools/scan-build/scan-build
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/scan-build/scan-build?rev=182981&r1=182980&r2=182981&view=diff
==============================================================================
--- cfe/trunk/tools/scan-build/scan-build (original)
+++ cfe/trunk/tools/scan-build/scan-build Thu May 30 21:31:07 2013
@@ -896,6 +896,9 @@ sub SetEnv {
   }
 }
 
+# The flag corresponding to the --override-compiler command line option.
+my $OverrideCompiler = 0; 
+
 sub RunXcodebuild {
   my $Args = shift;
   my $IgnoreErrors = shift;
@@ -928,6 +931,12 @@ sub RunXcodebuild {
   }
   close(DETECT_XCODE);
   
+  # If --override-compiler is explicitely requested, resort to the old 
+  # behavior regardless of Xcode version.
+  if ($OverrideCompiler) {
+    $oldBehavior = 1;
+  }
+  
   if ($oldBehavior == 0) {
     my $OutputDir = $Options->{"OUTPUT_DIR"};
     my $CLANG = $Options->{"CLANG"};
@@ -1143,6 +1152,10 @@ ADVANCED OPTIONS:
 
    Don't remove the build results directory even if no issues were reported.
 
+ --override-compiler 
+   Always resort to the ccc-analyzer even when better interposition methods 
+   are available.
+   
 CONTROLLING CHECKERS:
 
  A default group of checkers are always run unless explicitly disabled.
@@ -1506,6 +1519,12 @@ while (@ARGV) {
     $KeepEmpty = 1;
     next;
   }
+
+  if ($arg eq "--override-compiler") {
+    shift @ARGV;
+    $OverrideCompiler = 1;
+    next;
+  }
   
   DieDiag("unrecognized option '$arg'\n") if ($arg =~ /^-/);
   





More information about the cfe-commits mailing list