From a8a5653cb275daf5899bcfcb42d0d5d6cb0058eb Mon Sep 17 00:00:00 2001 From: Anton Yartsev Date: Thu, 20 Aug 2015 21:52:39 +0000 Subject: [PATCH] [analyzer] Fix for PR24112 (scan-build doesn't work with --use-analyzer="path to clang++.exe"). Don't derive the path_to_clang++ from the path_to_clang if the path_to_clang is really the path_to_clang++. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@245621 91177308-0d34-0410-b5e6-96231b3b80d8 --- tools/scan-build/scan-build | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/tools/scan-build/scan-build b/tools/scan-build/scan-build index 8c4c14dbeb..b3a4008dee 100755 --- a/tools/scan-build/scan-build +++ b/tools/scan-build/scan-build @@ -1646,14 +1646,20 @@ if ($ForceDisplayHelp || $RequestDisplayHelp) { } $ClangCXX = $Clang; -# Determine operating system under which this copy of Perl was built. -my $IsWinBuild = ($^O =~/msys|cygwin|MSWin32/); -if($IsWinBuild) { - $ClangCXX =~ s/.exe$/++.exe/; -} -else { - $ClangCXX =~ s/\-\d+\.\d+$//; - $ClangCXX .= "++"; +if ($Clang !~ /\+\+(\.exe)?$/) { + # If $Clang holds the name of the clang++ executable then we leave + # $ClangCXX and $Clang equal, otherwise construct the name of the clang++ + # executable from the clang executable name. + + # Determine operating system under which this copy of Perl was built. + my $IsWinBuild = ($^O =~/msys|cygwin|MSWin32/); + if($IsWinBuild) { + $ClangCXX =~ s/.exe$/++.exe/; + } + else { + $ClangCXX =~ s/\-\d+\.\d+$//; + $ClangCXX .= "++"; + } } # Make sure to use "" to handle paths with spaces. -- 2.40.0