]> granicus.if.org Git - clang/commitdiff
Added --use-cc option to scan-build to allow the user to specify what compiler they...
authorTed Kremenek <kremenek@apple.com>
Thu, 21 Aug 2008 21:47:09 +0000 (21:47 +0000)
committerTed Kremenek <kremenek@apple.com>
Thu, 21 Aug 2008 21:47:09 +0000 (21:47 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55142 91177308-0d34-0410-b5e6-96231b3b80d8

utils/ccc-analyzer
utils/scan-build

index d41978c01fd5de014c9aa487c7c9e1548a10bd0e..c760a864fdd1a87e27e312fe501737bff7bb942c 100755 (executable)
@@ -184,7 +184,9 @@ my $Lang;
 my $Output;
 
 # Forward arguments to gcc.
-my $Status = system("gcc",@ARGV);
+my $CC = $ENV{'CCC_CC'};
+if (!defined $CC) { $CC = "gcc"; }
+my $Status = system($CC,@ARGV);
 if ($Status) { exit($Status); }
 
 # Get the analysis options.
index 44c2db3f0dcaf7daea3bd0c74dd1f276b4ee6685..d04c2897e9df135104ec17681a969598c6b2c35b 100755 (executable)
@@ -719,6 +719,10 @@ OPTIONS:
                   exit status of $Prog to be 1 if it found potential bugs
                   and 0 otherwise.
 
+ --use-cc [compiler path]  - By default, $Prog uses 'gcc' to compile
+ --use-cc=[compiler path]    your code. This option specifies what compiler
+                             to use for regular code compilation.
+
  -v             - Verbose output from $Prog and the analyzer.
                   A second and third "-v" increases verbosity.
 
@@ -811,6 +815,24 @@ while (@ARGV) {
     next;
   }
   
+  if ($arg =~ /^--use-cc(=(.+))?$/) {
+    shift @ARGV;
+    my $cc;
+    
+    if ($2 eq "") {
+      if (!@ARGV) {
+        DieDiag("'--use-cc' option requires a compiler executable name.\n");
+      }
+      $cc = shift @ARGV;
+    }
+    else {
+      $cc = $2;
+    }
+    
+    $ENV{"CCC_CC"} = $cc;
+    next;
+  }
+  
   if ($arg eq "-v") {
     shift @ARGV;
     $Verbose++;