From a9525c929b280f12bd4f92a1732f981b82a62d25 Mon Sep 17 00:00:00 2001 From: Ted Kremenek Date: Mon, 12 May 2008 22:07:14 +0000 Subject: [PATCH] Added internal command logging. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51003 91177308-0d34-0410-b5e6-96231b3b80d8 --- utils/ccc-analyzer | 30 +++++++++++++++++++++--------- utils/scan-build | 4 ++++ 2 files changed, 25 insertions(+), 9 deletions(-) diff --git a/utils/ccc-analyzer b/utils/ccc-analyzer index d19955381e..8f69b0a390 100755 --- a/utils/ccc-analyzer +++ b/utils/ccc-analyzer @@ -64,7 +64,10 @@ def analyze(clang, args,language,output,files,verbose,htmldir): while i < len(args): print_args.append(''.join([ '\'', args[i], '\'' ])) i += 1 - + + + RunAnalyzer = 0; + if language.find("header") > 0: target = remove_pch_extension(output) command = 'cp'.split() @@ -72,19 +75,25 @@ def analyze(clang, args,language,output,files,verbose,htmldir): else: command = clang.split() + '-checker-cfref'.split() args = command + args; - - if htmldir is not None: - args.append('-o') - print_args.append('-o') - args.append(htmldir) - print_args.append(htmldir) + RunAnalyzer = 1 + + if verbose == 2: + print >> sys.stderr, '#SHELL (cd ' + os.getcwd() + ' && ' + ' '.join(command + print_args) + ')\n' + + + if RunAnalyzer and htmldir is not None: + args.append('-o') + print_args.append('-o') + args.append(htmldir) + print_args.append(htmldir) if verbose: # We MUST print to stderr. Some clients use the stdout output of # gcc for various purposes. print >> sys.stderr, ' '.join(command+print_args) print >> sys.stderr, '\n' - + + subprocess.call(args) def link(args): @@ -133,7 +142,10 @@ def main(args): if os.environ.get('CCC_ANALYZER_VERBOSE') is not None: - verbose =1 + verbose = 1 + + if os.environ.get('CCC_ANALYZER_LOG') is not None: + verbose = 2 clang_env = os.environ.get('CLANG') diff --git a/utils/scan-build b/utils/scan-build index 1514db3970..5a74c8ce8b 100755 --- a/utils/scan-build +++ b/utils/scan-build @@ -662,6 +662,10 @@ if ($Verbose >= 2) { $ENV{'CCC_ANALYZER_VERBOSE'} = 1; } +if ($Verbose >= 3) { + $ENV{'CCC_ANALYZER_LOG'} = 1; +} + # Run the build. RunBuildCommand(\@ARGV, $IgnoreErrors); -- 2.50.1