Author: george.karpenkov Date: Tue Oct 2 14:19:23 2018 New Revision: 343636
URL: http://llvm.org/viewvc/llvm-project?rev=343636&view=rev Log: [analyzer] [tests] Allow specifying entire -analyze-config on the command line, make sure it's always propagated Differential Revision: https://reviews.llvm.org/D52801 Modified: cfe/trunk/utils/analyzer/SATestBuild.py Modified: cfe/trunk/utils/analyzer/SATestBuild.py URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/analyzer/SATestBuild.py?rev=343636&r1=343635&r2=343636&view=diff ============================================================================== --- cfe/trunk/utils/analyzer/SATestBuild.py (original) +++ cfe/trunk/utils/analyzer/SATestBuild.py Tue Oct 2 14:19:23 2018 @@ -255,6 +255,13 @@ def applyPatch(Dir, PBuildLogFile): 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 @@ def runScanBuild(Args, Dir, SBOutputDir, 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 @@ def runScanBuild(Args, Dir, SBOutputDir, 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 @@ def runScanBuild(Args, Dir, SBOutputDir, 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 @@ def runAnalyzePreprocessed(Dir, SBOutput 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 @@ def buildProject(Args, Dir, SBOutputDir, 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 @@ if __name__ == '__main__': 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) _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits