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

Ted Kremenek kremenek at apple.com
Thu Aug 21 14:47:09 PDT 2008


Author: kremenek
Date: Thu Aug 21 16:47:09 2008
New Revision: 55142

URL: http://llvm.org/viewvc/llvm-project?rev=55142&view=rev
Log:
Added --use-cc option to scan-build to allow the user to specify what compiler they want to use for code compilation.

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=55142&r1=55141&r2=55142&view=diff

==============================================================================
--- cfe/trunk/utils/ccc-analyzer (original)
+++ cfe/trunk/utils/ccc-analyzer Thu Aug 21 16:47:09 2008
@@ -184,7 +184,9 @@
 my $Output;
 
 # Forward arguments to gcc.
-my $Status = system("gcc", at ARGV);
+my $CC = $ENV{'CCC_CC'};
+if (!defined $CC) { $CC = "gcc"; }
+my $Status = system($CC, at ARGV);
 if ($Status) { exit($Status); }
 
 # Get the analysis options.

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

==============================================================================
--- cfe/trunk/utils/scan-build (original)
+++ cfe/trunk/utils/scan-build Thu Aug 21 16:47:09 2008
@@ -719,6 +719,10 @@
                   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 @@
     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++;





More information about the cfe-commits mailing list