Bring back scan-build-search-path.diff (Closes: #757219)

This commit is contained in:
Sylvestre Ledru 2014-08-06 09:43:32 +00:00
parent a3b4964a1a
commit ec45d4f8f0
2 changed files with 40 additions and 0 deletions

1
debian/changelog vendored
View File

@ -2,6 +2,7 @@ llvm-toolchain-3.5 (1:3.5~+rc1-3~exp2) UNRELEASED; urgency=medium
* Enable compressed debug sections (Closes: #757002)
* Force scan-build to use the same version of clang
* Bring back scan-build-search-path.diff (Closes: #757219)
-- Sylvestre Ledru <sylvestre@debian.org> Mon, 04 Aug 2014 13:35:35 +0200

View File

@ -11,3 +11,42 @@ Index: llvm-toolchain-snapshot_3.5~svn199197/clang/tools/scan-build/scan-build
if (!defined $Clang || ! -x $Clang) {
$Clang = Cwd::realpath("$RealBin/clang");
}
diff -Naur llvm-toolchain-3.5-3.5~+rc1.orig/clang/tools/scan-build/ccc-analyzer llvm-toolchain-3.5-3.5~+rc1/clang/tools/scan-build/ccc-analyzer
--- llvm-toolchain-3.5-3.5~+rc1.orig/clang/tools/scan-build/ccc-analyzer 2014-08-06 10:29:51.990552103 +0200
+++ llvm-toolchain-3.5-3.5~+rc1/clang/tools/scan-build/ccc-analyzer 2014-08-06 10:35:05.016567533 +0200
@@ -25,6 +25,17 @@
# Compiler command setup.
##===----------------------------------------------------------------------===##
+# Search in the PATH if the compiler exists
+sub SearchInPath {
+ my $file = shift;
+ foreach my $dir (split (':', $ENV{PATH})) {
+ if (-x "$dir/$file") {
+ return 1;
+ }
+ }
+ return 0;
+}
+
my $Compiler;
my $Clang;
my $DefaultCCompiler;
@@ -41,7 +52,7 @@
if ($FindBin::Script =~ /c\+\+-analyzer/) {
$Compiler = $ENV{'CCC_CXX'};
- if (!defined $Compiler || ! -x $Compiler) { $Compiler = $DefaultCXXCompiler; }
+ if (!defined $Compiler || (! -x $Compiler && ! SearchInPath($Compiler))) { $Compiler = $DefaultCXXCompiler; }
$Clang = $ENV{'CLANG_CXX'};
if (!defined $Clang || ! -x $Clang) { $Clang = 'clang++'; }
@@ -50,7 +61,7 @@
}
else {
$Compiler = $ENV{'CCC_CC'};
- if (!defined $Compiler || ! -x $Compiler) { $Compiler = $DefaultCCompiler; }
+ if (!defined $Compiler || (! -x $Compiler && ! SearchInPath($Compiler))) { $Compiler = $DefaultCCompiler; }
$Clang = $ENV{'CLANG'};
if (!defined $Clang || ! -x $Clang) { $Clang = 'clang'; }