mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-02-11 20:27:19 +00:00
[analyzer] Improve behavior if Clang not found.
- Eliminate 'No such file or directory at scan-build line ...' error if '$RealBin/bin/clang' or '$RealBin/clang' directory does not exist. - Eliminate 'Use of uninitialized value $Clang in concatenation (.) or string at scan-build line ...' error if help is displayed while $Clang was not found. llvm-svn: 247466
This commit is contained in:
parent
072e83500e
commit
f54d6796e3
@ -1258,6 +1258,7 @@ LOADING CHECKERS:
|
||||
-load-plugin [plugin library]
|
||||
ENDTEXT
|
||||
|
||||
if (defined $Clang && -x $Clang) {
|
||||
# Query clang for list of checkers that are enabled.
|
||||
|
||||
# create a list to load the plugins via the 'Xclang' command line
|
||||
@ -1290,7 +1291,7 @@ ENDTEXT
|
||||
push ( @PluginLoadCommandline, "-load" );
|
||||
push ( @PluginLoadCommandline, $param );
|
||||
}
|
||||
if (defined $Clang && -x $Clang) {
|
||||
|
||||
my $ExecLine = join(' ', qq/"$Clang"/, "-cc1", @PluginLoadCommandline, "-analyzer-checker-help", "2>&1", "|");
|
||||
open(PS, $ExecLine);
|
||||
my $foundCheckers = 0;
|
||||
@ -1634,6 +1635,7 @@ if (!@ARGV) {
|
||||
}
|
||||
|
||||
ProcessArgs(\@ARGV);
|
||||
# All arguments are now shifted from @ARGV. The rest is a build command, if any.
|
||||
|
||||
if (!@ARGV and !$RequestDisplayHelp) {
|
||||
ErrorDiag("No build command specified.\n\n");
|
||||
@ -1642,9 +1644,9 @@ if (!@ARGV and !$RequestDisplayHelp) {
|
||||
|
||||
# Find 'clang'
|
||||
if (!defined $Options{AnalyzerDiscoveryMethod}) {
|
||||
$Clang = Cwd::realpath("$RealBin/bin/clang");
|
||||
$Clang = Cwd::realpath("$RealBin/bin/clang") if (-d "$RealBin/bin/clang");
|
||||
if (!defined $Clang || ! -x $Clang) {
|
||||
$Clang = Cwd::realpath("$RealBin/clang");
|
||||
$Clang = Cwd::realpath("$RealBin/clang") if (-d "$RealBin/clang");
|
||||
}
|
||||
if (!defined $Clang || ! -x $Clang) {
|
||||
if (!$RequestDisplayHelp && !$ForceDisplayHelp) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user