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

Ted Kremenek kremenek at apple.com
Fri Apr 18 15:00:57 PDT 2008


Author: kremenek
Date: Fri Apr 18 17:00:56 2008
New Revision: 49933

URL: http://llvm.org/viewvc/llvm-project?rev=49933&view=rev
Log:
Use 'clang' binary in the same dir as scan-build; if it isn't there use the one in the path

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=49933&r1=49932&r2=49933&view=diff

==============================================================================
--- cfe/trunk/utils/ccc-analyzer (original)
+++ cfe/trunk/utils/ccc-analyzer Fri Apr 18 17:00:56 2008
@@ -37,10 +37,6 @@
     if code:
         sys.exit(code)
 
-def preprocess(args):
-    command = 'clang -E'.split()
-    run(command + args)
-
 def compile(args):
   # We MUST print to stderr.  Some clients use the stdout output of
   # gcc for various purposes.
@@ -54,7 +50,7 @@
           return path
       return path[:i]
 
-def analyze(args,language,output,files,verbose,htmldir):
+def analyze(clang, args,language,output,files,verbose,htmldir):
     if language.find("c++") > 0:
       return
   
@@ -74,7 +70,7 @@
       command = 'cp'.split()
       args = command + files + target.split()      
     else:
-      command = 'clang -checker-cfref'.split()
+      command = clang.split() + '-checker-cfref'.split()
       args = command + args;
       
       if htmldir is not None:
@@ -133,9 +129,16 @@
     language = ''
     
     verbose = 0
+    clang = "clang"
+    
     
     if os.environ.get('CCC_ANALYZER_VERBOSE') is not None:
       verbose =1
+      
+    clang_env = os.environ.get('CLANG') 
+    
+    if clang_env is not None:
+      clang = clang_env
     
     htmldir = os.environ.get('CCC_ANALYZER_HTML')
       
@@ -236,7 +239,7 @@
             if language != 'unknown':
               analyze_args = analyze_args + [ '-x', language ]
             analyze_args = analyze_args + compile_opts
-            analyze(analyze_args, language, output, files, verbose, htmldir)
+            analyze(clang, analyze_args, language, output, files, verbose, htmldir)
         compile(args)
 
 

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

==============================================================================
--- cfe/trunk/utils/scan-build (original)
+++ cfe/trunk/utils/scan-build Fri Apr 18 17:00:56 2008
@@ -537,8 +537,16 @@
 
 die "$Prog: Executable 'ccc-analyzer' does not exist at '$Cmd'\n"
   if (! -x $Cmd);
+  
+my $Clang = "$RealBin/clang";
+
+if (! -x $Clang) {
+  print "$Prog: 'clang' executable not found in '$RealBin'.  Using 'clang' from path.\n";
+  $Clang = "clang";
+}
 
 $ENV{'CC'} = $Cmd;
+$ENV{'CLANG'} = $Clang;
 
 if ($Verbose >= 2) {
   $ENV{'CCC_ANALYZER_VERBOSE'} = 1;





More information about the cfe-commits mailing list