diff options
| author | Ted Kremenek <kremenek@apple.com> | 2012-09-14 19:06:33 +0000 |
|---|---|---|
| committer | Ted Kremenek <kremenek@apple.com> | 2012-09-14 19:06:33 +0000 |
| commit | 460602e2523947b6e85dda14764eb5c1545c3ef8 (patch) | |
| tree | cd88d3c57237d43d70558f90c3f9dafab5f53ce3 | |
| parent | 5e5049d9a64e918ab807c5d3790491d6b3c94861 (diff) | |
| download | bcm5719-llvm-460602e2523947b6e85dda14764eb5c1545c3ef8.tar.gz bcm5719-llvm-460602e2523947b6e85dda14764eb5c1545c3ef8.zip | |
Utilize new build system support in Xcode 4.5 for easier interposition
of a build without needing to use ccc-analyzer.
llvm-svn: 163927
| -rwxr-xr-x | clang/tools/scan-build/scan-build | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/clang/tools/scan-build/scan-build b/clang/tools/scan-build/scan-build index a13b235aa93..d27a07396d7 100755 --- a/clang/tools/scan-build/scan-build +++ b/clang/tools/scan-build/scan-build @@ -884,6 +884,36 @@ sub RunXcodebuild { if ($IgnoreErrors) { AddIfNotPresent($Args,"-PBXBuildsContinueAfterErrors=YES"); } + + # Detect the version of Xcode. If Xcode 4.5 or higher, use new + # in situ support for analyzer interposition without needed to override + # the compiler. + open(DETECT_XCODE, "xcodebuild -version |") or + die "error: cannot detect version of xcodebuild\n"; + + my $oldBehavior = 1; + + while(<DETECT_XCODE>) { + if (/^Xcode (.+)$/) { + if ($1 >= 4.5) { + $oldBehavior = 0; + last; + } + } + } + close(DETECT_XCODE); + + if ($oldBehavior == 0) { + my $OutputDir = $Options->{"OUTPUT_DIR"}; + my $CLANG = $Options->{"CLANG"}; + push @$Args, + "RUN_CLANG_STATIC_ANALYZER=YES", + "CLANG_ANALYZER_OUTPUT=plist-html", + "CLANG_ANALYZER_EXEC=$CLANG", + "CLANG_ANALYZER_OUTPUT_DIR=$OutputDir"; + + return (system(@$Args) >> 8); + } # Default to old behavior where we insert a bogus compiler. SetEnv($Options); |

