Use 'clang' binary in the same dir as scan-build; if it isn't there use the one in the path

llvm-svn: 49933
This commit is contained in:
Ted Kremenek 2008-04-18 22:00:56 +00:00
parent 24840f6748
commit cf9e9c5554
2 changed files with 18 additions and 7 deletions

View File

@ -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)

View File

@ -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;