[clang] a648f34 - [clang-cl] Expose -fmodules and related flags in the driver (PR43391)
Hans Wennborg via cfe-commits
cfe-commits at lists.llvm.org
Tue Jul 27 02:32:57 PDT 2021
Author: Hans Wennborg
Date: 2021-07-27T11:27:16+02:00
New Revision: a648f34342740e3fe2ddf040d61909d53b09e323
URL: https://github.com/llvm/llvm-project/commit/a648f34342740e3fe2ddf040d61909d53b09e323
DIFF: https://github.com/llvm/llvm-project/commit/a648f34342740e3fe2ddf040d61909d53b09e323.diff
LOG: [clang-cl] Expose -fmodules and related flags in the driver (PR43391)
I don't know how well this works with clang-cl, but people want to try
it out, and I think we want to make it work, so exposing the flags seems
reasonable.
Differential revision: https://reviews.llvm.org/D106791
Added:
Modified:
clang/include/clang/Driver/Options.td
clang/test/Driver/cl-options.c
Removed:
################################################################################
diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td
index 0e0aa16797cad..5a9fd078390e1 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -2139,7 +2139,7 @@ defm pch_debuginfo: OptInFFlag<"pch-debuginfo", "Generate ", "Do not generate ",
"debug info for types in an object file built from this PCH and do not generate them elsewhere">;
def fimplicit_module_maps : Flag <["-"], "fimplicit-module-maps">, Group<f_Group>,
- Flags<[NoXarchOption, CC1Option]>,
+ Flags<[NoXarchOption, CC1Option, CoreOption]>,
HelpText<"Implicitly search the file system for module map files.">,
MarshallingInfoFlag<HeaderSearchOpts<"ImplicitModuleMaps">>;
def fmodules_ts : Flag <["-"], "fmodules-ts">, Group<f_Group>,
@@ -2148,42 +2148,43 @@ def fmodules_ts : Flag <["-"], "fmodules-ts">, Group<f_Group>,
defm modules : BoolFOption<"modules",
LangOpts<"Modules">, Default<!strconcat(fmodules_ts.KeyPath, "||", cpp_modules.KeyPath)>,
PosFlag<SetTrue, [CC1Option], "Enable the 'modules' language feature">,
- NegFlag<SetFalse>, BothFlags<[NoXarchOption]>>;
-def fmodule_maps : Flag <["-"], "fmodule-maps">, Alias<fimplicit_module_maps>;
+ NegFlag<SetFalse>, BothFlags<[NoXarchOption, CoreOption]>>;
+def fmodule_maps : Flag <["-"], "fmodule-maps">, Flags<[CoreOption]>, Alias<fimplicit_module_maps>;
def fmodule_name_EQ : Joined<["-"], "fmodule-name=">, Group<f_Group>,
- Flags<[NoXarchOption,CC1Option]>, MetaVarName<"<name>">,
+ Flags<[NoXarchOption,CC1Option,CoreOption]>, MetaVarName<"<name>">,
HelpText<"Specify the name of the module to build">,
MarshallingInfoString<LangOpts<"ModuleName">>;
def fmodule_implementation_of : Separate<["-"], "fmodule-implementation-of">,
- Flags<[CC1Option]>, Alias<fmodule_name_EQ>;
-def fsystem_module : Flag<["-"], "fsystem-module">, Flags<[CC1Option]>,
+ Flags<[CC1Option,CoreOption]>, Alias<fmodule_name_EQ>;
+def fsystem_module : Flag<["-"], "fsystem-module">, Flags<[CC1Option,CoreOption]>,
HelpText<"Build this module as a system module. Only used with -emit-module">,
MarshallingInfoFlag<FrontendOpts<"IsSystemModule">>;
def fmodule_map_file : Joined<["-"], "fmodule-map-file=">,
- Group<f_Group>, Flags<[NoXarchOption,CC1Option]>, MetaVarName<"<file>">,
+ Group<f_Group>, Flags<[NoXarchOption,CC1Option,CoreOption]>, MetaVarName<"<file>">,
HelpText<"Load this module map file">,
MarshallingInfoStringVector<FrontendOpts<"ModuleMapFiles">>;
def fmodule_file : Joined<["-"], "fmodule-file=">,
- Group<i_Group>, Flags<[NoXarchOption,CC1Option]>, MetaVarName<"[<name>=]<file>">,
+ Group<i_Group>, Flags<[NoXarchOption,CC1Option,CoreOption]>, MetaVarName<"[<name>=]<file>">,
HelpText<"Specify the mapping of module name to precompiled module file, or load a module file if name is omitted.">;
-def fmodules_ignore_macro : Joined<["-"], "fmodules-ignore-macro=">, Group<f_Group>, Flags<[CC1Option]>,
+def fmodules_ignore_macro : Joined<["-"], "fmodules-ignore-macro=">, Group<f_Group>,
+ Flags<[CC1Option,CoreOption]>,
HelpText<"Ignore the definition of the given macro when building and loading modules">;
def fmodules_strict_decluse : Flag <["-"], "fmodules-strict-decluse">, Group<f_Group>,
- Flags<[NoXarchOption,CC1Option]>,
+ Flags<[NoXarchOption,CC1Option,CoreOption]>,
HelpText<"Like -fmodules-decluse but requires all headers to be in modules">,
MarshallingInfoFlag<LangOpts<"ModulesStrictDeclUse">>;
defm modules_decluse : BoolFOption<"modules-decluse",
LangOpts<"ModulesDeclUse">, Default<fmodules_strict_decluse.KeyPath>,
PosFlag<SetTrue, [CC1Option], "Require declaration of modules used within a module">,
- NegFlag<SetFalse>, BothFlags<[NoXarchOption]>>;
+ NegFlag<SetFalse>, BothFlags<[NoXarchOption,CoreOption]>>;
defm modules_search_all : BoolFOption<"modules-search-all",
LangOpts<"ModulesSearchAll">, DefaultFalse,
PosFlag<SetTrue, [], "Search even non-imported modules to resolve references">,
- NegFlag<SetFalse>, BothFlags<[NoXarchOption, CC1Option]>>,
+ NegFlag<SetFalse>, BothFlags<[NoXarchOption, CC1Option,CoreOption]>>,
ShouldParseIf<fmodules.KeyPath>;
defm implicit_modules : BoolFOption<"implicit-modules",
LangOpts<"ImplicitModules">, DefaultTrue,
- NegFlag<SetFalse, [CC1Option]>, PosFlag<SetTrue>, BothFlags<[NoXarchOption]>>;
+ NegFlag<SetFalse, [CC1Option]>, PosFlag<SetTrue>, BothFlags<[NoXarchOption,CoreOption]>>;
def fretain_comments_from_system_headers : Flag<["-"], "fretain-comments-from-system-headers">, Group<f_Group>, Flags<[CC1Option]>,
MarshallingInfoFlag<LangOpts<"RetainCommentsFromSystemHeaders">>;
diff --git a/clang/test/Driver/cl-options.c b/clang/test/Driver/cl-options.c
index 7f553079e4cc9..038badd847ce8 100644
--- a/clang/test/Driver/cl-options.c
+++ b/clang/test/Driver/cl-options.c
@@ -710,6 +710,23 @@
// RUN: -fcs-profile-generate \
// RUN: -fcs-profile-generate=dir \
// RUN: -ftime-trace \
+// RUN: -fmodules \
+// RUN: -fno-modules \
+// RUN: -fimplicit-module-maps \
+// RUN: -fmodule-maps \
+// RUN: -fmodule-name=foo \
+// RUN: -fmodule-implementation-of \
+// RUN: -fsystem-module \
+// RUN: -fmodule-map-file=foo \
+// RUN: -fmodule-file=foo \
+// RUN: -fmodules-ignore-macro=foo \
+// RUN: -fmodules-strict-decluse \
+// RUN: -fmodules-decluse \
+// RUN: -fno-modules-decluse \
+// RUN: -fmodules-search-all \
+// RUN: -fno-modules-search-all \
+// RUN: -fimplicit-modules \
+// RUN: -fno-implicit-modules \
// RUN: -ftrivial-auto-var-init=zero \
// RUN: -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang \
// RUN: --version \
More information about the cfe-commits
mailing list