Revert "[driver] Additional ignoring of module-map related flags, if modules are disabled"

This reverts commit 33162a81d4.

This change breaks the usage of module maps with modules disabled, such
as for layering checking via `-fmodules-decluse`.

Regression test added.
This commit is contained in:
Richard Smith 2022-08-30 18:20:51 -07:00
parent b9f7678846
commit 146ae4138a
2 changed files with 21 additions and 25 deletions

View File

@ -3726,6 +3726,7 @@ static void RenderModulesOptions(Compilation &C, const Driver &D,
options::OPT_fno_modules_validate_input_files_content,
false))
CmdArgs.push_back("-fvalidate-ast-input-files-content");
}
// -fmodule-name specifies the module that is currently being built (or
// used for header checking by -fmodule-maps).
@ -3745,11 +3746,6 @@ static void RenderModulesOptions(Compilation &C, const Driver &D,
CmdArgs.push_back(
Args.MakeArgString("-fmodule-map-file=" + BuiltinModuleMap));
}
} else {
Args.ClaimAllArgs(options::OPT_fmodule_name_EQ);
Args.ClaimAllArgs(options::OPT_fmodule_map_file);
Args.ClaimAllArgs(options::OPT_fbuiltin_module_map);
}
// The -fmodule-file=<name>=<file> form specifies the mapping of module
// names to precompiled module files (the module is loaded only if used).

View File

@ -75,8 +75,8 @@
// RUN: %clang -fno-modules -fbuild-session-timestamp=123 -### %s 2>&1 | FileCheck -check-prefix=SESSION_FLAG %s
// SESSION_FLAG-NOT: -fbuild-session-timestamp
// RUN: %clang -fno-modules -fmodules-validate-once-per-build-session -fmodules-validate-system-headers -fmodule-map-file=module.modulemap \
// RUN: -### %s 2>&1 | FileCheck -check-prefix=IGNORED_FLAGS %s
// IGNORED_FLAGS-NOT: -fmodules-validate-once-per-build-session
// IGNORED_FLAGS-NOT: -fmodules-validate-system-headers
// IGNORED_FLAGS-NOT: -fmodule-map-file
// RUN: %clang -fno-modules -fmodules-validate-once-per-build-session -### %s 2>&1 | FileCheck -check-prefix=VALIDATE_ONCE_FLAG %s
// VALIDATE_ONCE_FLAG-NOT: -fmodules-validate-once-per-build-session
// RUN: %clang -fno-modules -fmodules-validate-system-headers -### %s 2>&1 | FileCheck -check-prefix=VALIDATE_SYSTEM_FLAG %s
// VALIDATE_SYSTEM_FLAG-NOT: -fmodules-validate-system-headers