diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td --- a/clang/include/clang/Driver/Options.td +++ b/clang/include/clang/Driver/Options.td @@ -1501,11 +1501,9 @@ def fprebuilt_module_path : Joined<["-"], "fprebuilt-module-path=">, Group, Flags<[NoXarchOption, CC1Option]>, MetaVarName<"">, HelpText<"Specify the prebuilt module path">; -def fprebuilt_implicit_modules : Flag<["-"], "fprebuilt-implicit-modules">, Group, - Flags<[NoXarchOption, CC1Option]>, - HelpText<"Look up implicit modules in the prebuilt module path">; -def fno_prebuilt_implicit_modules : Flag<["-"], "fno_prebuilt-implicit-modules">, Group, - Flags<[NoXarchOption, CC1Option]>; +defm prebuilt_implicit_modules : OptInFFlag<"prebuilt-implicit-modules", + "Look up implicit modules in the prebuilt module path", "", "", + [NoXarchOption, CC1Option], "HeaderSearchOpts->EnablePrebuiltImplicitModules">; def fmodules_prune_interval : Joined<["-"], "fmodules-prune-interval=">, Group, Flags<[CC1Option]>, MetaVarName<"">, HelpText<"Specify the interval (in seconds) between attempts to prune the module cache">; @@ -1524,13 +1522,17 @@ def fmodules_validate_once_per_build_session : Flag<["-"], "fmodules-validate-once-per-build-session">, Group, Flags<[CC1Option]>, HelpText<"Don't verify input files for the modules if the module has been " - "successfully validated or loaded during this build session">; + "successfully validated or loaded during this build session">, + MarshallingInfoFlag<"HeaderSearchOpts->ModulesValidateOncePerBuildSession">; def fmodules_disable_diagnostic_validation : Flag<["-"], "fmodules-disable-diagnostic-validation">, Group, Flags<[CC1Option]>, - HelpText<"Disable validation of the diagnostic options when loading the module">; + HelpText<"Disable validation of the diagnostic options when loading the module">, + MarshallingInfoFlag<"HeaderSearchOpts->ModulesValidateDiagnosticOptions", "true">, IsNegative; +// todo: simplify these into a version of OptInFFlag that accepts different flags for each record and does not imply group def fmodules_validate_system_headers : Flag<["-"], "fmodules-validate-system-headers">, Group, Flags<[CC1Option]>, - HelpText<"Validate the system headers that a module depends on when loading the module">; + HelpText<"Validate the system headers that a module depends on when loading the module">, + MarshallingInfoFlag<"HeaderSearchOpts->ModulesValidateSystemHeaders">; def fno_modules_validate_system_headers : Flag<["-"], "fno-modules-validate-system-headers">, Group, Flags<[NoXarchOption]>; @@ -1539,7 +1541,8 @@ Group, Flags<[CC1Option]>, HelpText<"Compute and store the hash of input files used to build an AST." " Files with mismatching mtime's are considered valid" - " if both contents is identical">; + " if both contents is identical">, + MarshallingInfoFlag<"HeaderSearchOpts->ValidateASTInputFilesContent">; def fmodules_validate_input_files_content: Flag <["-"], "fmodules-validate-input-files-content">, Group, Flags<[NoXarchOption]>, @@ -1571,7 +1574,8 @@ HelpText<"Enable the 'modules' language feature">; def fimplicit_module_maps : Flag <["-"], "fimplicit-module-maps">, Group, Flags<[NoXarchOption, CC1Option]>, - HelpText<"Implicitly search the file system for module map files.">; + HelpText<"Implicitly search the file system for module map files.">, + MarshallingInfoFlag<"HeaderSearchOpts->ImplicitModuleMaps">; def fmodules_ts : Flag <["-"], "fmodules-ts">, Group, Flags<[CC1Option]>, HelpText<"Enable support for the C++ Modules TS">; def fmodule_maps : Flag <["-"], "fmodule-maps">, Alias; @@ -2888,7 +2892,8 @@ def no_pedantic : Flag<["-", "--"], "no-pedantic">, Group; def no__dead__strip__inits__and__terms : Flag<["-"], "no_dead_strip_inits_and_terms">; def nobuiltininc : Flag<["-"], "nobuiltininc">, Flags<[CC1Option, CoreOption]>, - HelpText<"Disable builtin #include directories">; + HelpText<"Disable builtin #include directories">, + MarshallingInfoFlag<"HeaderSearchOpts->UseBuiltinIncludes", "true">, IsNegative; def nogpuinc : Flag<["-"], "nogpuinc">, HelpText<"Do not add include paths for CUDA/HIP and" " do not include the default CUDA/HIP wrapper headers">; def : Flag<["-"], "nocudainc">, Alias; @@ -2908,7 +2913,8 @@ def nostdinc : Flag<["-"], "nostdinc">, Flags<[CoreOption]>; def nostdlibinc : Flag<["-"], "nostdlibinc">; def nostdincxx : Flag<["-"], "nostdinc++">, Flags<[CC1Option]>, - HelpText<"Disable standard #include directories for the C++ standard library">; + HelpText<"Disable standard #include directories for the C++ standard library">, + MarshallingInfoFlag<"HeaderSearchOpts->UseStandardCXXIncludes", "true">, IsNegative; def nostdlib : Flag<["-"], "nostdlib">, Group; def nostdlibxx : Flag<["-"], "nostdlib++">; def object : Flag<["-"], "object">; @@ -3070,7 +3076,8 @@ def unexported__symbols__list : Separate<["-"], "unexported_symbols_list">; def u : JoinedOrSeparate<["-"], "u">, Group; def v : Flag<["-"], "v">, Flags<[CC1Option, CoreOption]>, - HelpText<"Show commands to run and use verbose output">; + HelpText<"Show commands to run and use verbose output">, + MarshallingInfoFlag<"HeaderSearchOpts->Verbose">; def verify_debug_info : Flag<["--"], "verify-debug-info">, Flags<[NoXarchOption]>, HelpText<"Verify the binary representation of debug output">; def weak_l : Joined<["-"], "weak-l">, Flags<[LinkerInput]>; @@ -4207,7 +4214,8 @@ HelpText<"Do not automatically import modules for error recovery">; def fmodule_map_file_home_is_cwd : Flag<["-"], "fmodule-map-file-home-is-cwd">, HelpText<"Use the current working directory as the home directory of " - "module maps specified by -fmodule-map-file=">; + "module maps specified by -fmodule-map-file=">, + MarshallingInfoFlag<"HeaderSearchOpts->ModuleMapFileHomeIsCwd">; def fmodule_feature : Separate<["-"], "fmodule-feature">, MetaVarName<"">, HelpText<"Enable in module map requires declarations">; @@ -4529,11 +4537,14 @@ //===----------------------------------------------------------------------===// def nostdsysteminc : Flag<["-"], "nostdsysteminc">, - HelpText<"Disable standard system #include directories">; + HelpText<"Disable standard system #include directories">, + MarshallingInfoFlag<"HeaderSearchOpts->UseStandardSystemIncludes", "true">, IsNegative; def fdisable_module_hash : Flag<["-"], "fdisable-module-hash">, - HelpText<"Disable the module hash">; + HelpText<"Disable the module hash">, + MarshallingInfoFlag<"HeaderSearchOpts->DisableModuleHash">; def fmodules_hash_content : Flag<["-"], "fmodules-hash-content">, - HelpText<"Enable hashing the content of a module file">; + HelpText<"Enable hashing the content of a module file">, + MarshallingInfoFlag<"HeaderSearchOpts->ModulesHashContent">; def fmodules_strict_context_hash : Flag<["-"], "fmodules-strict-context-hash">, HelpText<"Enable hashing of all compiler options that could impact the " "semantics of a module in an implicit build">, diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp --- a/clang/lib/Frontend/CompilerInvocation.cpp +++ b/clang/lib/Frontend/CompilerInvocation.cpp @@ -2185,10 +2185,6 @@ static void ParseHeaderSearchArgs(HeaderSearchOptions &Opts, ArgList &Args, const std::string &WorkingDir) { Opts.Sysroot = std::string(Args.getLastArgValue(OPT_isysroot, "/")); - Opts.Verbose = Args.hasArg(OPT_v); - Opts.UseBuiltinIncludes = !Args.hasArg(OPT_nobuiltininc); - Opts.UseStandardSystemIncludes = !Args.hasArg(OPT_nostdsysteminc); - Opts.UseStandardCXXIncludes = !Args.hasArg(OPT_nostdincxx); if (const Arg *A = Args.getLastArg(OPT_stdlib_EQ)) Opts.UseLibcxx = (strcmp(A->getValue(), "libc++") == 0); Opts.ResourceDir = std::string(Args.getLastArgValue(OPT_resource_dir)); @@ -2217,26 +2213,12 @@ } for (const auto *A : Args.filtered(OPT_fprebuilt_module_path)) Opts.AddPrebuiltModulePath(A->getValue()); - Opts.DisableModuleHash = Args.hasArg(OPT_fdisable_module_hash); - Opts.ModulesHashContent = Args.hasArg(OPT_fmodules_hash_content); - Opts.ModulesValidateDiagnosticOptions = - !Args.hasArg(OPT_fmodules_disable_diagnostic_validation); - Opts.ImplicitModuleMaps = Args.hasArg(OPT_fimplicit_module_maps); - Opts.ModuleMapFileHomeIsCwd = Args.hasArg(OPT_fmodule_map_file_home_is_cwd); - Opts.EnablePrebuiltImplicitModules = - Args.hasArg(OPT_fprebuilt_implicit_modules); Opts.ModuleCachePruneInterval = getLastArgIntValue(Args, OPT_fmodules_prune_interval, 7 * 24 * 60 * 60); Opts.ModuleCachePruneAfter = getLastArgIntValue(Args, OPT_fmodules_prune_after, 31 * 24 * 60 * 60); - Opts.ModulesValidateOncePerBuildSession = - Args.hasArg(OPT_fmodules_validate_once_per_build_session); Opts.BuildSessionTimestamp = getLastArgUInt64Value(Args, OPT_fbuild_session_timestamp, 0); - Opts.ModulesValidateSystemHeaders = - Args.hasArg(OPT_fmodules_validate_system_headers); - Opts.ValidateASTInputFilesContent = - Args.hasArg(OPT_fvalidate_ast_input_files_content); if (const Arg *A = Args.getLastArg(OPT_fmodule_format_EQ)) Opts.ModuleFormat = A->getValue();