[cfe-commits] r51621 - /cfe/trunk/utils/scan-build

Ted Kremenek kremenek at apple.com
Tue May 27 16:18:07 PDT 2008


Author: kremenek
Date: Tue May 27 18:18:07 2008
New Revision: 51621

URL: http://llvm.org/viewvc/llvm-project?rev=51621&view=rev
Log:
When the build command is xcodebuild, set the magical environment variable LDPLUSPLUS to g++ to ensure that C++ object files are linked with g++ instead of gcc.

Modified:
    cfe/trunk/utils/scan-build

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

==============================================================================
--- cfe/trunk/utils/scan-build (original)
+++ cfe/trunk/utils/scan-build Tue May 27 18:18:07 2008
@@ -511,13 +511,19 @@
     }
   } 
   
-
   if ($Cmd eq "xcodebuild") {
     # Disable distributed builds for xcodebuild.
     AddIfNotPresent($Args,"-nodistribute");
 
     # Disable PCH files until clang supports them.
     AddIfNotPresent($Args,"GCC_PRECOMPILE_PREFIX_HEADER=NO");
+    
+    # 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.
+    my $LDPLUSPLUS = `which g++`;
+    $LDPLUSPLUS =~ s/\015?\012//;  # strip newlines
+    $ENV{'LDPLUSPLUS'} = $LDPLUSPLUS;    
   }
   
   system(@$Args);





More information about the cfe-commits mailing list