[PATCH] D52801: [analyzer] [tests] Allow specifying entire -analyze-config on the command line, make sure it's always propagated
George Karpenkov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 2 14:21:18 PDT 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rC343636: [analyzer] [tests] Allow specifying entire -analyze-config on the command lineā¦ (authored by george.karpenkov, committed by ).
Herald added a subscriber: cfe-commits.
Changed prior to commit:
https://reviews.llvm.org/D52801?vs=168025&id=168028#toc
Repository:
rC Clang
https://reviews.llvm.org/D52801
Files:
utils/analyzer/SATestBuild.py
Index: utils/analyzer/SATestBuild.py
===================================================================
--- utils/analyzer/SATestBuild.py
+++ utils/analyzer/SATestBuild.py
@@ -255,6 +255,13 @@
sys.exit(1)
+def generateAnalyzerConfig(Args):
+ Out = "serialize-stats=true,stable-report-filename=true"
+ if Args.extra_analyzer_config:
+ Out += "," + Args.extra_analyzer_config
+ return Out
+
+
def runScanBuild(Args, Dir, SBOutputDir, PBuildLogFile):
"""
Build the project with scan-build by reading in the commands and
@@ -277,15 +284,7 @@
SBOptions += "-plist-html -o '%s' " % SBOutputDir
SBOptions += "-enable-checker " + AllCheckers + " "
SBOptions += "--keep-empty "
- AnalyzerConfig = [
- ("stable-report-filename", "true"),
- ("serialize-stats", "true"),
- ]
- AnalyzerConfigSerialized = ",".join(
- "%s=%s" % (key, value) for (key, value) in AnalyzerConfig)
- if Args.extra_args:
- AnalyzerConfigSerialized += "," + Args.extra_args
- SBOptions += "-analyzer-config '%s' " % AnalyzerConfigSerialized
+ SBOptions += "-analyzer-config '%s' " % generateAnalyzerConfig(Args)
# Always use ccc-analyze to ensure that we can locate the failures
# directory.
@@ -306,6 +305,7 @@
SBPrefix = ""
ExtraEnv['OUTPUT'] = SBOutputDir
ExtraEnv['CC'] = Clang
+ ExtraEnv['ANALYZER_CONFIG'] = generateAnalyzerConfig(Args)
continue
# If using 'make', auto imply a -jX argument
@@ -330,7 +330,7 @@
sys.exit(1)
-def runAnalyzePreprocessed(Dir, SBOutputDir, Mode):
+def runAnalyzePreprocessed(Args, Dir, SBOutputDir, Mode):
"""
Run analysis on a set of preprocessed files.
"""
@@ -351,6 +351,7 @@
CmdPrefix += "-analyze -analyzer-output=plist -w "
CmdPrefix += "-analyzer-checker=" + Checkers
CmdPrefix += " -fcxx-exceptions -fblocks "
+ CmdPrefix += " -analyzer-config " + generateAnalyzerConfig(Args)
if (Mode == 2):
CmdPrefix += "-std=c++11 "
@@ -435,7 +436,7 @@
runCleanupScript(Dir, PBuildLogFile)
runScanBuild(Args, Dir, SBOutputDir, PBuildLogFile)
else:
- runAnalyzePreprocessed(Dir, SBOutputDir, ProjectBuildMode)
+ runAnalyzePreprocessed(Args, Dir, SBOutputDir, ProjectBuildMode)
if IsReferenceBuild:
runCleanupScript(Dir, PBuildLogFile)
@@ -794,9 +795,10 @@
Parser.add_argument('-j', '--jobs', dest='jobs', type=int,
default=0,
help='Number of projects to test concurrently')
- Parser.add_argument('--extra-analyzer-args', dest='extra_args',
- type=str, default="",
- help="Extra arguments to add to -analyzer-config")
+ Parser.add_argument('--extra-analyzer-config', dest='extra_analyzer_config',
+ type=str,
+ default="",
+ help="Arguments passed to to -analyzer-config")
Args = Parser.parse_args()
TestsPassed = testAll(Args)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D52801.168028.patch
Type: text/x-patch
Size: 3162 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181002/4739e961/attachment.bin>
More information about the llvm-commits
mailing list