Author: george.karpenkov Date: Fri Jun 29 15:05:32 2018 New Revision: 336023
URL: http://llvm.org/viewvc/llvm-project?rev=336023&view=rev Log: [analyzer] [tests] Allow the tested project to specify it's own analyzer wrapper 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=336023&r1=336022&r2=336023&view=diff ============================================================================== --- cfe/trunk/utils/analyzer/SATestBuild.py (original) +++ cfe/trunk/utils/analyzer/SATestBuild.py Fri Jun 29 15:05:32 2018 @@ -136,6 +136,9 @@ CleanupScript = "cleanup_run_static_anal # 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, PBuil # 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, PBuil 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, PBuil 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") _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits