The ccc-analyzer script now interrogates environment variables to determine
where to dump HTML reports.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48987 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/utils/ccc-analyzer b/utils/ccc-analyzer
index 1b92516..4912493 100755
--- a/utils/ccc-analyzer
+++ b/utils/ccc-analyzer
@@ -45,16 +45,16 @@
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 @@
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 @@
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 @@
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)