On OS X, use xcrun (if present) to find the clang to use for static analysis if
no clang can be found relative to the location of scan-build. Fixes <rdar://problem/11691794> llvm-svn: 162535
This commit is contained in:
parent
663d160adb
commit
af592eef7b
|
@ -102,12 +102,26 @@ if (!defined $ClangSB || ! -x $ClangSB) {
|
|||
$ClangSB = Cwd::realpath("$RealBin/clang");
|
||||
}
|
||||
my $Clang;
|
||||
my $howFound = "from path";
|
||||
if (!defined $ClangSB || ! -x $ClangSB) {
|
||||
# Default to looking for 'clang' in the path.
|
||||
$Clang = `which clang`;
|
||||
chomp $Clang;
|
||||
if ($Clang eq "") {
|
||||
DieDiag("No 'clang' executable found in path.\n");
|
||||
# Default to looking for 'clang' in the path, or xcrun
|
||||
# on OS X.
|
||||
my $xcrun = `which xcrun`;
|
||||
chomp $xcrun;
|
||||
if ($xcrun ne "") {
|
||||
$Clang = `$xcrun -toolchain XcodeDefault -find clang`;
|
||||
chomp $Clang;
|
||||
if ($Clang eq "") {
|
||||
DieDiag("No 'clang' executable found by 'xcrun'\n");
|
||||
}
|
||||
$howFound = "found using 'xcrun'";
|
||||
}
|
||||
else {
|
||||
$Clang = `which clang`;
|
||||
chomp $Clang;
|
||||
if ($Clang eq "") {
|
||||
DieDiag("No 'clang' executable found in path\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -1459,7 +1473,7 @@ if (!defined $CmdCXX || ! -x $CmdCXX) {
|
|||
|
||||
if (!defined $ClangSB || ! -x $ClangSB) {
|
||||
Diag("'clang' executable not found in '$RealBin/bin'.\n");
|
||||
Diag("Using 'clang' from path: $Clang\n");
|
||||
Diag("Using 'clang' $howFound: $Clang\n");
|
||||
}
|
||||
|
||||
SetHtmlEnv(\@ARGV, $HtmlDir);
|
||||
|
|
Loading…
Reference in New Issue