r182498 - scan-build: use the xcodebuild specified by the user.

Jordan Rose jordan_rose at apple.com
Wed May 22 11:09:57 PDT 2013


Author: jrose
Date: Wed May 22 13:09:57 2013
New Revision: 182498

URL: http://llvm.org/viewvc/llvm-project?rev=182498&view=rev
Log:
scan-build: use the xcodebuild specified by the user.

This is important if the user has multiple Xcodes installed on their
system -- we use xcodebuild to do a version check, and therefore we need
to make sure we match the actual build command.

Reported by Howard Ling!

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=182498&r1=182497&r2=182498&view=diff
==============================================================================
--- cfe/trunk/tools/scan-build/scan-build (original)
+++ cfe/trunk/tools/scan-build/scan-build Wed May 22 13:09:57 2013
@@ -910,7 +910,7 @@ sub RunXcodebuild {
   # Detect the version of Xcode.  If Xcode 4.6 or higher, use new
   # in situ support for analyzer interposition without needed to override
   # the compiler.
-  open(DETECT_XCODE, "xcodebuild -version |") or
+  open(DETECT_XCODE, "-|", $Args->[0], "-version") or
     die "error: cannot detect version of xcodebuild\n";
 
   my $oldBehavior = 1;
@@ -976,16 +976,11 @@ sub RunBuildCommand {
   my $CCAnalyzer = shift;
   my $CXXAnalyzer = shift;
   my $Options = shift;
-  
-  # Get only the part of the command after the last '/'.
-  if ($Cmd =~ /\/([^\/]+)$/) {
-    $Cmd = $1;
-  }
-  
-  if ($Cmd eq "xcodebuild") {
+
+  if ($Cmd =~ /\bxcodebuild$/) {
     return RunXcodebuild($Args, $IgnoreErrors, $CCAnalyzer, $CXXAnalyzer, $Options);
   }
-  
+
   # Setup the environment.
   SetEnv($Options);
   





More information about the cfe-commits mailing list