Two changes to scan-build:

(1) When no 'clang' is found with 'scan-build', remember the one from
the path as scan-build sees it, not the build system.  This prevents
us from finding different clangs during the build.

(2) Don't set LDPLUSPLUS when running xcodebuild; instead rely on the
clang driver to do the right thing.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95943 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/scan-build/scan-build b/tools/scan-build/scan-build
index 7f05de2..432456b 100755
--- a/tools/scan-build/scan-build
+++ b/tools/scan-build/scan-build
@@ -88,7 +88,11 @@
 my $Clang;
 if (!defined $ClangSB || ! -x $ClangSB) {
   # Default to looking for 'clang' in the path.
-  $Clang = "clang";
+  $Clang = `which clang`;
+  chomp $Clang;
+  if ($Clang eq "") {
+    DieDiag("No 'clang' executable found in path.");
+  }
 }
 else {
   $Clang = $ClangSB;
@@ -842,10 +846,6 @@
     # When 'CC' is set, xcodebuild uses it to do all linking, even if we are
     # linking C++ object files.  Set 'LDPLUSPLUS' so that xcodebuild uses 'g++'
     # when linking such files.
-    if (!defined $ENV{'CCC_CXX'}) {
-      $ENV{'CCC_CXX'} = 'g++';      
-    }
-    $ENV{'LDPLUSPLUS'} = $ENV{'CCC_CXX'};
   }
   
   return (system(@$Args) >> 8);
@@ -1192,7 +1192,7 @@
 
 if (!defined $ClangSB || ! -x $ClangSB) {
   Diag("'clang' executable not found in '$RealBin/bin'.\n");
-  Diag("Using 'clang' from path.\n");
+  Diag("Using 'clang' from path: $Clang\n");
 }
 
 $ENV{'CC'} = $Cmd;