Index: clang/docs/UsersManual.rst =================================================================== --- clang/docs/UsersManual.rst +++ clang/docs/UsersManual.rst @@ -847,6 +847,9 @@ CLANG_CONFIG_FILE_SYSTEM_DIR respectively. The first file found is used. It is an error if the required file cannot be found. +If clang was built with the CMake parameter CLANG_DEFAULT_CONFIG_FILE, and no +other configuration file is specified, that file is always looked up for. + Another way to specify a configuration file is to encode it in executable name. For example, if the Clang executable is named `armv7l-clang` (it may be a symbolic link to `clang`), then Clang will search for file `armv7l.cfg` in the Index: clang/include/clang/Config/config.h.cmake =================================================================== --- clang/include/clang/Config/config.h.cmake +++ clang/include/clang/Config/config.h.cmake @@ -51,6 +51,9 @@ #cmakedefine CLANG_CONFIG_FILE_SYSTEM_DIR "${CLANG_CONFIG_FILE_SYSTEM_DIR}" #cmakedefine CLANG_CONFIG_FILE_USER_DIR "${CLANG_CONFIG_FILE_USER_DIR}" +/* Default config config for clang, prepended to every clang run */ +#cmakedefine CLANG_DEFAULT_CONFIG_FILE "${CLANG_DEFAULT_CONFIG_FILE}" + /* Default to all compiler invocations for --sysroot=. */ #define DEFAULT_SYSROOT "${DEFAULT_SYSROOT}" Index: clang/lib/Driver/Driver.cpp =================================================================== --- clang/lib/Driver/Driver.cpp +++ clang/lib/Driver/Driver.cpp @@ -871,6 +871,10 @@ return true; } } +#ifdef CLANG_DEFAULT_CONFIG_FILE + if (ConfigFiles.empty()) + ConfigFiles.push_back(CLANG_DEFAULT_CONFIG_FILE); +#endif if (!ConfigFiles.empty()) { CfgFileName = ConfigFiles.front();