summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorGeorge Karpenkov <ekarpenkov@apple.com>2018-06-29 22:05:32 +0000
committerGeorge Karpenkov <ekarpenkov@apple.com>2018-06-29 22:05:32 +0000
commitb87dc38b6294d3514b0269ec50765d3ab1c0061f (patch)
tree255ad84aa3a672b89e2ec6b0a51257999a6396e3 /utils
parent534c44af2b96e7c066e49de7f4428205a6713d7c (diff)
downloadclang-b87dc38b6294d3514b0269ec50765d3ab1c0061f.tar.gz
[analyzer] [tests] Allow the tested project to specify it's own analyzer wrapper
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@336023 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils')
-rwxr-xr-xutils/analyzer/SATestBuild.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/utils/analyzer/SATestBuild.py b/utils/analyzer/SATestBuild.py
index 00f3bd853d..882c5ce7fc 100755
--- a/utils/analyzer/SATestBuild.py
+++ b/utils/analyzer/SATestBuild.py
@@ -136,6 +136,9 @@ CleanupScript = "cleanup_run_static_analyzer.sh"
# This is a file containing commands for scan-build.
BuildScript = "run_static_analyzer.cmd"
+# A comment in a build script which disables wrapping.
+NoPrefixCmd = "#NOPREFIX"
+
# The log file name.
LogFolderName = "Logs"
BuildLogName = "run_static_analyzer.log"
@@ -285,6 +288,7 @@ def runScanBuild(Dir, SBOutputDir, PBuildLogFile):
# Always use ccc-analyze to ensure that we can locate the failures
# directory.
SBOptions += "--override-compiler "
+ ExtraEnv = {}
try:
SBCommandFile = open(BuildScriptPath, "r")
SBPrefix = "scan-build " + SBOptions + " "
@@ -292,6 +296,15 @@ def runScanBuild(Dir, SBOutputDir, PBuildLogFile):
Command = Command.strip()
if len(Command) == 0:
continue
+
+ # Custom analyzer invocation specified by project.
+ # Communicate required information using environment variables
+ # instead.
+ if Command == NoPrefixCmd:
+ SBPrefix = ""
+ ExtraEnv['OUTPUT'] = SBOutputDir
+ continue
+
# If using 'make', auto imply a -jX argument
# to speed up analysis. xcodebuild will
# automatically use the maximum number of cores.
@@ -305,6 +318,7 @@ def runScanBuild(Dir, SBOutputDir, PBuildLogFile):
check_call(SBCommand, cwd=SBCwd,
stderr=PBuildLogFile,
stdout=PBuildLogFile,
+ env=dict(os.environ, **ExtraEnv),
shell=True)
except CalledProcessError:
Local.stderr.write("Error: scan-build failed. Its output was: \n")