From: Ted Kremenek Date: Fri, 15 May 2009 21:14:16 +0000 (+0000) Subject: Add hack to scan-build to fix PR 4215 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=87752b2442260fcf569e7a1447a04cd8955494c5;p=clang Add hack to scan-build to fix PR 4215 (http://llvm.org/bugs/show_bug.cgi?id=4215): When xcodebuild is invoked with -sdk iphonesimulator3.0, use gcc-4.2 instead of the system default gcc. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71891 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/utils/scan-build b/utils/scan-build index dd289a0d6c..5835628d59 100755 --- a/utils/scan-build +++ b/utils/scan-build @@ -859,6 +859,18 @@ sub RunBuildCommand { } 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"; + } + } + } + } + # Disable distributed builds for xcodebuild. AddIfNotPresent($Args,"-nodistribute");