[cfe-commits] r55780 - /cfe/trunk/utils/scan-build

Ted Kremenek kremenek at apple.com
Thu Sep 4 10:52:42 PDT 2008


Author: kremenek
Date: Thu Sep  4 12:52:41 2008
New Revision: 55780

URL: http://llvm.org/viewvc/llvm-project?rev=55780&view=rev
Log:
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!

Modified:
    cfe/trunk/utils/scan-build

Modified: cfe/trunk/utils/scan-build
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/scan-build?rev=55780&r1=55779&r2=55780&view=diff

==============================================================================
--- cfe/trunk/utils/scan-build (original)
+++ cfe/trunk/utils/scan-build Thu Sep  4 12:52:41 2008
@@ -24,7 +24,7 @@
 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 @@
     # 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 @@
   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;
 





More information about the cfe-commits mailing list