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
This commit is contained in:
Ted Kremenek 2008-04-18 22:00:56 +00:00
Родитель 84472a897a
Коммит f22eacb11b
2 изменённых файлов: 18 добавлений и 7 удалений

Просмотреть файл

@ -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,10 +129,17 @@ 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')
i = 0
@ -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)

Просмотреть файл

@ -538,7 +538,15 @@ 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;