diff options
Diffstat (limited to 'clang')
-rwxr-xr-x | clang/utils/ccc-analyzer | 32 |
1 files changed, 23 insertions, 9 deletions
diff --git a/clang/utils/ccc-analyzer b/clang/utils/ccc-analyzer index 1b925165f45..4912493db14 100755 --- a/clang/utils/ccc-analyzer +++ b/clang/utils/ccc-analyzer @@ -45,16 +45,16 @@ def remove_pch_extension(path): return path return path[:i] -def analyze(args,language,output,files): +def analyze(args,language,output,files,verbose,htmldir): if language.find("c++") > 0: return - print >> sys.stderr, ' '.join(['\n[LOCATION]:', os.getcwd(), '\n' ]) - print_args = [] - i = 0 - while i < len(args): + if verbose: + print >> sys.stderr, ' '.join(['\n[LOCATION]:', os.getcwd(), '\n' ]) + i = 0 + while i < len(args): print_args.append(''.join([ '\'', args[i], '\'' ])) i += 1 @@ -64,10 +64,14 @@ def analyze(args,language,output,files): args = command + files + target.split() else: command = 'clang --grsimple'.split() - args = command + args + args = command + args + [ '-o', htmldir ] + print_args.append('-o') + print_args.append(htmldir) + + if verbose: + print >> sys.stderr, ' '.join(command+print_args) + print >> sys.stderr, '\n' - print >> sys.stderr, ' '.join(command+print_args) - print >> sys.stderr, '\n' subprocess.call(args) def link(args): @@ -111,6 +115,16 @@ def main(args): save_temps = 0 language = '' + verbose = 0 + + if os.environ.get('CCC_ANALYZER_VERBOSE') is not None: + verbose =1 + + htmldir = os.environ.get('CCC_ANALYZER_HTML') + if htmldir is None: + print >> sys.stderr, 'error: CCC_ANALYZER_HTML environment variable not set.' + sys.exit(1) + i = 0 while i < len(args): arg = args[i] @@ -208,7 +222,7 @@ def main(args): if language != 'unknown': analyze_args = analyze_args + [ '-x', language ] analyze_args = analyze_args + compile_opts - analyze(analyze_args,language,output,files) + analyze(analyze_args, language, output, files, verbose, htmldir) compile(args) |