From f22eacb11b50e647e7d08531ca5648d3c84c38c3 Mon Sep 17 00:00:00 2001 From: Ted Kremenek Date: Fri, 18 Apr 2008 22:00:56 +0000 Subject: [PATCH] Use 'clang' binary in the same dir as scan-build; if it isn't there use the one in the path git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49933 91177308-0d34-0410-b5e6-96231b3b80d8 --- utils/ccc-analyzer | 17 ++++++++++------- utils/scan-build | 8 ++++++++ 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/utils/ccc-analyzer b/utils/ccc-analyzer index 4442c18e56..f4b4861db4 100755 --- a/utils/ccc-analyzer +++ b/utils/ccc-analyzer @@ -37,10 +37,6 @@ def run(args): if code: sys.exit(code) -def preprocess(args): - command = 'clang -E'.split() - run(command + args) - def compile(args): # We MUST print to stderr. Some clients use the stdout output of # gcc for various purposes. @@ -54,7 +50,7 @@ def remove_pch_extension(path): return path return path[:i] -def analyze(args,language,output,files,verbose,htmldir): +def analyze(clang, args,language,output,files,verbose,htmldir): if language.find("c++") > 0: return @@ -74,7 +70,7 @@ def analyze(args,language,output,files,verbose,htmldir): command = 'cp'.split() args = command + files + target.split() else: - command = 'clang -checker-cfref'.split() + command = clang.split() + '-checker-cfref'.split() args = command + args; if htmldir is not None: @@ -133,9 +129,16 @@ def main(args): language = '' verbose = 0 + clang = "clang" + if os.environ.get('CCC_ANALYZER_VERBOSE') is not None: verbose =1 + + clang_env = os.environ.get('CLANG') + + if clang_env is not None: + clang = clang_env htmldir = os.environ.get('CCC_ANALYZER_HTML') @@ -236,7 +239,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, verbose, htmldir) + analyze(clang, analyze_args, language, output, files, verbose, htmldir) compile(args) diff --git a/utils/scan-build b/utils/scan-build index 362cad2e26..99262e4e1e 100755 --- a/utils/scan-build +++ b/utils/scan-build @@ -537,8 +537,16 @@ my $Cmd = "$RealBin/ccc-analyzer"; die "$Prog: Executable 'ccc-analyzer' does not exist at '$Cmd'\n" if (! -x $Cmd); + +my $Clang = "$RealBin/clang"; + +if (! -x $Clang) { + print "$Prog: 'clang' executable not found in '$RealBin'. Using 'clang' from path.\n"; + $Clang = "clang"; +} $ENV{'CC'} = $Cmd; +$ENV{'CLANG'} = $Clang; if ($Verbose >= 2) { $ENV{'CCC_ANALYZER_VERBOSE'} = 1; -- 2.40.0