[llvm-branch-commits] [cfe-branch] r215427 - Merging r215229:

Bill Wendling isanbard at gmail.com
Mon Aug 11 22:38:53 PDT 2014


Author: void
Date: Tue Aug 12 00:38:53 2014
New Revision: 215427

URL: http://llvm.org/viewvc/llvm-project?rev=215427&view=rev
Log:
Merging r215229:
------------------------------------------------------------------------
r215229 | sylvestre | 2014-08-08 10:15:13 -0700 (Fri, 08 Aug 2014) | 11 lines

Fix a bug when scan-build is used in a cross-compilation environment with
the --use-cc option.

Instead, we will search in the PATH
For example:
 scan-build --use-cc=arm-none-eabi-gcc -o out make -e

Initially reported as a Debian Bug:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=748777


------------------------------------------------------------------------

Modified:
    cfe/branches/release_35/   (props changed)
    cfe/branches/release_35/tools/scan-build/ccc-analyzer

Propchange: cfe/branches/release_35/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Aug 12 00:38:53 2014
@@ -1,4 +1,4 @@
 /cfe/branches/type-system-rewrite:134693-134817
-/cfe/trunk:213609,213611,213613,213741,213834,213840,213902,213912-213913,213993,213998-213999,214008,214050,214060,214119,214208,214222,214369,214390,214471,214734-214735,214777,215046,215245
+/cfe/trunk:213609,213611,213613,213741,213834,213840,213902,213912-213913,213993,213998-213999,214008,214050,214060,214119,214208,214222,214369,214390,214471,214734-214735,214777,215046,215229,215245
 /cfe/trunk/test:170344
 /cfe/trunk/test/SemaTemplate:126920

Modified: cfe/branches/release_35/tools/scan-build/ccc-analyzer
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_35/tools/scan-build/ccc-analyzer?rev=215427&r1=215426&r2=215427&view=diff
==============================================================================
--- cfe/branches/release_35/tools/scan-build/ccc-analyzer (original)
+++ cfe/branches/release_35/tools/scan-build/ccc-analyzer Tue Aug 12 00:38:53 2014
@@ -25,6 +25,17 @@ use Text::ParseWords;
 # 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 (`uname -a` =~ m/Darwin/) {
 
 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 @@ if ($FindBin::Script =~ /c\+\+-analyzer/
 }
 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'; }





More information about the llvm-branch-commits mailing list