diff options
author | Ted Kremenek <kremenek@apple.com> | 2010-03-27 00:20:01 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2010-03-27 00:20:01 +0000 |
commit | d76197a2710c54ff1922607dc4007251956f8f0d (patch) | |
tree | 62d0fcf61e6a0119030b0e39f0d79713a00ebce9 | |
parent | 44313db5579b72d5b956c1f49b1bb77c3e6f081b (diff) | |
download | bcm5719-llvm-d76197a2710c54ff1922607dc4007251956f8f0d.tar.gz bcm5719-llvm-d76197a2710c54ff1922607dc4007251956f8f0d.zip |
scan-build: set environment variable LDPLUSPLUS to 'c++-analyzer' to correctly link projects
with c++ code.
llvm-svn: 99684
-rwxr-xr-x | clang/tools/scan-build/scan-build | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/clang/tools/scan-build/scan-build b/clang/tools/scan-build/scan-build index 432456b15fe..8a7afbb3eae 100755 --- a/clang/tools/scan-build/scan-build +++ b/clang/tools/scan-build/scan-build @@ -783,6 +783,7 @@ sub RunBuildCommand { my $IgnoreErrors = shift; my $Cmd = $Args->[0]; my $CCAnalyzer = shift; + my $CXXAnalyzer = shift; # Get only the part of the command after the last '/'. if ($Cmd =~ /\/([^\/]+)$/) { @@ -809,12 +810,12 @@ sub RunBuildCommand { $ENV{"CCC_CXX"} = $1; } shift @$Args; - unshift @$Args, $CCAnalyzer; + unshift @$Args, $CXXAnalyzer; } elsif ($IgnoreErrors) { if ($Cmd eq "make" or $Cmd eq "gmake") { AddIfNotPresent($Args, "CC=$CCAnalyzer"); - AddIfNotPresent($Args, "CXX=$CCAnalyzer"); + AddIfNotPresent($Args, "CXX=$CXXAnalyzer"); AddIfNotPresent($Args,"-k"); AddIfNotPresent($Args,"-i"); } @@ -845,7 +846,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. + # (via c++-analyzer) when linking such files. + $ENV{"LDPLUSPLUS"} = $CXXAnalyzer; } return (system(@$Args) >> 8); @@ -1232,9 +1234,8 @@ if (defined $OutputFormat) { $ENV{'CCC_ANALYZER_OUTPUT_FORMAT'} = $OutputFormat; } - # Run the build. -my $ExitStatus = RunBuildCommand(\@ARGV, $IgnoreErrors, $Cmd); +my $ExitStatus = RunBuildCommand(\@ARGV, $IgnoreErrors, $Cmd, $CmdCXX); if (defined $OutputFormat) { if ($OutputFormat =~ /plist/) { |