diff options
author | Devin Coughlin <dcoughlin@apple.com> | 2015-09-14 21:22:24 +0000 |
---|---|---|
committer | Devin Coughlin <dcoughlin@apple.com> | 2015-09-14 21:22:24 +0000 |
commit | bace032eb81aa9bf2bad513a693291243d03c6a7 (patch) | |
tree | f4ef419876aef15744a679f10fa8b87d0b79ae09 /clang/utils | |
parent | 06f99279301c7721b192364b4d49e9c96db134a8 (diff) | |
download | bcm5719-llvm-bace032eb81aa9bf2bad513a693291243d03c6a7.tar.gz bcm5719-llvm-bace032eb81aa9bf2bad513a693291243d03c6a7.zip |
[analyzer] Update SATestBuild.py to set -isysroot for preprocessed files
Update the static analyzer buildbot script to set -isysroot to the OS X SDK path
when analyzing preprocessed files on OS X.
Differential Revision: http://reviews.llvm.org/D12769
llvm-svn: 247617
Diffstat (limited to 'clang/utils')
-rwxr-xr-x | clang/utils/analyzer/SATestBuild.py | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/clang/utils/analyzer/SATestBuild.py b/clang/utils/analyzer/SATestBuild.py index e541c72c6ac..440b2ec956b 100755 --- a/clang/utils/analyzer/SATestBuild.py +++ b/clang/utils/analyzer/SATestBuild.py @@ -52,7 +52,7 @@ import shutil import time import plistlib import argparse -from subprocess import check_call, CalledProcessError +from subprocess import check_call, check_output, CalledProcessError #------------------------------------------------------------------------------ # Helper functions. @@ -255,6 +255,15 @@ def isValidSingleInputFile(FileName): return True return False +# Get the path to the SDK for the given SDK name. Returns None if +# the path cannot be determined. +def getSDKPath(SDKName): + if which("xcrun") is None: + return None + + Cmd = "xcrun --sdk " + SDKName + " --show-sdk-path" + return check_output(Cmd, shell=True).rstrip() + # Run analysis on a set of preprocessed files. def runAnalyzePreprocessed(Dir, SBOutputDir, Mode): if os.path.exists(os.path.join(Dir, BuildScript)): @@ -262,7 +271,15 @@ def runAnalyzePreprocessed(Dir, SBOutputDir, Mode): BuildScript raise Exception() - CmdPrefix = Clang + " -cc1 -analyze -analyzer-output=plist -w " + CmdPrefix = Clang + " -cc1 " + + # For now, we assume the preprocessed files should be analyzed + # with the OS X SDK. + SDKPath = getSDKPath("macosx") + if SDKPath is not None: + CmdPrefix += "-isysroot " + SDKPath + " " + + CmdPrefix += "-analyze -analyzer-output=plist -w " CmdPrefix += "-analyzer-checker=" + Checkers +" -fcxx-exceptions -fblocks " if (Mode == 2) : |