diff options
| author | Ted Kremenek <kremenek@apple.com> | 2012-08-06 18:54:19 +0000 |
|---|---|---|
| committer | Ted Kremenek <kremenek@apple.com> | 2012-08-06 18:54:19 +0000 |
| commit | 0d29bd231bb58e283f637b397fd6ea0cdfa5b57b (patch) | |
| tree | 0c3a9b67a10bfda2050c0d50a0fbc28c295e3521 | |
| parent | 8b7cfe33ec54db7336181a1254e57dee829387e6 (diff) | |
| download | bcm5719-llvm-0d29bd231bb58e283f637b397fd6ea0cdfa5b57b.tar.gz bcm5719-llvm-0d29bd231bb58e283f637b397fd6ea0cdfa5b57b.zip | |
Pull 'xcodebuild' wrapper logic into a separate function.
llvm-svn: 161330
| -rwxr-xr-x | clang/tools/scan-build/scan-build | 64 |
1 files changed, 38 insertions, 26 deletions
diff --git a/clang/tools/scan-build/scan-build b/clang/tools/scan-build/scan-build index 0ba26e23672..e67f046159d 100755 --- a/clang/tools/scan-build/scan-build +++ b/clang/tools/scan-build/scan-build @@ -868,6 +868,40 @@ sub AddIfNotPresent { } } +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 @@ sub RunBuildCommand { $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 @@ sub RunBuildCommand { 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); } |

