]> granicus.if.org Git - clang/commitdiff
scan-build: use the xcodebuild specified by the user.
authorJordan Rose <jordan_rose@apple.com>
Wed, 22 May 2013 18:09:57 +0000 (18:09 +0000)
committerJordan Rose <jordan_rose@apple.com>
Wed, 22 May 2013 18:09:57 +0000 (18:09 +0000)
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!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182498 91177308-0d34-0410-b5e6-96231b3b80d8

tools/scan-build/scan-build

index 35f852e70b22cf289bae428b977130e498630763..803c073511095fe688409f131f0c6a7765170882 100755 (executable)
@@ -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);