aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Driver/Driver.cpp
diff options
context:
space:
mode:
authorMichał Górny <mgorny@moritz.systems>2022-09-16 09:07:10 +0200
committerMichał Górny <mgorny@moritz.systems>2022-09-16 19:38:11 +0200
commit587729c3ad78aec6ec5a295331b16f21e340feb1 (patch)
tree3767782c6e8bb7fb2a448fc1dc36b6cfe8176a92 /clang/lib/Driver/Driver.cpp
parente191086bfcb72a98a9e299fd30dd3f69c5de5b64 (diff)
downloadllvm-587729c3ad78aec6ec5a295331b16f21e340feb1.zip
llvm-587729c3ad78aec6ec5a295331b16f21e340feb1.tar.gz
llvm-587729c3ad78aec6ec5a295331b16f21e340feb1.tar.bz2
[clang] [Driver] Add an option to disable default config filenames
Add a `--no-default-config` option that disables the search for default set of config filenames (based on the compiler executable name). Suggested in https://discourse.llvm.org/t/rfc-adding-a-default-file-location-to-config-file-support/63606. Differential Revision: https://reviews.llvm.org/D134018
Diffstat (limited to 'clang/lib/Driver/Driver.cpp')
-rw-r--r--clang/lib/Driver/Driver.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
index 217236f..d8b1373 100644
--- a/clang/lib/Driver/Driver.cpp
+++ b/clang/lib/Driver/Driver.cpp
@@ -1024,11 +1024,14 @@ bool Driver::loadConfigFile() {
}
}
- // If config file is not specified explicitly, try to deduce configuration
- // from executable name. For instance, an executable 'armv7l-clang' will
- // search for config file 'armv7l-clang.cfg'.
- if (CfgFileName.empty() && !ClangNameParts.TargetPrefix.empty())
- CfgFileName = ClangNameParts.TargetPrefix + '-' + ClangNameParts.ModeSuffix;
+ if (!(CLOptions && CLOptions->hasArg(options::OPT_no_default_config))) {
+ // If config file is not specified explicitly, try to deduce configuration
+ // from executable name. For instance, an executable 'armv7l-clang' will
+ // search for config file 'armv7l-clang.cfg'.
+ if (CfgFileName.empty() && !ClangNameParts.TargetPrefix.empty())
+ CfgFileName =
+ ClangNameParts.TargetPrefix + '-' + ClangNameParts.ModeSuffix;
+ }
if (CfgFileName.empty())
return false;