// These are always too hard.
if (compopt_too_hard(arg) || util::starts_with(arg, "-fdump-")
- || util::starts_with(arg, "-MJ") || util::starts_with(arg, "-Yc")) {
+ || util::starts_with(arg, "-MJ") || util::starts_with(arg, "-Yc")
+ || util::starts_with(arg, "--config-system-dir=")
+ || util::starts_with(arg, "--config-user-dir=")) {
LOG("Compiler option {} is unsupported", args[i]);
return Statistic::unsupported_compiler_option;
}
} else {
path = args[i].substr(eq_pos + 1);
}
+
+ if (args[i] == "--config" && path.find('/') == std::string::npos) {
+ // --config FILE without / in FILE: the file is searched for in Clang's
+ // user/system/executable directories.
+ LOG("Argument to compiler option {} is too hard", args[i]);
+ return tl::unexpected(Statistic::unsupported_compiler_option);
+ }
+
DirEntry dir_entry(path, DirEntry::LogOnError::yes);
if (dir_entry.is_regular_file()) {
// If given an explicit specs file, then hash that file, but don't
hash.hash_delimiter("specs");
TRY(hash_compiler(ctx, hash, dir_entry, path, false));
return {};
+ } else {
+ LOG("While processing {}: {} is missing", args[i], path);
+ return tl::unexpected(Statistic::bad_compiler_arguments);
}
}
get_manifest_key(Context& ctx, Hash& hash)
{
// Hash environment variables that affect the preprocessor output.
- const char* envvars[] = {"CPATH",
- "C_INCLUDE_PATH",
- "CPLUS_INCLUDE_PATH",
- "OBJC_INCLUDE_PATH",
- "OBJCPLUS_INCLUDE_PATH", // clang
- nullptr};
+ const char* envvars[] = {
+ "CPATH",
+ "C_INCLUDE_PATH",
+ "CPLUS_INCLUDE_PATH",
+ "OBJC_INCLUDE_PATH",
+ "OBJCPLUS_INCLUDE_PATH", // Clang
+ "CLANG_CONFIG_FILE_SYSTEM_DIR", // Clang
+ "CLANG_CONFIG_FILE_USER_DIR", // Clang
+ nullptr,
+ };
for (const char** p = envvars; *p; ++p) {
const char* v = getenv(*p);
if (v) {