]> granicus.if.org Git - clang/commitdiff
[analyzer] SATestBuild.py: Use driver for analyzing single-file tests.
authorArtem Dergachev <artem.dergachev@gmail.com>
Wed, 29 May 2019 18:49:31 +0000 (18:49 +0000)
committerArtem Dergachev <artem.dergachev@gmail.com>
Wed, 29 May 2019 18:49:31 +0000 (18:49 +0000)
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

utils/analyzer/SATestBuild.py
utils/analyzer/SATestUtils.py

index 1c96cd88381821817ce9729ea2a27d12740e256d..691ded80a1ef145086518bd64c30087b11d9cdcd 100755 (executable)
@@ -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 "
index 2320652619ed3ddb8ce37f1086205f0b69255f69..0ed4a4b02f793efc880d3e3d16bb2efada101182 100644 (file)
@@ -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):
     """