Index: clang/utils/analyzer/SATestBuild.py =================================================================== --- clang/utils/analyzer/SATestBuild.py +++ clang/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)