[cfe-commits] r161330 - /cfe/trunk/tools/scan-build/scan-build
Ted Kremenek
kremenek at apple.com
Mon Aug 6 11:54:20 PDT 2012
Author: kremenek
Date: Mon Aug 6 13:54:19 2012
New Revision: 161330
URL: http://llvm.org/viewvc/llvm-project?rev=161330&view=rev
Log:
Pull 'xcodebuild' wrapper logic into a separate function.
Modified:
cfe/trunk/tools/scan-build/scan-build
Modified: cfe/trunk/tools/scan-build/scan-build
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/scan-build/scan-build?rev=161330&r1=161329&r2=161330&view=diff
==============================================================================
--- cfe/trunk/tools/scan-build/scan-build (original)
+++ cfe/trunk/tools/scan-build/scan-build Mon Aug 6 13:54:19 2012
@@ -868,6 +868,40 @@
}
}
+sub RunXcodebuild {
+ my $Args = shift;
+ my $IgnoreErrors = shift;
+ my $CCAnalyzer = shift;
+ my $CXXAnalyzer = shift;
+
+ if ($IgnoreErrors) {
+ AddIfNotPresent($Args,"-PBXBuildsContinueAfterErrors=YES");
+ }
+
+ # Check if using iPhone SDK 3.0 (simulator). If so the compiler being
+ # used should be gcc-4.2.
+ if (!defined $ENV{"CCC_CC"}) {
+ for (my $i = 0 ; $i < scalar(@$Args); ++$i) {
+ if ($Args->[$i] eq "-sdk" && $i + 1 < scalar(@$Args)) {
+ if (@$Args[$i+1] =~ /^iphonesimulator3/) {
+ $ENV{"CCC_CC"} = "gcc-4.2";
+ $ENV{"CCC_CXX"} = "g++-4.2";
+ }
+ }
+ }
+ }
+
+ # Disable PCH files until clang supports them.
+ AddIfNotPresent($Args,"GCC_PRECOMPILE_PREFIX_HEADER=NO");
+
+ # 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++'
+ # (via c++-analyzer) when linking such files.
+ $ENV{"LDPLUSPLUS"} = $CXXAnalyzer;
+
+ return (system(@$Args) >> 8);
+}
+
sub RunBuildCommand {
my $Args = shift;
@@ -881,6 +915,10 @@
$Cmd = $1;
}
+ if ($Cmd eq "xcodebuild") {
+ return RunXcodebuild($Args, $IgnoreErrors, $CCAnalyzer, $CXXAnalyzer);
+ }
+
if ($Cmd =~ /(.*\/?gcc[^\/]*$)/ or
$Cmd =~ /(.*\/?cc[^\/]*$)/ or
$Cmd =~ /(.*\/?llvm-gcc[^\/]*$)/ or
@@ -912,34 +950,8 @@
AddIfNotPresent($Args,"-k");
AddIfNotPresent($Args,"-i");
}
- elsif ($Cmd eq "xcodebuild") {
- AddIfNotPresent($Args,"-PBXBuildsContinueAfterErrors=YES");
- }
}
-
- if ($Cmd eq "xcodebuild") {
- # Check if using iPhone SDK 3.0 (simulator). If so the compiler being
- # used should be gcc-4.2.
- if (!defined $ENV{"CCC_CC"}) {
- for (my $i = 0 ; $i < scalar(@$Args); ++$i) {
- if ($Args->[$i] eq "-sdk" && $i + 1 < scalar(@$Args)) {
- if (@$Args[$i+1] =~ /^iphonesimulator3/) {
- $ENV{"CCC_CC"} = "gcc-4.2";
- $ENV{"CCC_CXX"} = "g++-4.2";
- }
- }
- }
- }
- # Disable PCH files until clang supports them.
- AddIfNotPresent($Args,"GCC_PRECOMPILE_PREFIX_HEADER=NO");
-
- # 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++'
- # (via c++-analyzer) when linking such files.
- $ENV{"LDPLUSPLUS"} = $CXXAnalyzer;
- }
-
return (system(@$Args) >> 8);
}
More information about the cfe-commits
mailing list