diff options
author | Ted Kremenek <kremenek@apple.com> | 2008-09-04 17:52:41 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2008-09-04 17:52:41 +0000 |
commit | 95aa1050cd170f9729ca66a1b2e2f0219458671e (patch) | |
tree | 1f6e527db85f0cd9c67fba2108ff02d538584208 | |
parent | 39218dfef550ad1cd7b7ece83a715996a113ffd1 (diff) |
scan-build:
- Only set the environment variable 'CXX' if the user specifies --use-c++.
- Fix regression when setting LDPLUSPLUS: add a 'which' to determine the location of g++. This regression was pointed out by Jordan Breeding!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55780 91177308-0d34-0410-b5e6-96231b3b80d8
-rwxr-xr-x | utils/scan-build | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/utils/scan-build b/utils/scan-build index 705ad2cd68..540a60b2f3 100755 --- a/utils/scan-build +++ b/utils/scan-build @@ -24,7 +24,7 @@ my $Verbose = 0; # Verbose output from this script. my $Prog = "scan-build"; my $BuildName; my $BuildDate; -my $CXX = 'g++'; +my $CXX; # Leave undefined initially. my $UseColor = ((($ENV{'TERM'} eq 'xterm-color') and -t STDOUT) and defined($ENV{'SCAN_BUILD_COLOR'})); @@ -692,7 +692,8 @@ sub RunBuildCommand { # 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 = `$CXX`; + die if (!defined $CXX); + my $LDPLUSPLUS = `which $CXX`; $LDPLUSPLUS =~ s/\015?\012//; # strip newlines $ENV{'LDPLUSPLUS'} = $LDPLUSPLUS; } @@ -917,7 +918,14 @@ if (! -x $ClangSB) { Diag("Using 'clang' from path.\n"); } -$ENV{'CXX'} = $CXX; +if (defined $CXX) { + $ENV{'CXX'} = $CXX; +} +else { + $CXX = 'g++'; # This variable is used by other parts of scan-build + # that need to know a default C++ compiler to fall back to. +} + $ENV{'CC'} = $Cmd; $ENV{'CLANG'} = $Clang; |