aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2008-05-27 23:18:07 +0000
committerTed Kremenek <kremenek@apple.com>2008-05-27 23:18:07 +0000
commit915e972098f1e67c7559613ccde7205cee582e61 (patch)
tree611e6ab1e411b8d2d043cb985f2da31f9ab4d453
parent30aba6d2aa1f38e6da980f58f8286548b1caf4a3 (diff)
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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51621 91177308-0d34-0410-b5e6-96231b3b80d8
-rwxr-xr-xutils/scan-build8
1 files changed, 7 insertions, 1 deletions
diff --git a/utils/scan-build b/utils/scan-build
index a7ce797962..64419a3c4c 100755
--- a/utils/scan-build
+++ b/utils/scan-build
@@ -511,13 +511,19 @@ sub RunBuildCommand {
}
}
-
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);