r362009 - [analyzer] SATestBuild.py: Use driver for analyzing single-file tests.

Artem Dergachev via cfe-commits cfe-commits at lists.llvm.org
Wed May 29 11:49:31 PDT 2019


Author: dergachev
Date: Wed May 29 11:49:31 2019
New Revision: 362009

URL: http://llvm.org/viewvc/llvm-project?rev=362009&view=rev
Log:
[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.

Modified:
    cfe/trunk/utils/analyzer/SATestBuild.py
    cfe/trunk/utils/analyzer/SATestUtils.py

Modified: cfe/trunk/utils/analyzer/SATestBuild.py
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/analyzer/SATestBuild.py?rev=362009&r1=362008&r2=362009&view=diff
==============================================================================
--- cfe/trunk/utils/analyzer/SATestBuild.py (original)
+++ cfe/trunk/utils/analyzer/SATestBuild.py Wed May 29 11:49:31 2019
@@ -343,18 +343,13 @@ def runAnalyzePreprocessed(Args, Dir, SB
                 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 "

Modified: cfe/trunk/utils/analyzer/SATestUtils.py
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/analyzer/SATestUtils.py?rev=362009&r1=362008&r2=362009&view=diff
==============================================================================
--- cfe/trunk/utils/analyzer/SATestUtils.py (original)
+++ cfe/trunk/utils/analyzer/SATestUtils.py Wed May 29 11:49:31 2019
@@ -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):
     """




More information about the cfe-commits mailing list