Added "-a" option to scan-build to select the analysis (ASTConsumer) used by clang. The default is -checker-cfref.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51116 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/utils/ccc-analyzer b/utils/ccc-analyzer
index 6530303..a1308da 100755
--- a/utils/ccc-analyzer
+++ b/utils/ccc-analyzer
@@ -50,7 +50,7 @@
return path
return path[:i]
-def analyze(clang, args,language,output,files,verbose,htmldir,file):
+def analyze(clang, args,language,output,files,verbose,htmldir,file,analysis_type):
if language.find("c++") > 0:
return
@@ -73,14 +73,12 @@
command = 'cp'.split()
args = command + files + target.split()
else:
- command = clang.split() + '-checker-cfref'.split()
+ command = clang.split() + analysis_type.split()
args = command + args;
RunAnalyzer = 1
if verbose == 2:
print >> sys.stderr, '#SHELL (cd ' + os.getcwd() + ' && ' + ' '.join(command + print_args) + ')\n'
- print >> sys.stderr, '#LINE (cd ' + os.getcwd() + ' && wc -l ' + file + ')\n'
-
if RunAnalyzer and htmldir is not None:
args.append('-o')
@@ -142,18 +140,29 @@
# Forward to GCC.
compile(args)
-
+
+ # Set the analyzer flag.
+ analysis_type = os.environ.get('CCC_ANALYZER_ANALYSIS')
+
+ if analysis_type is not None:
+ analysis_type = "-" + analysis_type
+ else:
+ analysis_type = "-checker-cfref"
+
+ # Determine the level of verbosity.
if os.environ.get('CCC_ANALYZER_VERBOSE') is not None:
verbose = 1
if os.environ.get('CCC_ANALYZER_LOG') is not None:
verbose = 2
+ # Determine what clang executable to use.
clang_env = os.environ.get('CLANG')
if clang_env is not None:
clang = clang_env
+ # Get the HTML output directory.
htmldir = os.environ.get('CCC_ANALYZER_HTML')
i = 0
@@ -268,7 +277,7 @@
if language != 'unknown':
analyze_args = [ '-x', language ] + analyze_args
analyze_args = analyze_args + compile_opts
- analyze(clang, analyze_args, language, output, files, verbose, htmldir, file)
+ analyze(clang, analyze_args, language, output, files, verbose, htmldir, file, analysis_type)
# compile(args)