From: Artem Dergachev Date: Wed, 29 May 2019 18:49:31 +0000 (+0000) Subject: [analyzer] SATestBuild.py: Use driver for analyzing single-file tests. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=df36e33d6e41fc2bbf8b02661efa4e3ebb06a9bd;p=clang [analyzer] SATestBuild.py: Use driver for analyzing single-file tests. Don't bother coming up with a -cc1 run-line ourselves. This, in particular, gets rid of a macOS-specific code path. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@362009 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/utils/analyzer/SATestBuild.py b/utils/analyzer/SATestBuild.py index 1c96cd8838..691ded80a1 100755 --- a/utils/analyzer/SATestBuild.py +++ b/utils/analyzer/SATestBuild.py @@ -343,18 +343,13 @@ def runAnalyzePreprocessed(Args, Dir, SBOutputDir, Mode): BuildScript)) raise Exception() - CmdPrefix = Clang + " -cc1 " + CmdPrefix = Clang + " --analyze " - # For now, we assume the preprocessed files should be analyzed - # with the OS X SDK. - SDKPath = SATestUtils.getSDKPath("macosx") - if SDKPath is not None: - CmdPrefix += "-isysroot " + SDKPath + " " - - CmdPrefix += "-analyze -analyzer-output=plist -w " - CmdPrefix += "-analyzer-checker=" + Checkers + CmdPrefix += "--analyzer-output plist " + CmdPrefix += " -Xclang -analyzer-checker=" + Checkers CmdPrefix += " -fcxx-exceptions -fblocks " - CmdPrefix += " -analyzer-config %s " % generateAnalyzerConfig(Args) + CmdPrefix += " -Xclang -analyzer-config -Xclang %s "\ + % generateAnalyzerConfig(Args) if (Mode == 2): CmdPrefix += "-std=c++11 " diff --git a/utils/analyzer/SATestUtils.py b/utils/analyzer/SATestUtils.py index 2320652619..0ed4a4b02f 100644 --- a/utils/analyzer/SATestUtils.py +++ b/utils/analyzer/SATestUtils.py @@ -1,5 +1,5 @@ import os -from subprocess import check_output, check_call +from subprocess import check_call import sys @@ -47,18 +47,6 @@ def isValidSingleInputFile(FileName): return Ext in (".i", ".ii", ".c", ".cpp", ".m", "") -def getSDKPath(SDKName): - """ - Get the path to the SDK for the given SDK name. Returns None if - the path cannot be determined. - """ - if which("xcrun") is None: - return None - - Cmd = "xcrun --sdk " + SDKName + " --show-sdk-path" - return check_output(Cmd, shell=True).rstrip() - - def runScript(ScriptPath, PBuildLogFile, Cwd, Stdout=sys.stdout, Stderr=sys.stderr): """