diff --git a/clang/include/clang/Basic/LangOptions.h b/clang/include/clang/Basic/LangOptions.h --- a/clang/include/clang/Basic/LangOptions.h +++ b/clang/include/clang/Basic/LangOptions.h @@ -30,6 +30,8 @@ /// Bitfields of LangOptions, split out from LangOptions in order to ensure that /// this large collection of bitfields is a trivial class type. class LangOptionsBase { + friend class CompilerInvocation; + public: // Define simple language options (with no accessors). #define LANGOPT(Name, Bits, Default, Description) unsigned Name : Bits; 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 @@ -723,7 +723,8 @@ defm cuda_approx_transcendentals : OptInFFlag<"cuda-approx-transcendentals", "Use", "Don't use", " approximate transcendental functions">; defm gpu_rdc : OptInFFlag<"gpu-rdc", - "Generate relocatable device code, also known as separate compilation mode", "", "">; + "Generate relocatable device code, also known as separate compilation mode", "", "", + [], "LangOpts->GPURelocatableDeviceCode">; def : Flag<["-"], "fcuda-rdc">, Alias; def : Flag<["-"], "fno-cuda-rdc">, Alias; defm cuda_short_ptr : OptInFFlag<"cuda-short-ptr", @@ -740,12 +741,12 @@ def fhip_dump_offload_linker_script : Flag<["-"], "fhip-dump-offload-linker-script">, Group, Flags<[NoArgumentUnused, HelpHidden]>; defm hip_new_launch_api : OptInFFlag<"hip-new-launch-api", - "Use", "Don't use", " new kernel launching API for HIP">; + "Use", "Don't use", " new kernel launching API for HIP", [], "LangOpts->HIPUseNewLaunchAPI">; defm gpu_allow_device_init : OptInFFlag<"gpu-allow-device-init", "Allow", "Don't allow", " device side init function in HIP">; defm gpu_defer_diag : OptInFFlag<"gpu-defer-diag", - "Defer", "Don't defer", " host/device related diagnostic messages" - " for CUDA/HIP">; + "Defer", "Don't defer", " host/device related diagnostic messages for CUDA/HIP", + [], "LangOpts->GPUDeferDiag">; def gpu_max_threads_per_block_EQ : Joined<["--"], "gpu-max-threads-per-block=">, Flags<[CC1Option]>, HelpText<"Default max threads per block for kernel launch bounds for HIP">; @@ -798,16 +799,19 @@ def fno_PIC : Flag<["-"], "fno-PIC">, Group; def fPIE : Flag<["-"], "fPIE">, Group; def fno_PIE : Flag<["-"], "fno-PIE">, Group; -defm access_control : OptOutFFlag<"no-access-control", "", "Disable C++ access control">; +defm access_control : OptOutPositiveFFlag<"no-access-control", "", "Disable C++ access control", "", + [], "LangOpts->AccessControl">; def falign_functions : Flag<["-"], "falign-functions">, Group; def falign_functions_EQ : Joined<["-"], "falign-functions=">, Group; def fno_align_functions: Flag<["-"], "fno-align-functions">, Group; -defm allow_editor_placeholders : OptInFFlag<"allow-editor-placeholders", "Treat editor placeholders as valid source code">; +defm allow_editor_placeholders : OptInFFlag<"allow-editor-placeholders", "Treat editor placeholders as valid source code", + "", "", [], "LangOpts->AllowEditorPlaceholders">; def fallow_unsupported : Flag<["-"], "fallow-unsupported">, Group; def fapple_kext : Flag<["-"], "fapple-kext">, Group, Flags<[CC1Option]>, - HelpText<"Use Apple's kernel extensions ABI">; -def fapple_pragma_pack : Flag<["-"], "fapple-pragma-pack">, Group, Flags<[CC1Option]>, - HelpText<"Enable Apple gcc-compatible #pragma pack handling">; + HelpText<"Use Apple's kernel extensions ABI">, + MarshallingInfoFlag<"LangOpts->AppleKext">; +defm apple_pragma_pack : OptInFFlag<"apple-pragma-pack", "Enable Apple gcc-compatible #pragma pack handling", "", "", + [], "LangOpts->ApplePragmaPack">; def shared_libsan : Flag<["-"], "shared-libsan">, HelpText<"Dynamically link the sanitizer runtime">; def static_libsan : Flag<["-"], "static-libsan">, @@ -845,7 +849,8 @@ def fembed_bitcode_marker : Flag<["-"], "fembed-bitcode-marker">, Alias, AliasArgs<["marker"]>, HelpText<"Embed placeholder LLVM IR data as a marker">; -defm gnu_inline_asm : OptOutFFlag<"gnu-inline-asm", "", "Disable GNU style inline asm">; +defm gnu_inline_asm : OptOutPositiveFFlag<"gnu-inline-asm", "", "Disable GNU style inline asm", "", + [], "LangOpts->GNUAsm">; def fprofile_sample_use : Flag<["-"], "fprofile-sample-use">, Group, Flags<[CoreOption]>; @@ -946,8 +951,9 @@ defm addrsig : OptInFFlag<"addrsig", "Emit", "Don't emit", " an address-significance table", [CoreOption], "CodeGenOpts.Addrsig">; defm blocks : OptInFFlag<"blocks", "Enable the 'blocks' language feature", "", "", [CoreOption]>; def fbootclasspath_EQ : Joined<["-"], "fbootclasspath=">, Group; -def fborland_extensions : Flag<["-"], "fborland-extensions">, Group, Flags<[CC1Option]>, - HelpText<"Accept non-standard constructs supported by the Borland compiler">; +defm borland_extensions : OptInFFlag<"borland-extensions", + "Accept non-standard constructs supported by the Borland compiler", "", "", + [], "LangOpts->Borland">; def fbuiltin : Flag<["-"], "fbuiltin">, Group, Flags<[CoreOption]>; def fbuiltin_module_map : Flag <["-"], "fbuiltin-module-map">, Group, Flags<[NoXarchOption]>, HelpText<"Load the clang builtins module map file.">; @@ -979,27 +985,32 @@ Flags<[CoreOption, CC1Option]>, HelpText<"Place uninitialized global variables in a common block">, MarshallingInfoFlag<"CodeGenOpts.NoCommon", "true">, IsNegative; def fcompile_resource_EQ : Joined<["-"], "fcompile-resource=">, Group; +// todo: simplify these into a version of OptInFFlag that does not add Group def fcomplete_member_pointers : Flag<["-"], "fcomplete-member-pointers">, Group, Flags<[CoreOption, CC1Option]>, - HelpText<"Require member pointer base types to be complete if they would be significant under the Microsoft ABI">; + HelpText<"Require member pointer base types to be complete if they would be significant under the Microsoft ABI">, + MarshallingInfoFlag<"LangOpts->CompleteMemberPointers">; def fno_complete_member_pointers : Flag<["-"], "fno-complete-member-pointers">, Group, Flags<[CoreOption]>, HelpText<"Do not require member pointer base types to be complete if they would be significant under the Microsoft ABI">; def fcf_runtime_abi_EQ : Joined<["-"], "fcf-runtime-abi=">, Group, Flags<[CC1Option]>; -def fconstant_cfstrings : Flag<["-"], "fconstant-cfstrings">, Group; +defm constant_cfstrings : OptOutFFlag<"constant-cfstrings", + "", "", "Disable creation of CodeFoundation-type constant strings", + [], "LangOpts->NoConstantCFStrings">; def fconstant_string_class_EQ : Joined<["-"], "fconstant-string-class=">, Group; def fconstexpr_depth_EQ : Joined<["-"], "fconstexpr-depth=">, Group; def fconstexpr_steps_EQ : Joined<["-"], "fconstexpr-steps=">, Group; def fexperimental_new_constant_interpreter : Flag<["-"], "fexperimental-new-constant-interpreter">, Group, - HelpText<"Enable the experimental new constant interpreter">, Flags<[CC1Option]>; + HelpText<"Enable the experimental new constant interpreter">, Flags<[CC1Option]>, + MarshallingInfoFlag<"LangOpts->EnableNewConstInterp">; def fconstexpr_backtrace_limit_EQ : Joined<["-"], "fconstexpr-backtrace-limit=">, Group; def fno_crash_diagnostics : Flag<["-"], "fno-crash-diagnostics">, Group, Flags<[NoArgumentUnused, CoreOption]>, HelpText<"Disable auto-generation of preprocessed source files and a script for reproduction during a clang crash">; def fcrash_diagnostics_dir : Joined<["-"], "fcrash-diagnostics-dir=">, Group, Flags<[NoArgumentUnused, CoreOption]>; def fcreate_profile : Flag<["-"], "fcreate-profile">, Group; -defm cxx_exceptions: OptInFFlag<"cxx-exceptions", "Enable C++ exceptions">; +defm cxx_exceptions: OptInFFlag<"cxx-exceptions", "Enable C++ exceptions", "", "", [], "LangOpts->CXXExceptions">; def fcxx_modules : Flag <["-"], "fcxx-modules">, Group, Flags<[NoXarchOption]>; def fdebug_pass_arguments : Flag<["-"], "fdebug-pass-arguments">, Group; @@ -1037,7 +1048,8 @@ def fdwarf2_cfi_asm : Flag<["-"], "fdwarf2-cfi-asm">, Group; def fno_dwarf2_cfi_asm : Flag<["-"], "fno-dwarf2-cfi-asm">, Group; defm dwarf_directory_asm : OptOutFFlag<"dwarf-directory-asm", "", "", "", [], "CodeGenOpts.NoDwarfDirectoryAsm">; -def felide_constructors : Flag<["-"], "felide-constructors">, Group; +defm elide_constructors : OptOutPositiveFFlag<"elide-constructors", "", "Disable C++ copy constructor elision", "", + [], "LangOpts->ElideConstructors">; def fno_elide_type : Flag<["-"], "fno-elide-type">, Group, Flags<[CC1Option]>, HelpText<"Do not elide types when printing diagnostics">; @@ -1045,23 +1057,30 @@ defm eliminate_unused_debug_types : OptOutFFlag<"eliminate-unused-debug-types", "Do not emit ", "Emit ", " debug info for defined but unused types">; def femit_all_decls : Flag<["-"], "femit-all-decls">, Group, Flags<[CC1Option]>, - HelpText<"Emit all declarations, even if unused">; + HelpText<"Emit all declarations, even if unused">, + MarshallingInfoFlag<"LangOpts->EmitAllDecls">; def femulated_tls : Flag<["-"], "femulated-tls">, Group, Flags<[CC1Option]>, HelpText<"Use emutls functions to access thread_local variables">; def fno_emulated_tls : Flag<["-"], "fno-emulated-tls">, Group, Flags<[CC1Option]>; def fencoding_EQ : Joined<["-"], "fencoding=">, Group; def ferror_limit_EQ : Joined<["-"], "ferror-limit=">, Group, Flags<[CoreOption]>; -defm exceptions : OptInFFlag<"exceptions", "Enable", "Disable", " support for exception handling">; +defm exceptions : OptInFFlag<"exceptions", "Enable", "Disable", " support for exception handling", + [], "LangOpts->Exceptions">; def fdwarf_exceptions : Flag<["-"], "fdwarf-exceptions">, Group, - Flags<[CC1Option]>, HelpText<"Use DWARF style exceptions">; + Flags<[CC1Option]>, HelpText<"Use DWARF style exceptions">, + MarshallingInfoFlag<"LangOpts->DWARFExceptions">; def fsjlj_exceptions : Flag<["-"], "fsjlj-exceptions">, Group, - Flags<[CC1Option]>, HelpText<"Use SjLj style exceptions">; + Flags<[CC1Option]>, HelpText<"Use SjLj style exceptions">, + MarshallingInfoFlag<"LangOpts->SjLjExceptions">; def fseh_exceptions : Flag<["-"], "fseh-exceptions">, Group, - Flags<[CC1Option]>, HelpText<"Use SEH style exceptions">; + Flags<[CC1Option]>, HelpText<"Use SEH style exceptions">, + MarshallingInfoFlag<"LangOpts->SEHExceptions">; def fwasm_exceptions : Flag<["-"], "fwasm-exceptions">, Group, - Flags<[CC1Option]>, HelpText<"Use WebAssembly style exceptions">; + Flags<[CC1Option]>, HelpText<"Use WebAssembly style exceptions">, + MarshallingInfoFlag<"LangOpts->WasmExceptions">; def fignore_exceptions : Flag<["-"], "fignore-exceptions">, Group, Flags<[CC1Option]>, - HelpText<"Enable support for ignoring exception handling constructs">; + HelpText<"Enable support for ignoring exception handling constructs">, + MarshallingInfoFlag<"LangOpts->IgnoreExceptions">; def fexcess_precision_EQ : Joined<["-"], "fexcess-precision=">, Group; def : Flag<["-"], "fexpensive-optimizations">, Group; @@ -1091,8 +1110,8 @@ defm force_enable_int128 : OptInFFlag<"force-enable-int128", "Enable", "Disable", " support for int128_t type">; defm keep_static_consts : OptInFFlag<"keep-static-consts", "Keep", "Don't keep", " static const variables if unused", [NoXarchOption], "CodeGenOpts.KeepStaticConsts">; defm fixed_point : OptInFFlag<"fixed-point", "Enable", "Disable", " fixed point types">; -defm cxx_static_destructors : OptOutFFlag<"c++-static-destructors", "", - "Disable C++ static destructor registration">; +defm cxx_static_destructors : OptOutPositiveFFlag<"c++-static-destructors", "", + "Disable C++ static destructor registration", "", [], "LangOpts->RegisterStaticDestructors">; def fsymbol_partition_EQ : Joined<["-"], "fsymbol-partition=">, Group, Flags<[CC1Option]>; @@ -1314,7 +1333,9 @@ // This option was originally misspelt "infinites" [sic]. def : Flag<["-"], "fhonor-infinites">, Alias; def : Flag<["-"], "fno-honor-infinites">, Alias; -def frounding_math : Flag<["-"], "frounding-math">, Group, Flags<[CC1Option]>; +def frounding_math : Flag<["-"], "frounding-math">, Group, Flags<[CC1Option]>, + MarshallingInfoFlag<"LangOpts->FPRoundingMode", "llvm::RoundingMode::NearestTiesToEven">, + Normalizer<"makeFlagToValueNormalizer(llvm::RoundingMode::Dynamic)">; def fno_rounding_math : Flag<["-"], "fno-rounding-math">, Group, Flags<[CC1Option]>; def ftrapping_math : Flag<["-"], "ftrapping-math">, Group, Flags<[CC1Option]>; def fno_trapping_math : Flag<["-"], "fno-trapping-math">, Group, Flags<[CC1Option]>; @@ -1349,7 +1370,8 @@ defm use_line_directives : OptInFFlag<"use-line-directives", "Use #line in preprocessed output">; def ffreestanding : Flag<["-"], "ffreestanding">, Group, Flags<[CC1Option]>, - HelpText<"Assert that the compilation takes place in a freestanding environment">; + HelpText<"Assert that the compilation takes place in a freestanding environment">, + MarshallingInfoFlag<"LangOpts->Freestanding">; def fgnuc_version_EQ : Joined<["-"], "fgnuc-version=">, Group, HelpText<"Sets various macros to claim compatibility with the given GCC version (default is 4.2.1)">, Flags<[CC1Option, CoreOption]>; @@ -1358,7 +1380,8 @@ defm gnu89_inline : OptInFFlag<"gnu89-inline", "Use the gnu89 inline semantics">; def fgnu_runtime : Flag<["-"], "fgnu-runtime">, Group, HelpText<"Generate output compatible with the standard GNU Objective-C runtime">; -def fheinous_gnu_extensions : Flag<["-"], "fheinous-gnu-extensions">, Flags<[CC1Option]>; +def fheinous_gnu_extensions : Flag<["-"], "fheinous-gnu-extensions">, Flags<[CC1Option]>, + MarshallingInfoFlag<"LangOpts->HeinousExtensions">; def filelist : Separate<["-"], "filelist">, Flags<[LinkerInput]>, Group; def : Flag<["-"], "findirect-virtual-calls">, Alias; @@ -1460,12 +1483,9 @@ "Use separate accesses for consecutive bitfield runs with legal widths and alignments.", "Use large-integer access for consecutive bitfield runs.">, Group, Flags<[CC1Option]>; -def fexperimental_relative_cxx_abi_vtables : Flag<["-"], "fexperimental-relative-c++-abi-vtables">, - Group, Flags<[CC1Option]>, - HelpText<"Use the experimental C++ class ABI for classes with virtual tables">; -def fno_experimental_relative_cxx_abi_vtables : Flag<["-"], "fno-experimental-relative-c++-abi-vtables">, - Group, Flags<[CC1Option]>, - HelpText<"Do not use the experimental C++ class ABI for classes with virtual tables">; +defm experimental_relative_cxx_abi_vtables : OptInFFlag<"experimental-relative-c++-abi-vtables", + "Use", "Do not use", " the experimental C++ class ABI for classes with virtual tables", + [CC1Option], "LangOpts->RelativeCXXABIVTables">; def flat__namespace : Flag<["-"], "flat_namespace">; def flax_vector_conversions_EQ : Joined<["-"], "flax-vector-conversions=">, Group, @@ -1505,7 +1525,8 @@ def fms_extensions : Flag<["-"], "fms-extensions">, Group, Flags<[CC1Option, CoreOption]>, HelpText<"Accept some non-standard constructs supported by the Microsoft compiler">; def fms_compatibility : Flag<["-"], "fms-compatibility">, Group, Flags<[CC1Option, CoreOption]>, - HelpText<"Enable full Microsoft Visual C++ compatibility">; + HelpText<"Enable full Microsoft Visual C++ compatibility">, + MarshallingInfoFlag<"LangOpts->MSVCCompat">; def fms_volatile : Flag<["-"], "fms-volatile">, Group, Flags<[CC1Option]>, MarshallingInfoFlag<"CodeGenOpts.MSVolatile">; def fmsc_version : Joined<["-"], "fmsc-version=">, Group, Flags<[NoXarchOption, CoreOption]>, @@ -1517,9 +1538,14 @@ HelpText<"Dot-separated value representing the Microsoft compiler " "version number to report in _MSC_VER (0 = don't define it " "(default))">; +// todo: convert this into OptInFFlag that does not imply Flags def fdelayed_template_parsing : Flag<["-"], "fdelayed-template-parsing">, Group, HelpText<"Parse templated function definitions at the end of the " - "translation unit">, Flags<[CC1Option, CoreOption]>; + "translation unit">, Flags<[CC1Option, CoreOption]>, + MarshallingInfoFlag<"LangOpts->DelayedTemplateParsing">; +def fno_delayed_template_parsing : Flag<["-"], "fno-delayed-template-parsing">, Group, + HelpText<"Disable delayed template parsing">, + Flags<[NoXarchOption, CoreOption]>; def fms_memptr_rep_EQ : Joined<["-"], "fms-memptr-rep=">, Group, Flags<[CC1Option]>; def fmodules_cache_path : Joined<["-"], "fmodules-cache-path=">, Group, Flags<[NoXarchOption, CC1Option]>, MetaVarName<"">, @@ -1583,13 +1609,9 @@ def fno_pch_validate_input_files_content: Flag <["-"], "fno_pch-validate-input-files-content">, Group, Flags<[NoXarchOption]>; -def fpch_instantiate_templates: - Flag <["-"], "fpch-instantiate-templates">, - Group, Flags<[CC1Option, CoreOption]>, - HelpText<"Instantiate templates already while building a PCH">; -def fno_pch_instantiate_templates: - Flag <["-"], "fno-pch-instantiate-templates">, - Group, Flags<[CC1Option, CoreOption]>; +defm pch_instantiate_templates : OptInFFlag<"pch-instantiate-templates", + "Instantiate templates already while building a PCH", "", "", + [CC1Option, CoreOption], "LangOpts->PCHInstantiateTemplates">; defm pch_codegen: OptInFFlag<"pch-codegen", "Generate ", "Do not generate ", "code for uses of this PCH that assumes an explicit object file will be built for the PCH">; defm pch_debuginfo: OptInFFlag<"pch-debuginfo", "Generate ", "Do not generate ", @@ -1602,7 +1624,8 @@ Flags<[NoXarchOption, CC1Option]>, HelpText<"Implicitly search the file system for module map files.">; def fmodules_ts : Flag <["-"], "fmodules-ts">, Group, - Flags<[CC1Option]>, HelpText<"Enable support for the C++ Modules TS">; + Flags<[CC1Option]>, HelpText<"Enable support for the C++ Modules TS">, + MarshallingInfoFlag<"LangOpts->ModulesTS">; def fmodule_maps : Flag <["-"], "fmodule-maps">, Alias; def fmodule_name_EQ : Joined<["-"], "fmodule-name=">, Group, Flags<[NoXarchOption,CC1Option]>, MetaVarName<"">, @@ -1626,25 +1649,24 @@ HelpText<"Require declaration of modules used within a module">; def fmodules_strict_decluse : Flag <["-"], "fmodules-strict-decluse">, Group, Flags<[NoXarchOption,CC1Option]>, - HelpText<"Like -fmodules-decluse but requires all headers to be in modules">; + HelpText<"Like -fmodules-decluse but requires all headers to be in modules">, + MarshallingInfoFlag<"LangOpts->ModulesStrictDeclUse">; def fno_modules_search_all : Flag <["-"], "fno-modules-search-all">, Group, Flags<[NoXarchOption, CC1Option]>; -def fno_implicit_modules : - Flag <["-"], "fno-implicit-modules">, - Group, Flags<[NoXarchOption, CC1Option]>; -def fretain_comments_from_system_headers : Flag<["-"], "fretain-comments-from-system-headers">, Group, Flags<[CC1Option]>; +defm implicit_modules : OptOutPositiveFFlag<"implicit-modules", "", "", "", + [NoXarchOption], "LangOpts->ImplicitModules">; +def fretain_comments_from_system_headers : Flag<["-"], "fretain-comments-from-system-headers">, Group, Flags<[CC1Option]>, + MarshallingInfoFlag<"LangOpts->RetainCommentsFromSystemHeaders">; def fmudflapth : Flag<["-"], "fmudflapth">, Group; def fmudflap : Flag<["-"], "fmudflap">, Group; def fnested_functions : Flag<["-"], "fnested-functions">, Group; def fnext_runtime : Flag<["-"], "fnext-runtime">, Group; -def fno_apple_pragma_pack : Flag<["-"], "fno-apple-pragma-pack">, Group; def fno_asm : Flag<["-"], "fno-asm">, Group; def fno_asynchronous_unwind_tables : Flag<["-"], "fno-asynchronous-unwind-tables">, Group; def fno_assume_sane_operator_new : Flag<["-"], "fno-assume-sane-operator-new">, Group, HelpText<"Don't assume that C++'s global operator new can't alias any pointer">, Flags<[CC1Option]>, MarshallingInfoFlag<"CodeGenOpts.AssumeSaneOperatorNew", "true">, IsNegative; -def fno_borland_extensions : Flag<["-"], "fno-borland-extensions">, Group; def fno_builtin : Flag<["-"], "fno-builtin">, Group, Flags<[CC1Option, CoreOption]>, HelpText<"Disable implicit builtin knowledge of functions">; def fno_builtin_ : Joined<["-"], "fno-builtin-">, Group, Flags<[CC1Option, CoreOption]>, @@ -1653,9 +1675,6 @@ Flags<[CoreOption, NoXarchOption]>; def fno_common : Flag<["-"], "fno-common">, Group, Flags<[CC1Option]>, HelpText<"Compile common globals like normal definitions">; -def fno_constant_cfstrings : Flag<["-"], "fno-constant-cfstrings">, Group, - Flags<[CC1Option]>, - HelpText<"Disable creation of CodeFoundation-type constant strings">; def fno_cxx_modules : Flag <["-"], "fno-cxx-modules">, Group, Flags<[NoXarchOption]>; def fno_diagnostics_fixit_info : Flag<["-"], "fno-diagnostics-fixit-info">, Group, @@ -1671,8 +1690,6 @@ HelpText<"Disallow __declspec as a keyword">, Flags<[CC1Option]>; def fno_dollars_in_identifiers : Flag<["-"], "fno-dollars-in-identifiers">, Group, HelpText<"Disallow '$' in identifiers">, Flags<[CC1Option]>; -def fno_elide_constructors : Flag<["-"], "fno-elide-constructors">, Group, - HelpText<"Disable C++ copy constructor elision">, Flags<[CC1Option]>; def fno_eliminate_unused_debug_symbols : Flag<["-"], "fno-eliminate-unused-debug-symbols">, Group; def fno_gnu_keywords : Flag<["-"], "fno-gnu-keywords">, Group, Flags<[CC1Option]>; def fno_inline_functions : Flag<["-"], "fno-inline-functions">, Group, Flags<[CC1Option]>; @@ -1694,8 +1711,6 @@ Flags<[NoXarchOption]>; def fno_modules_strict_decluse : Flag <["-"], "fno-strict-modules-decluse">, Group, Flags<[NoXarchOption]>; -def fimplicit_modules : Flag <["-"], "fimplicit-modules">, Group, - Flags<[NoXarchOption]>; def fmodule_file_deps : Flag <["-"], "fmodule-file-deps">, Group, Flags<[NoXarchOption]>; def fno_module_file_deps : Flag <["-"], "fno-module-file-deps">, Group, @@ -1704,24 +1719,16 @@ Flags<[CoreOption]>; def fno_ms_compatibility : Flag<["-"], "fno-ms-compatibility">, Group, Flags<[CoreOption]>; -def fno_delayed_template_parsing : Flag<["-"], "fno-delayed-template-parsing">, Group, - HelpText<"Disable delayed template parsing">, - Flags<[NoXarchOption, CoreOption]>; -def fno_objc_exceptions: Flag<["-"], "fno-objc-exceptions">, Group; def fno_objc_legacy_dispatch : Flag<["-"], "fno-objc-legacy-dispatch">, Group; def fno_objc_weak : Flag<["-"], "fno-objc-weak">, Group, Flags<[CC1Option]>; def fno_omit_frame_pointer : Flag<["-"], "fno-omit-frame-pointer">, Group; def fno_operator_names : Flag<["-"], "fno-operator-names">, Group, HelpText<"Do not treat C++ operator name keywords as synonyms for operators">, Flags<[CC1Option]>; -def fno_pascal_strings : Flag<["-"], "fno-pascal-strings">, Group; -def fno_short_enums : Flag<["-"], "fno-short-enums">, Group; def fno_show_source_location : Flag<["-"], "fno-show-source-location">, Group, Flags<[CC1Option]>, HelpText<"Do not include source location information with diagnostics">; def fdiagnostics_absolute_paths : Flag<["-"], "fdiagnostics-absolute-paths">, Group, Flags<[CC1Option, CoreOption]>, HelpText<"Print absolute paths in diagnostics">; -def fno_spell_checking : Flag<["-"], "fno-spell-checking">, Group, - Flags<[CC1Option]>, HelpText<"Disable spell-checking">; def fno_stack_protector : Flag<["-"], "fno-stack-protector">, Group, HelpText<"Disable the use of stack protectors">; def fno_strict_aliasing : Flag<["-"], "fno-strict-aliasing">, Group, @@ -1734,8 +1741,6 @@ Flags<[CC1Option, CoreOption]>, HelpText< "Directly create compilation output files. This may lead to incorrect incremental builds if the compiler crashes">, MarshallingInfoFlag<"FrontendOpts.UseTemporary", "true">, IsNegative; -def fno_threadsafe_statics : Flag<["-"], "fno-threadsafe-statics">, Group, - Flags<[CC1Option]>, HelpText<"Do not emit code to make initialization of local statics thread safe">; defm use_cxa_atexit : OptOutPositiveFFlag<"use-cxa-atexit", "", "Don't use __cxa_atexit for calling destructors", "", [], "CodeGenOpts.CXAAtExit">; def fno_unit_at_a_time : Flag<["-"], "fno-unit-at-a-time">, Group; @@ -1744,9 +1749,8 @@ MarshallingInfoFlag<"CodeGenOpts.AsmVerbose", "true">, IsNegative; def fno_working_directory : Flag<["-"], "fno-working-directory">, Group; def fno_wrapv : Flag<["-"], "fno-wrapv">, Group; -def fobjc_arc : Flag<["-"], "fobjc-arc">, Group, Flags<[CC1Option]>, - HelpText<"Synthesize retain and release calls for Objective-C pointers">; -def fno_objc_arc : Flag<["-"], "fno-objc-arc">, Group; +defm objc_arc : OptInFFlag<"objc-arc", "Synthesize retain and release calls for Objective-C pointers", "", "", + [], "LangOpts->ObjCAutoRefCount">; defm objc_convert_messages_to_runtime_calls : OptOutPositiveFFlag<"objc-convert-messages-to-runtime-calls", "", "", "", [], "CodeGenOpts.ObjCConvertMessagesToRuntimeCalls">; defm objc_arc_exceptions : OptInFFlag<"objc-arc-exceptions", @@ -1754,21 +1758,13 @@ "", "", [], "CodeGenOpts.ObjCAutoRefCountExceptions">; def fobjc_atdefs : Flag<["-"], "fobjc-atdefs">, Group; def fobjc_call_cxx_cdtors : Flag<["-"], "fobjc-call-cxx-cdtors">, Group; -def fobjc_exceptions: Flag<["-"], "fobjc-exceptions">, Group, - HelpText<"Enable Objective-C exceptions">, Flags<[CC1Option]>; -def fapplication_extension : Flag<["-"], "fapplication-extension">, - Group, Flags<[CC1Option]>, - HelpText<"Restrict code to those available for App Extensions">; -def fno_application_extension : Flag<["-"], "fno-application-extension">, - Group; -def frelaxed_template_template_args : Flag<["-"], "frelaxed-template-template-args">, - Flags<[CC1Option]>, HelpText<"Enable C++17 relaxed template template argument matching">, - Group; -def fno_relaxed_template_template_args : Flag<["-"], "fno-relaxed-template-template-args">, - Group; -def fsized_deallocation : Flag<["-"], "fsized-deallocation">, Flags<[CC1Option]>, - HelpText<"Enable C++14 sized global deallocation functions">, Group; -def fno_sized_deallocation: Flag<["-"], "fno-sized-deallocation">, Group; +defm objc_exceptions : OptInFFlag<"objc-exceptions", "Enable Objective-C exceptions", "", "", [], "LangOpts->ObjCExceptions">; +defm application_extension : OptInFFlag<"application-extension", + "Restrict code to those available for App Extensions", "", "", [], "LangOpts->AppExt">; +defm relaxed_template_template_args : OptInFFlag<"relaxed-template-template-args", + "Enable C++17 relaxed template template argument matching", "", "", [], "LangOpts->RelaxedTemplateTemplateArgs">; +defm sized_deallocation : OptInFFlag<"sized-deallocation", + "Enable C++14 sized global deallocation functions", "", "", [], "LangOpts->SizedDeallocation">; def faligned_allocation : Flag<["-"], "faligned-allocation">, Flags<[CC1Option]>, HelpText<"Enable C++17 aligned allocation functions">, Group; def fno_aligned_allocation: Flag<["-"], "fno-aligned-allocation">, @@ -1783,13 +1779,8 @@ def fobjc_legacy_dispatch : Flag<["-"], "fobjc-legacy-dispatch">, Group; def fobjc_new_property : Flag<["-"], "fobjc-new-property">, Group; -def fobjc_infer_related_result_type : Flag<["-"], "fobjc-infer-related-result-type">, - Group; -def fno_objc_infer_related_result_type : Flag<["-"], - "fno-objc-infer-related-result-type">, Group, - HelpText< - "do not infer Objective-C related result type based on method family">, - Flags<[CC1Option]>; +defm objc_infer_related_result_type : OptOutPositiveFFlag<"objc-infer-related-result-type", + "", "do not infer Objective-C related result type based on method family", "", [], "LangOpts->ObjCInferRelatedResultType">; def fobjc_link_runtime: Flag<["-"], "fobjc-link-runtime">, Group; def fobjc_weak : Flag<["-"], "fobjc-weak">, Group, Flags<[CC1Option]>, HelpText<"Enable ARC-style weak references in Objective-C">; @@ -1805,7 +1796,8 @@ def fobjc_sender_dependent_dispatch : Flag<["-"], "fobjc-sender-dependent-dispatch">, Group; def fomit_frame_pointer : Flag<["-"], "fomit-frame-pointer">, Group; def fopenmp : Flag<["-"], "fopenmp">, Group, Flags<[CC1Option, NoArgumentUnused]>, - HelpText<"Parse OpenMP pragmas and generate parallel code.">; + HelpText<"Parse OpenMP pragmas and generate parallel code.">, + MarshallingInfoFlag<"LangOpts->OpenMP", "0u">, Normalizer<"makeFlagToValueNormalizer(50u)">; def fno_openmp : Flag<["-"], "fno-openmp">, Group, Flags<[NoArgumentUnused]>; def fopenmp_version_EQ : Joined<["-"], "fopenmp-version=">, Group, Flags<[CC1Option, NoArgumentUnused]>; def fopenmp_EQ : Joined<["-"], "fopenmp=">, Group; @@ -1838,10 +1830,8 @@ Flags<[CC1Option, NoArgumentUnused, HelpHidden]>; def fopenmp_cuda_teams_reduction_recs_num_EQ : Joined<["-"], "fopenmp-cuda-teams-reduction-recs-num=">, Group, Flags<[CC1Option, NoArgumentUnused, HelpHidden]>; -def fopenmp_optimistic_collapse : Flag<["-"], "fopenmp-optimistic-collapse">, Group, - Flags<[CC1Option, NoArgumentUnused, HelpHidden]>; -def fno_openmp_optimistic_collapse : Flag<["-"], "fno-openmp-optimistic-collapse">, Group, - Flags<[NoArgumentUnused, HelpHidden]>; +defm openmp_optimistic_collapse : OptInFFlag<"openmp-optimistic-collapse", "", "", "", + [NoArgumentUnused, HelpHidden], "LangOpts->OpenMPOptimisticCollapse">; def fopenmp_cuda_parallel_target_regions : Flag<["-"], "fopenmp-cuda-parallel-target-regions">, Group, Flags<[CC1Option, NoArgumentUnused, HelpHidden]>, HelpText<"Support parallel execution of target regions on Cuda-based devices.">; @@ -1865,8 +1855,8 @@ def fmax_type_align_EQ : Joined<["-"], "fmax-type-align=">, Group, Flags<[CC1Option]>, HelpText<"Specify the maximum alignment to enforce on pointers lacking an explicit alignment">; def fno_max_type_align : Flag<["-"], "fno-max-type-align">, Group; -def fpascal_strings : Flag<["-"], "fpascal-strings">, Group, Flags<[CC1Option]>, - HelpText<"Recognize and construct Pascal-style string literals">; +defm pascal_strings : OptInFFlag<"pascal-strings", "Recognize and construct Pascal-style string literals", "", "", + [], "LangOpts->PascalStrings">; def fpatchable_function_entry_EQ : Joined<["-"], "fpatchable-function-entry=">, Group, Flags<[CC1Option]>, MetaVarName<"">, HelpText<"Generate M NOPs before function entry and N-M NOPs after function entry">; def fpcc_struct_return : Flag<["-"], "fpcc-struct-return">, Group, Flags<[CC1Option]>, @@ -1878,8 +1868,8 @@ def fno_pie : Flag<["-"], "fno-pie">, Group; defm plt : OptOutFFlag<"plt", "", "Use GOT indirection instead of PLT to make external function calls (x86 only)", "", [], "CodeGenOpts.NoPLT">; -defm ropi : OptInFFlag<"ropi", "Generate read-only position independent code (ARM only)">; -defm rwpi : OptInFFlag<"rwpi", "Generate read-write position independent code (ARM only)">; +defm ropi : OptInFFlag<"ropi", "Generate read-only position independent code (ARM only)", "", "", [], "LangOpts->ROPI">; +defm rwpi : OptInFFlag<"rwpi", "Generate read-write position independent code (ARM only)", "", "", [], "LangOpts->RWPI" >; def fplugin_EQ : Joined<["-"], "fplugin=">, Group, Flags<[NoXarchOption]>, MetaVarName<"">, HelpText<"Load the named plugin (dynamic shared object)">; def fpass_plugin_EQ : Joined<["-"], "fpass-plugin=">, @@ -1898,8 +1888,9 @@ defm rtti : OptOutFFlag<"rtti", "", "Disable generation of rtti information">; defm rtti_data : OptOutFFlag<"rtti-data", "", "Disable generation of RTTI data">; def : Flag<["-"], "fsched-interblock">, Group; -def fshort_enums : Flag<["-"], "fshort-enums">, Group, Flags<[CC1Option]>, - HelpText<"Allocate to an enum type only as many bytes as it needs for the declared range of possible values">; +defm short_enums : OptInFFlag<"short-enums", + "Allocate to an enum type only as many bytes as it needs for the declared range of possible values", "", "", + [], "LangOpts->ShortEnums">; def fchar8__t : Flag<["-"], "fchar8_t">, Group, Flags<[CC1Option]>, HelpText<"Enable C++ builtin type char8_t">; def fno_char8__t : Flag<["-"], "fno-char8_t">, Group, Flags<[CC1Option]>, @@ -1913,7 +1904,7 @@ "best|all; defaults to all">, Values<"best,all">; defm show_column : OptOutFFlag<"show-column", "", "Do not include column number on diagnostics">; def fshow_source_location : Flag<["-"], "fshow-source-location">, Group; -def fspell_checking : Flag<["-"], "fspell-checking">, Group; +defm spell_checking : OptOutPositiveFFlag<"spell-checking", "", "Disable spell-checking", "", [], "LangOpts->SpellChecking">; def fspell_checking_limit_EQ : Joined<["-"], "fspell-checking-limit=">, Group; def fsigned_bitfields : Flag<["-"], "fsigned-bitfields">, Group; defm signed_char : OptOutFFlag<"signed-char", "char is signed", "char is unsigned">; @@ -2015,7 +2006,9 @@ def Wframe_larger_than_EQ : Joined<["-"], "Wframe-larger-than=">, Group, Flags<[NoXarchOption]>; def : Flag<["-"], "fterminated-vtables">, Alias; -def fthreadsafe_statics : Flag<["-"], "fthreadsafe-statics">, Group; +defm threadsafe_statics : OptOutPositiveFFlag<"threadsafe-statics", + "", "Do not emit code to make initialization of local statics thread safe", "", + [], "LangOpts->ThreadsafeStatics">; def ftime_report : Flag<["-"], "ftime-report">, Group, Flags<[CC1Option]>, MarshallingInfoFlag<"FrontendOpts.ShowTimers">; def ftime_trace : Flag<["-"], "ftime-trace">, Group, @@ -2077,23 +2070,18 @@ HelpText<"Set the default symbol visibility for all global declarations">, Values<"hidden,default">; def fvisibility_inlines_hidden : Flag<["-"], "fvisibility-inlines-hidden">, Group, HelpText<"Give inline C++ member functions hidden visibility by default">, - Flags<[CC1Option]>; -def fvisibility_inlines_hidden_static_local_var : - Flag<["-"], "fvisibility-inlines-hidden-static-local-var">, Group, - HelpText<"When -fvisibility-inlines-hidden is enabled, static variables in " - "inline C++ member functions will also be given hidden visibility " - "by default">, - Flags<[CC1Option]>; -def fno_visibility_inlines_hidden_static_local_var : - Flag<["-"], "fno-visibility-inlines-hidden-static-local-var">, Group, - HelpText<"Disables -fvisibility-inlines-hidden-static-local-var " - "(this is the default on non-darwin targets)">, - Flags<[CC1Option]>; + Flags<[CC1Option]>, MarshallingInfoFlag<"LangOpts->InlineVisibilityHidden">; +defm visibility_inlines_hidden_static_local_var : OptInFFlag<"visibility-inlines-hidden-static-local-var", + "Give inline C++ member functions hidden visibility by default", + "When -fvisibility-inlines-hidden is enabled, static variables in inline C++ member functions will also be given " + "hidden visibility by default", "", + [CC1Option], "LangOpts->VisibilityInlinesHiddenStaticLocalVar">; def fvisibility_ms_compat : Flag<["-"], "fvisibility-ms-compat">, Group, HelpText<"Give global types 'default' visibility and global functions and " "variables 'hidden' visibility by default">; def fvisibility_global_new_delete_hidden : Flag<["-"], "fvisibility-global-new-delete-hidden">, Group, - HelpText<"Give global C++ operator new and delete declarations hidden visibility">, Flags<[CC1Option]>; + HelpText<"Give global C++ operator new and delete declarations hidden visibility">, Flags<[CC1Option]>, + MarshallingInfoFlag<"LangOpts->GlobalAllocationFunctionVisibilityHidden">; defm whole_program_vtables : OptInFFlag<"whole-program-vtables", "Enables whole-program vtable optimization. Requires -flto", "", "", [CoreOption], "CodeGenOpts.WholeProgramVTables">; defm split_lto_unit : OptInFFlag<"split-lto-unit", @@ -2107,7 +2095,8 @@ def fwrapv : Flag<["-"], "fwrapv">, Group, Flags<[CC1Option]>, HelpText<"Treat signed integer overflow as two's complement">; def fwritable_strings : Flag<["-"], "fwritable-strings">, Group, Flags<[CC1Option]>, - HelpText<"Store string literals as writable data">; + HelpText<"Store string literals as writable data">, + MarshallingInfoFlag<"LangOpts->WritableStrings">; defm zero_initialized_in_bss : OptOutFFlag<"zero-initialized-in-bss", "", "Don't place zero initialized data in BSS", "", [], "CodeGenOpts.NoZeroInitializedInBSS">; defm function_sections : OptInFFlag<"function-sections", "Place each function in its own section">; @@ -2139,7 +2128,8 @@ def fenable_matrix : Flag<["-"], "fenable-matrix">, Group, Flags<[CC1Option]>, - HelpText<"Enable matrix data type and related builtin functions">; + HelpText<"Enable matrix data type and related builtin functions">, + MarshallingInfoFlag<"LangOpts->MatrixTypes">; def fdebug_types_section: Flag <["-"], "fdebug-types-section">, Group, @@ -2318,7 +2308,8 @@ def m16 : Flag<["-"], "m16">, Group, Flags<[NoXarchOption, CoreOption]>; def m32 : Flag<["-"], "m32">, Group, Flags<[NoXarchOption, CoreOption]>; def mqdsp6_compat : Flag<["-"], "mqdsp6-compat">, Group, Flags<[NoXarchOption,CC1Option]>, - HelpText<"Enable hexagon-qdsp6 backward compatibility">; + HelpText<"Enable hexagon-qdsp6 backward compatibility">, + MarshallingInfoFlag<"LangOpts->HexagonQdsp6Compat">; def m64 : Flag<["-"], "m64">, Group, Flags<[NoXarchOption, CoreOption]>; def mx32 : Flag<["-"], "mx32">, Group, Flags<[NoXarchOption, CoreOption]>; def mabi_EQ : Joined<["-"], "mabi=">, Group; @@ -2391,7 +2382,8 @@ def minline_all_stringops : Flag<["-"], "minline-all-stringops">, Group; def mno_inline_all_stringops : Flag<["-"], "mno-inline-all-stringops">, Group; def malign_double : Flag<["-"], "malign-double">, Group, Flags<[CC1Option]>, - HelpText<"Align doubles to two words in structs (x86 only)">; + HelpText<"Align doubles to two words in structs (x86 only)">, + MarshallingInfoFlag<"LangOpts->AlignDouble">; def mfloat_abi_EQ : Joined<["-"], "mfloat-abi=">, Group, Values<"soft,softfp,hard">; def mfpmath_EQ : Joined<["-"], "mfpmath=">, Group; def mfpu_EQ : Joined<["-"], "mfpu=">, Group; @@ -2415,7 +2407,8 @@ def mmacos_version_min_EQ : Joined<["-"], "mmacos-version-min=">, Group, Alias; def mms_bitfields : Flag<["-"], "mms-bitfields">, Group, Flags<[CC1Option]>, - HelpText<"Set the default structure layout to be compatible with the Microsoft compiler standard">; + HelpText<"Set the default structure layout to be compatible with the Microsoft compiler standard">, + MarshallingInfoFlag<"LangOpts->MSBitfields">; def moutline : Flag<["-"], "moutline">, Group, Flags<[CC1Option]>, HelpText<"Enable function outlining (AArch64 only)">; def mno_outline : Flag<["-"], "mno-outline">, Group, Flags<[CC1Option]>, @@ -2518,7 +2511,8 @@ HelpText<"Disallow converting instructions with negative immediates to their negation or inversion.">; def mcmse : Flag<["-"], "mcmse">, Group, Flags<[NoXarchOption,CC1Option]>, - HelpText<"Allow use of CMSE (Armv8-M Security Extensions)">; + HelpText<"Allow use of CMSE (Armv8-M Security Extensions)">, + MarshallingInfoFlag<"LangOpts->Cmse">; def ForceAAPCSBitfieldLoad : Flag<["-"], "faapcs-bitfield-load">, Group, Flags<[NoXarchOption,CC1Option]>, HelpText<"Follows the AAPCS standard that all volatile bit-field write generates at least one load. (ARM only).">, @@ -2694,7 +2688,7 @@ def mvx : Flag<["-"], "mvx">, Group; def mno_vx : Flag<["-"], "mno-vx">, Group; -defm zvector : OptInFFlag<"zvector", "Enable System z vector language extension">; +defm zvector : OptInFFlag<"zvector", "Enable System z vector language extension", "", "", [], "LangOpts->ZVector">; def mzvector : Flag<["-"], "mzvector">, Alias; def mno_zvector : Flag<["-"], "mno-zvector">, Alias; @@ -2968,7 +2962,8 @@ def print_file_name_EQ : Joined<["-", "--"], "print-file-name=">, HelpText<"Print the full library path of ">, MetaVarName<"">; def print_ivar_layout : Flag<["-"], "print-ivar-layout">, Flags<[CC1Option]>, - HelpText<"Enable Objective-C Ivar layout bitmap print trace">; + HelpText<"Enable Objective-C Ivar layout bitmap print trace">, + MarshallingInfoFlag<"LangOpts->ObjCGCBitmapPrint">; def print_libgcc_file_name : Flag<["-", "--"], "print-libgcc-file-name">, HelpText<"Print the library path for the currently used compiler runtime " "library (\"libgcc.a\" or \"libclang_rt.builtins.*.a\")">; @@ -2990,8 +2985,10 @@ HelpText<"Print the registered targets">; def private__bundle : Flag<["-"], "private_bundle">; def pthreads : Flag<["-"], "pthreads">; +// todo: simplify these into a version of OptInFFlag that doesn't imply `f` name prefix def pthread : Flag<["-"], "pthread">, Flags<[CC1Option]>, - HelpText<"Support POSIX threads in generated code">; + HelpText<"Support POSIX threads in generated code">, + MarshallingInfoFlag<"LangOpts->POSIXThreads">; def no_pthread : Flag<["-"], "no-pthread">, Flags<[CC1Option]>; def p : Flag<["-"], "p">; def pie : Flag<["-"], "pie">, Group; @@ -3096,7 +3093,8 @@ def time : Flag<["-"], "time">, HelpText<"Time individual commands">; def traditional_cpp : Flag<["-", "--"], "traditional-cpp">, Flags<[CC1Option]>, - HelpText<"Enable some traditional CPP emulation">; + HelpText<"Enable some traditional CPP emulation">, + MarshallingInfoFlag<"LangOpts->TraditionalCPP">; def traditional : Flag<["-", "--"], "traditional">; def trigraphs : Flag<["-", "--"], "trigraphs">, Alias, HelpText<"Process trigraph sequences">; @@ -3565,8 +3563,11 @@ defm ipa_cp : BooleanFFlag<"ipa-cp">, Group; defm ivopts : BooleanFFlag<"ivopts">, Group; -def fsemantic_interposition : Flag<["-"], "fsemantic-interposition">, Group, Flags<[CC1Option]>; -def fno_semantic_interposition: Flag<["-"], "fno-semantic-interposition">, Group, Flags<[CC1Option]>; +def fsemantic_interposition : Flag<["-"], "fsemantic-interposition">, Group, Flags<[CC1Option]>, + MarshallingInfoFlag<"LangOpts->SemanticInterposition">; +// An explicit -fno-semantic-interposition infers dso_local. +def fno_semantic_interposition: Flag<["-"], "fno-semantic-interposition">, Group, Flags<[CC1Option]>, + MarshallingInfoFlag<"LangOpts->ExplicitNoSemanticInterposition">; defm non_call_exceptions : BooleanFFlag<"non-call-exceptions">, Group; defm peel_loops : BooleanFFlag<"peel-loops">, Group; defm permissive : BooleanFFlag<"permissive">, Group; @@ -3685,10 +3686,7 @@ defm whole_file : BooleanFFlag<"whole-file">, Group; // C++ SYCL options -def fsycl : Flag<["-"], "fsycl">, Group, Flags<[CC1Option, CoreOption]>, - HelpText<"Enable SYCL kernels compilation for device">; -def fno_sycl : Flag<["-"], "fno-sycl">, Group, Flags<[CoreOption]>, - HelpText<"Disable SYCL kernels compilation for device">; +defm sycl : OptInFFlag<"sycl", "Enable", "Disable", " kernels compilation for device", [CoreOption], "LangOpts->SYCL">; def sycl_std_EQ : Joined<["-"], "sycl-std=">, Group, Flags<[CC1Option, NoArgumentUnused, CoreOption]>, HelpText<"SYCL language standard to compile for.">, Values<"2017, 121, 1.2.1, sycl-1.2.1">; @@ -3940,7 +3938,8 @@ MarshallingInfoString<"CodeGenOpts.RelocationModel", "PIC_">, AutoNormalizeEnum; def fno_math_builtin : Flag<["-"], "fno-math-builtin">, - HelpText<"Disable implicit builtin knowledge of math functions">; + HelpText<"Disable implicit builtin knowledge of math functions">, + MarshallingInfoFlag<"LangOpts->NoMathBuiltin">; def fuse_ctor_homing: Flag<["-"], "fuse-ctor-homing">, HelpText<"Use constructor homing if we are using limited debug info already">; } @@ -3983,7 +3982,8 @@ HelpText<"Don't generate implicit floating point instructions">, MarshallingInfoFlag<"CodeGenOpts.NoImplicitFloat">; def fdump_vtable_layouts : Flag<["-"], "fdump-vtable-layouts">, - HelpText<"Dump the layouts of all vtables that will be emitted in a translation unit">; + HelpText<"Dump the layouts of all vtables that will be emitted in a translation unit">, + MarshallingInfoFlag<"LangOpts->DumpVTableLayouts">; def fmerge_functions : Flag<["-"], "fmerge-functions">, HelpText<"Permit merging of identical functions when optimizing.">, MarshallingInfoFlag<"CodeGenOpts.MergeFunctions">; @@ -4028,7 +4028,8 @@ HelpText<"Allow reassociation transformations for floating-point instructions">, MarshallingInfoFlag<"LangOpts->AllowFPReassoc">, ImpliedByAnyOf<[menable_unsafe_fp_math]>; def mabi_EQ_ieeelongdouble : Flag<["-"], "mabi=ieeelongdouble">, - HelpText<"Use IEEE 754 quadruple-precision for long double">; + HelpText<"Use IEEE 754 quadruple-precision for long double">, + MarshallingInfoFlag<"LangOpts->PPCIEEELongDouble">; def mfloat_abi : Separate<["-"], "mfloat-abi">, HelpText<"The float ABI to use">; def mtp : Separate<["-"], "mtp">, @@ -4149,8 +4150,10 @@ // don't have to parse the parameter twice. def msign_return_address_key_EQ : Joined<["-"], "msign-return-address-key=">, Values<"a_key,b_key">; -def mbranch_target_enforce : Flag<["-"], "mbranch-target-enforce">; -def fno_dllexport_inlines : Flag<["-"], "fno-dllexport-inlines">; +def mbranch_target_enforce : Flag<["-"], "mbranch-target-enforce">, + MarshallingInfoFlag<"LangOpts->BranchTargetEnforcement">; +def fno_dllexport_inlines : Flag<["-"], "fno-dllexport-inlines">, + MarshallingInfoFlag<"LangOpts->DllExportInlines", "true">, IsNegative; def cfguard_no_checks : Flag<["-"], "cfguard-no-checks">, HelpText<"Emit Windows Control Flow Guard tables only (no checks)">, MarshallingInfoFlag<"CodeGenOpts.ControlFlowGuardNoChecks">; @@ -4288,7 +4291,8 @@ HelpText<"Do not automatically generate or update the global module index">, MarshallingInfoFlag<"FrontendOpts.UseGlobalModuleIndex", "true">, IsNegative; def fno_modules_error_recovery : Flag<["-"], "fno-modules-error-recovery">, - HelpText<"Do not automatically import modules for error recovery">; + HelpText<"Do not automatically import modules for error recovery">, + MarshallingInfoFlag<"LangOpts->ModulesErrorRecovery", "true">, IsNegative; 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=">; @@ -4310,11 +4314,13 @@ def fmodules_codegen : Flag<["-"], "fmodules-codegen">, HelpText<"Generate code for uses of this module that assumes an explicit " - "object file will be built for the module">; + "object file will be built for the module">, + MarshallingInfoFlag<"LangOpts->ModulesCodegen">; def fmodules_debuginfo : Flag<["-"], "fmodules-debuginfo">, HelpText<"Generate debug info for types in an object file built from this " - "module and do not generate them elsewhere">; + "module and do not generate them elsewhere">, + MarshallingInfoFlag<"LangOpts->ModulesDebugInfo">; def fmodule_format_EQ : Joined<["-"], "fmodule-format=">, HelpText<"Select the container format for clang modules and PCH. " "Supported options are 'raw' and 'obj'.">; @@ -4326,7 +4332,8 @@ HelpText<"Enable C++ Extensions for Concepts. (deprecated - use -std=c++2a)">; def fno_concept_satisfaction_caching : Flag<["-"], "fno-concept-satisfaction-caching">, - HelpText<"Disable satisfaction caching for C++2a Concepts.">; + HelpText<"Disable satisfaction caching for C++2a Concepts.">, + MarshallingInfoFlag<"LangOpts->ConceptSatisfactionCaching", "true">, IsNegative; def frecovery_ast : Flag<["-"], "frecovery-ast">, HelpText<"Preserve expressions in AST rather than dropping them when " @@ -4442,7 +4449,8 @@ def fdump_record_layouts : Flag<["-"], "fdump-record-layouts">, HelpText<"Dump record layout information">; def fdump_record_layouts_simple : Flag<["-"], "fdump-record-layouts-simple">, - HelpText<"Dump record layout information in a simple form used for testing">; + HelpText<"Dump record layout information in a simple form used for testing">, + MarshallingInfoFlag<"LangOpts->DumpRecordLayoutsSimple">; def fix_what_you_can : Flag<["-"], "fix-what-you-can">, HelpText<"Apply fix-it advice even in the presence of unfixable errors">, MarshallingInfoFlag<"FrontendOpts.FixWhatYouCan">; @@ -4469,7 +4477,8 @@ HelpText<"Disable inclusion of timestamp in precompiled headers">, MarshallingInfoFlag<"FrontendOpts.IncludeTimestamps", "true">, IsNegative; def building_pch_with_obj : Flag<["-"], "building-pch-with-obj">, - HelpText<"This compilation is part of building a PCH with corresponding object file.">; + HelpText<"This compilation is part of building a PCH with corresponding object file.">, + MarshallingInfoFlag<"LangOpts->BuildingPCHWithObjectFile">; def aligned_alloc_unavailable : Flag<["-"], "faligned-alloc-unavailable">, HelpText<"Aligned allocation/deallocation functions are unavailable">; @@ -4491,9 +4500,11 @@ } def fblocks_runtime_optional : Flag<["-"], "fblocks-runtime-optional">, - HelpText<"Weakly link in the blocks runtime">; + HelpText<"Weakly link in the blocks runtime">, + MarshallingInfoFlag<"LangOpts->BlocksRuntimeOptional">; def fexternc_nounwind : Flag<["-"], "fexternc-nounwind">, - HelpText<"Assume all functions with C linkage do not unwind">; + HelpText<"Assume all functions with C linkage do not unwind">, + MarshallingInfoFlag<"LangOpts->ExternCNoUnwind">; def split_dwarf_file : Separate<["-"], "split-dwarf-file">, HelpText<"Name of the split dwarf debug info file to encode in the object file">; def fno_wchar : Flag<["-"], "fno-wchar">, @@ -4508,15 +4519,18 @@ def fobjc_dispatch_method_EQ : Joined<["-"], "fobjc-dispatch-method=">, HelpText<"Objective-C dispatch method to use">, Values<"legacy,non-legacy,mixed">; def disable_objc_default_synthesize_properties : Flag<["-"], "disable-objc-default-synthesize-properties">, - HelpText<"disable the default synthesis of Objective-C properties">; + HelpText<"disable the default synthesis of Objective-C properties">, + MarshallingInfoFlag<"LangOpts->ObjCDefaultSynthProperties", "true">, IsNegative; def fencode_extended_block_signature : Flag<["-"], "fencode-extended-block-signature">, - HelpText<"enable extended encoding of block type signature">; + HelpText<"enable extended encoding of block type signature">, + MarshallingInfoFlag<"LangOpts->EncodeExtendedBlockSig">; def function_alignment : Separate<["-"], "function-alignment">, HelpText<"default alignment for functions">; def pic_level : Separate<["-"], "pic-level">, HelpText<"Value for __PIC__">; def pic_is_pie : Flag<["-"], "pic-is-pie">, - HelpText<"File is for a position independent executable">; + HelpText<"File is for a position independent executable">, + MarshallingInfoFlag<"LangOpts->PIE">; def fno_validate_pch : Flag<["-"], "fno-validate-pch">, HelpText<"Disable validation of precompiled headers">; def fallow_pch_with_errors : Flag<["-"], "fallow-pch-with-compiler-errors">, @@ -4530,7 +4544,8 @@ def error_on_deserialized_pch_decl_EQ : Joined<["-"], "error-on-deserialized-decl=">, Alias; def static_define : Flag<["-"], "static-define">, - HelpText<"Should __STATIC__ be defined">; + HelpText<"Should __STATIC__ be defined">, + MarshallingInfoFlag<"LangOpts->Static">; def stack_protector : Separate<["-"], "stack-protector">, HelpText<"Enable stack protectors">; def stack_protector_buffer_size : Separate<["-"], "stack-protector-buffer-size">, @@ -4540,7 +4555,8 @@ def ftype_visibility : Separate<["-"], "ftype-visibility">, HelpText<"Default type visibility">; def fapply_global_visibility_to_externs : Flag<["-"], "fapply-global-visibility-to-externs">, - HelpText<"Apply global symbol visibility to external declarations without an explicit visibility">; + HelpText<"Apply global symbol visibility to external declarations without an explicit visibility">, + MarshallingInfoFlag<"LangOpts->SetVisibilityForExternDecls">; def ftemplate_depth : Separate<["-"], "ftemplate-depth">, HelpText<"Maximum depth of recursive template instantiation">; def foperator_arrow_depth : Separate<["-"], "foperator-arrow-depth">, @@ -4551,24 +4567,30 @@ HelpText<"Maximum number of steps in constexpr function evaluation">; def fbracket_depth : Separate<["-"], "fbracket-depth">, HelpText<"Maximum nesting level for parentheses, brackets, and braces">; -def fconst_strings : Flag<["-"], "fconst-strings">, - HelpText<"Use a const qualified type for string literals in C and ObjC">; -def fno_const_strings : Flag<["-"], "fno-const-strings">, - HelpText<"Don't use a const qualified type for string literals in C and ObjC">; +// todo: simplify these with OptInFFlag that doesn't imply Flags +defm const_strings : BooleanMarshalledFFlag<"const-strings", "LangOpts->ConstStrings", "false", + "Use a const qualified type for string literals in C and ObjC", + "Don't use a const qualified type for string literals in C and ObjC">; def fno_bitfield_type_align : Flag<["-"], "fno-bitfield-type-align">, - HelpText<"Ignore bit-field types when aligning structures">; + HelpText<"Ignore bit-field types when aligning structures">, + MarshallingInfoFlag<"LangOpts->NoBitFieldTypeAlign">; def ffake_address_space_map : Flag<["-"], "ffake-address-space-map">, - HelpText<"Use a fake address space map; OpenCL testing purposes only">; + HelpText<"Use a fake address space map; OpenCL testing purposes only">, + MarshallingInfoFlag<"LangOpts->FakeAddressSpaceMap">; def faddress_space_map_mangling_EQ : Joined<["-"], "faddress-space-map-mangling=">, MetaVarName<"">, HelpText<"Set the mode for address space map based mangling; OpenCL testing purposes only">; def funknown_anytype : Flag<["-"], "funknown-anytype">, - HelpText<"Enable parser support for the __unknown_anytype type; for testing purposes only">; + HelpText<"Enable parser support for the __unknown_anytype type; for testing purposes only">, + MarshallingInfoFlag<"LangOpts->ParseUnknownAnytype">; def fdebugger_support : Flag<["-"], "fdebugger-support">, - HelpText<"Enable special debugger support behavior">; + HelpText<"Enable special debugger support behavior">, + MarshallingInfoFlag<"LangOpts->DebuggerSupport">; def fdebugger_cast_result_to_id : Flag<["-"], "fdebugger-cast-result-to-id">, - HelpText<"Enable casting unknown expression results to id">; + HelpText<"Enable casting unknown expression results to id">, + MarshallingInfoFlag<"LangOpts->DebuggerCastResultToId">; def fdebugger_objc_literal : Flag<["-"], "fdebugger-objc-literal">, - HelpText<"Enable special debugger support for Objective-C subscripting and literals">; + HelpText<"Enable special debugger support for Objective-C subscripting and literals">, + MarshallingInfoFlag<"LangOpts->DebuggerObjCLiteral">; def fdeprecated_macro : Flag<["-"], "fdeprecated-macro">, HelpText<"Defines the __DEPRECATED macro">; def fno_deprecated_macro : Flag<["-"], "fno-deprecated-macro">, @@ -4586,21 +4608,23 @@ def fdefault_calling_conv_EQ : Joined<["-"], "fdefault-calling-conv=">, HelpText<"Set default calling convention">, Values<"cdecl,fastcall,stdcall,vectorcall,regcall">; def finclude_default_header : Flag<["-"], "finclude-default-header">, - HelpText<"Include default header file for OpenCL">; + HelpText<"Include default header file for OpenCL">, + MarshallingInfoFlag<"LangOpts->IncludeDefaultHeader">; def fdeclare_opencl_builtins : Flag<["-"], "fdeclare-opencl-builtins">, - HelpText<"Add OpenCL builtin function declarations (experimental)">; + HelpText<"Add OpenCL builtin function declarations (experimental)">, + MarshallingInfoFlag<"LangOpts->DeclareOpenCLBuiltins">; def fpreserve_vec3_type : Flag<["-"], "fpreserve-vec3-type">, HelpText<"Preserve 3-component vector type">, MarshallingInfoFlag<"CodeGenOpts.PreserveVec3Type">; def fwchar_type_EQ : Joined<["-"], "fwchar-type=">, HelpText<"Select underlying type for wchar_t">, Values<"char,short,int">; -def fsigned_wchar : Flag<["-"], "fsigned-wchar">, - HelpText<"Use a signed type for wchar_t">; -def fno_signed_wchar : Flag<["-"], "fno-signed-wchar">, - HelpText<"Use an unsigned type for wchar_t">; +// todo: simplify these with OptInFFlag that doesn't imply Flags +defm signed_wchar : BooleanMarshalledFFlag<"signed-wchar", "LangOpts->WCharIsSigned", "true", + "Use a signed type for wchar_t", "Use an unsigned type for wchar_t">; def fcompatibility_qualified_id_block_param_type_checking : Flag<["-"], "fcompatibility-qualified-id-block-type-checking">, HelpText<"Allow using blocks with parameters of more specific type than " - "the type system guarantees when a parameter is qualified id">; + "the type system guarantees when a parameter is qualified id">, + MarshallingInfoFlag<"LangOpts->CompatibilityQualifiedIdBlockParamTypeChecking">; def fpass_by_value_is_noalias: Flag<["-"], "fpass-by-value-is-noalias">, HelpText<"Allows assuming by-value parameters do not alias any other value. " "Has no effect on non-trivially-copyable classes in C++.">, Group, @@ -4674,13 +4698,16 @@ //===----------------------------------------------------------------------===// def fcuda_is_device : Flag<["-"], "fcuda-is-device">, - HelpText<"Generate code for CUDA device">; + HelpText<"Generate code for CUDA device">, + MarshallingInfoFlag<"LangOpts->CUDAIsDevice">; def fcuda_include_gpubinary : Separate<["-"], "fcuda-include-gpubinary">, HelpText<"Incorporate CUDA device-side binary into host object file.">; def fcuda_allow_variadic_functions : Flag<["-"], "fcuda-allow-variadic-functions">, - HelpText<"Allow variadic functions in CUDA device code.">; + HelpText<"Allow variadic functions in CUDA device code.">, + MarshallingInfoFlag<"LangOpts->CUDAAllowVariadicFunctions">; def fno_cuda_host_device_constexpr : Flag<["-"], "fno-cuda-host-device-constexpr">, - HelpText<"Don't treat unattributed constexpr functions as __host__ __device__.">; + HelpText<"Don't treat unattributed constexpr functions as __host__ __device__.">, + MarshallingInfoFlag<"LangOpts->CUDAHostDeviceConstexpr", "true">, IsNegative; //===----------------------------------------------------------------------===// // OpenMP Options 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 @@ -289,7 +289,7 @@ template static T mergeForwardValue(T KeyPath, U Value) { - return Value; + return static_cast(Value); } template static T mergeMaskValue(T KeyPath, U Value) { @@ -305,7 +305,8 @@ return KeyPath & Value; } -static void FixupInvocation(CompilerInvocation &Invocation) { +static void FixupInvocation(CompilerInvocation &Invocation, + DiagnosticsEngine &Diags) { LangOptions &LangOpts = *Invocation.getLangOpts(); DiagnosticOptions &DiagOpts = Invocation.getDiagnosticOpts(); CodeGenOptions &CodeGenOpts = Invocation.getCodeGenOpts(); @@ -315,9 +316,16 @@ CodeGenOpts.XRayAlwaysEmitCustomEvents = LangOpts.XRayAlwaysEmitCustomEvents; CodeGenOpts.XRayAlwaysEmitTypedEvents = LangOpts.XRayAlwaysEmitTypedEvents; CodeGenOpts.DisableFree = FrontendOpts.DisableFree; + FrontendOpts.GenerateGlobalModuleIndex = FrontendOpts.UseGlobalModuleIndex; + LangOpts.ForceEmitVTables = CodeGenOpts.ForceEmitVTables; + LangOpts.SpeculativeLoadHardening = CodeGenOpts.SpeculativeLoadHardening; + llvm::sys::Process::UseANSIEscapeCodes(DiagOpts.UseANSIEscapeCodes); + + if (LangOpts.AppleKext && !LangOpts.CPlusPlus) + Diags.Report(diag::warn_c_kext); } //===----------------------------------------------------------------------===// @@ -2380,9 +2388,6 @@ } } - if (Args.hasArg(OPT_fno_dllexport_inlines)) - Opts.DllExportInlines = false; - if (const Arg *A = Args.getLastArg(OPT_fcf_protection_EQ)) { StringRef Name = A->getValue(); if (Name == "full" || Name == "branch") { @@ -2411,7 +2416,6 @@ LangStd = OpenCLLangStd; } - Opts.SYCL = Args.hasArg(options::OPT_fsycl); Opts.SYCLIsDevice = Opts.SYCL && Args.hasArg(options::OPT_fsycl_is_device); if (Opts.SYCL) { // -sycl-std applies to any SYCL source, not only those containing kernels, @@ -2429,9 +2433,6 @@ } } - Opts.IncludeDefaultHeader = Args.hasArg(OPT_finclude_default_header); - Opts.DeclareOpenCLBuiltins = Args.hasArg(OPT_fdeclare_opencl_builtins); - llvm::Triple T(TargetOpts.Triple); CompilerInvocation::setLangDefaults(Opts, IK, T, PPOpts, LangStd); @@ -2458,22 +2459,9 @@ if (Args.hasArg(OPT_fno_operator_names)) Opts.CXXOperatorNames = 0; - if (Args.hasArg(OPT_fcuda_is_device)) - Opts.CUDAIsDevice = 1; - - if (Args.hasArg(OPT_fcuda_allow_variadic_functions)) - Opts.CUDAAllowVariadicFunctions = 1; - - if (Args.hasArg(OPT_fno_cuda_host_device_constexpr)) - Opts.CUDAHostDeviceConstexpr = 0; - - if (Args.hasArg(OPT_fgpu_defer_diag)) - Opts.GPUDeferDiag = 1; - if (Opts.CUDAIsDevice && Args.hasArg(OPT_fcuda_approx_transcendentals)) Opts.CUDADeviceApproxTranscendentals = 1; - Opts.GPURelocatableDeviceCode = Args.hasArg(OPT_fgpu_rdc); if (Args.hasArg(OPT_fgpu_allow_device_init)) { if (Opts.HIP) Opts.GPUAllowDeviceInit = 1; @@ -2481,7 +2469,6 @@ Diags.Report(diag::warn_ignored_hip_only_option) << Args.getLastArg(OPT_fgpu_allow_device_init)->getAsString(Args); } - Opts.HIPUseNewLaunchAPI = Args.hasArg(OPT_fhip_new_launch_api); if (Opts.HIP) Opts.GPUMaxThreadsPerBlock = getLastArgIntValue( Args, OPT_gpu_max_threads_per_block_EQ, Opts.GPUMaxThreadsPerBlock); @@ -2501,7 +2488,6 @@ else if (Args.hasArg(OPT_fobjc_gc)) Opts.setGC(LangOptions::HybridGC); else if (Args.hasArg(OPT_fobjc_arc)) { - Opts.ObjCAutoRefCount = 1; if (!Opts.ObjCRuntime.allowsARC()) Diags.Report(diag::err_arc_unsupported_on_runtime); } @@ -2531,9 +2517,6 @@ Opts.ObjCWeak = Opts.ObjCWeakRuntime; } - if (Args.hasArg(OPT_fno_objc_infer_related_result_type)) - Opts.ObjCInferRelatedResultType = 0; - if (Args.hasArg(OPT_fobjc_subscripting_legacy_runtime)) Opts.ObjCSubscriptingLegacyRuntime = (Opts.ObjCRuntime.getKind() == ObjCRuntime::FragileMacOSX); @@ -2562,18 +2545,6 @@ Opts.GNUInline = 1; } - if (Args.hasArg(OPT_fapple_kext)) { - if (!Opts.CPlusPlus) - Diags.Report(diag::warn_c_kext); - else - Opts.AppleKext = 1; - } - - if (Args.hasArg(OPT_print_ivar_layout)) - Opts.ObjCGCBitmapPrint = 1; - - if (Args.hasArg(OPT_fno_constant_cfstrings)) - Opts.NoConstantCFStrings = 1; if (const auto *A = Args.getLastArg(OPT_fcf_runtime_abi_EQ)) Opts.CFRuntime = llvm::StringSwitch(A->getValue()) @@ -2585,12 +2556,6 @@ .Case("swift-4.1", LangOptions::CoreFoundationABI::Swift4_1) .Default(LangOptions::CoreFoundationABI::ObjectiveC); - if (Args.hasArg(OPT_fzvector)) - Opts.ZVector = 1; - - if (Args.hasArg(OPT_pthread)) - Opts.POSIXThreads = 1; - // The value-visibility mode defaults to "default". if (Arg *visOpt = Args.getLastArg(OPT_fvisibility)) { Opts.setValueVisibilityMode(parseVisibility(visOpt, Args, Diags)); @@ -2605,18 +2570,6 @@ Opts.setTypeVisibilityMode(Opts.getValueVisibilityMode()); } - if (Args.hasArg(OPT_fvisibility_inlines_hidden)) - Opts.InlineVisibilityHidden = 1; - - if (Args.hasArg(OPT_fvisibility_inlines_hidden_static_local_var)) - Opts.VisibilityInlinesHiddenStaticLocalVar = 1; - - if (Args.hasArg(OPT_fvisibility_global_new_delete_hidden)) - Opts.GlobalAllocationFunctionVisibilityHidden = 1; - - if (Args.hasArg(OPT_fapply_global_visibility_to_externs)) - Opts.SetVisibilityForExternDecls = 1; - if (Args.hasArg(OPT_fvisibility_from_dllstorageclass)) { Opts.VisibilityFromDLLStorageClass = 1; @@ -2658,7 +2611,6 @@ else if (Args.hasArg(OPT_fwrapv)) Opts.setSignedOverflowBehavior(LangOptions::SOB_Defined); - Opts.MSVCCompat = Args.hasArg(OPT_fms_compatibility); Opts.MicrosoftExt = Opts.MSVCCompat || Args.hasArg(OPT_fms_extensions); Opts.AsmBlocks = Args.hasArg(OPT_fasm_blocks) || Opts.MicrosoftExt; Opts.MSCompatibilityVersion = 0; @@ -2684,13 +2636,8 @@ Opts.DollarIdents = Args.hasFlag(OPT_fdollars_in_identifiers, OPT_fno_dollars_in_identifiers, Opts.DollarIdents); - Opts.PascalStrings = Args.hasArg(OPT_fpascal_strings); Opts.setVtorDispMode( MSVtorDispMode(getLastArgIntValue(Args, OPT_vtordisp_mode_EQ, 1, Diags))); - Opts.Borland = Args.hasArg(OPT_fborland_extensions); - Opts.WritableStrings = Args.hasArg(OPT_fwritable_strings); - Opts.ConstStrings = Args.hasFlag(OPT_fconst_strings, OPT_fno_const_strings, - Opts.ConstStrings); if (Arg *A = Args.getLastArg(OPT_flax_vector_conversions_EQ)) { using LaxKind = LangOptions::LaxVectorConversionKind; if (auto Kind = llvm::StringSwitch>(A->getValue()) @@ -2703,12 +2650,6 @@ Diags.Report(diag::err_drv_invalid_value) << A->getAsString(Args) << A->getValue(); } - if (Args.hasArg(OPT_fno_threadsafe_statics)) - Opts.ThreadsafeStatics = 0; - Opts.Exceptions = Args.hasArg(OPT_fexceptions); - Opts.IgnoreExceptions = Args.hasArg(OPT_fignore_exceptions); - Opts.ObjCExceptions = Args.hasArg(OPT_fobjc_exceptions); - Opts.CXXExceptions = Args.hasArg(OPT_fcxx_exceptions); // -ffixed-point Opts.FixedPoint = @@ -2730,21 +2671,12 @@ if (T.isWindowsMSVCEnvironment()) Diags.Report(diag::err_fe_invalid_exception_model) << Opt.getName() << T.str(); - - Opts.SjLjExceptions = Opt.matches(options::OPT_fsjlj_exceptions); - Opts.SEHExceptions = Opt.matches(options::OPT_fseh_exceptions); - Opts.DWARFExceptions = Opt.matches(options::OPT_fdwarf_exceptions); - Opts.WasmExceptions = Opt.matches(options::OPT_fwasm_exceptions); } - Opts.ExternCNoUnwind = Args.hasArg(OPT_fexternc_nounwind); - Opts.TraditionalCPP = Args.hasArg(OPT_traditional_cpp); - Opts.RTTI = Opts.CPlusPlus && !Args.hasArg(OPT_fno_rtti); Opts.RTTIData = Opts.RTTI && !Args.hasArg(OPT_fno_rtti_data); Opts.Blocks = Args.hasArg(OPT_fblocks) || (Opts.OpenCL && Opts.OpenCLVersion == 200); - Opts.BlocksRuntimeOptional = Args.hasArg(OPT_fblocks_runtime_optional); Opts.Coroutines = Opts.CPlusPlus20 || Args.hasArg(OPT_fcoroutines_ts); Opts.ConvergentFunctions = Opts.OpenCL || (Opts.CUDA && Opts.CUDAIsDevice) || @@ -2757,10 +2689,8 @@ Opts.DoubleSquareBracketAttributes); Opts.CPlusPlusModules = Opts.CPlusPlus20; - Opts.ModulesTS = Args.hasArg(OPT_fmodules_ts); Opts.Modules = Args.hasArg(OPT_fmodules) || Opts.ModulesTS || Opts.CPlusPlusModules; - Opts.ModulesStrictDeclUse = Args.hasArg(OPT_fmodules_strict_decluse); Opts.ModulesDeclUse = Args.hasArg(OPT_fmodules_decluse) || Opts.ModulesStrictDeclUse; // FIXME: We only need this in C++ modules / Modules TS if we might textually @@ -2768,13 +2698,9 @@ Opts.ModulesLocalVisibility = Args.hasArg(OPT_fmodules_local_submodule_visibility) || Opts.ModulesTS || Opts.CPlusPlusModules; - Opts.ModulesCodegen = Args.hasArg(OPT_fmodules_codegen); - Opts.ModulesDebugInfo = Args.hasArg(OPT_fmodules_debuginfo); Opts.ModulesSearchAll = Opts.Modules && !Args.hasArg(OPT_fno_modules_search_all) && Args.hasArg(OPT_fmodules_search_all); - Opts.ModulesErrorRecovery = !Args.hasArg(OPT_fno_modules_error_recovery); - Opts.ImplicitModules = !Args.hasArg(OPT_fno_implicit_modules); Opts.CharIsSigned = Opts.OpenCL || !Args.hasArg(OPT_fno_signed_char); Opts.WChar = Opts.CPlusPlus && !Args.hasArg(OPT_fno_wchar); Opts.Char8 = Args.hasFlag(OPT_fchar8__t, OPT_fno_char8__t, Opts.CPlusPlus20); @@ -2787,16 +2713,9 @@ if (Opts.WCharSize == 0) Diags.Report(diag::err_fe_invalid_wchar_type) << A->getValue(); } - Opts.WCharIsSigned = Args.hasFlag(OPT_fsigned_wchar, OPT_fno_signed_wchar, true); - Opts.ShortEnums = Args.hasArg(OPT_fshort_enums); - Opts.Freestanding = Args.hasArg(OPT_ffreestanding); Opts.NoBuiltin = Args.hasArg(OPT_fno_builtin) || Opts.Freestanding; if (!Opts.NoBuiltin) getAllNoBuiltinFuncValues(Args, Opts.NoBuiltinFuncs); - Opts.NoMathBuiltin = Args.hasArg(OPT_fno_math_builtin); - Opts.RelaxedTemplateTemplateArgs = - Args.hasArg(OPT_frelaxed_template_template_args); - Opts.SizedDeallocation = Args.hasArg(OPT_fsized_deallocation); Opts.AlignedAllocation = Args.hasFlag(OPT_faligned_allocation, OPT_fno_aligned_allocation, Opts.AlignedAllocation); @@ -2810,8 +2729,6 @@ << A->getValue(); Opts.NewAlignOverride = 0; } - Opts.ConceptSatisfactionCaching = - !Args.hasArg(OPT_fno_concept_satisfaction_caching); if (Args.hasArg(OPT_fconcepts_ts)) Diags.Report(diag::warn_fe_concepts_ts_flag); // Recovery AST still heavily relies on dependent-type machinery. @@ -2819,9 +2736,6 @@ Args.hasFlag(OPT_frecovery_ast, OPT_fno_recovery_ast, Opts.CPlusPlus); Opts.RecoveryASTType = Args.hasFlag( OPT_frecovery_ast_type, OPT_fno_recovery_ast_type, Opts.CPlusPlus); - Opts.HeinousExtensions = Args.hasArg(OPT_fheinous_gnu_extensions); - Opts.AccessControl = !Args.hasArg(OPT_fno_access_control); - Opts.ElideConstructors = !Args.hasArg(OPT_fno_elide_constructors); Opts.MathErrno = !Opts.OpenCL && Args.hasArg(OPT_fmath_errno); Opts.InstantiationDepth = getLastArgIntValue(Args, OPT_ftemplate_depth, 1024, Diags); @@ -2831,51 +2745,24 @@ getLastArgIntValue(Args, OPT_fconstexpr_depth, 512, Diags); Opts.ConstexprStepLimit = getLastArgIntValue(Args, OPT_fconstexpr_steps, 1048576, Diags); - Opts.EnableNewConstInterp = - Args.hasArg(OPT_fexperimental_new_constant_interpreter); Opts.BracketDepth = getLastArgIntValue(Args, OPT_fbracket_depth, 256, Diags); - Opts.DelayedTemplateParsing = Args.hasArg(OPT_fdelayed_template_parsing); Opts.NumLargeByValueCopy = getLastArgIntValue(Args, OPT_Wlarge_by_value_copy_EQ, 0, Diags); - Opts.MSBitfields = Args.hasArg(OPT_mms_bitfields); Opts.ObjCConstantStringClass = std::string(Args.getLastArgValue(OPT_fconstant_string_class)); - Opts.ObjCDefaultSynthProperties = - !Args.hasArg(OPT_disable_objc_default_synthesize_properties); - Opts.EncodeExtendedBlockSig = - Args.hasArg(OPT_fencode_extended_block_signature); - Opts.EmitAllDecls = Args.hasArg(OPT_femit_all_decls); Opts.PackStruct = getLastArgIntValue(Args, OPT_fpack_struct_EQ, 0, Diags); Opts.MaxTypeAlign = getLastArgIntValue(Args, OPT_fmax_type_align_EQ, 0, Diags); - Opts.AlignDouble = Args.hasArg(OPT_malign_double); Opts.DoubleSize = getLastArgIntValue(Args, OPT_mdouble_EQ, 0, Diags); Opts.LongDoubleSize = Args.hasArg(OPT_mlong_double_128) ? 128 : Args.hasArg(OPT_mlong_double_64) ? 64 : 0; - Opts.PPCIEEELongDouble = Args.hasArg(OPT_mabi_EQ_ieeelongdouble); Opts.PICLevel = getLastArgIntValue(Args, OPT_pic_level, 0, Diags); - Opts.ROPI = Args.hasArg(OPT_fropi); - Opts.RWPI = Args.hasArg(OPT_frwpi); - Opts.PIE = Args.hasArg(OPT_pic_is_pie); - Opts.Static = Args.hasArg(OPT_static_define); - Opts.DumpRecordLayoutsSimple = Args.hasArg(OPT_fdump_record_layouts_simple); Opts.DumpRecordLayouts = Opts.DumpRecordLayoutsSimple || Args.hasArg(OPT_fdump_record_layouts); - Opts.DumpVTableLayouts = Args.hasArg(OPT_fdump_vtable_layouts); - Opts.SpellChecking = !Args.hasArg(OPT_fno_spell_checking); - Opts.NoBitFieldTypeAlign = Args.hasArg(OPT_fno_bitfield_type_align); if (Opts.FastRelaxedMath) Opts.setDefaultFPContractMode(LangOptions::FPM_Fast); - Opts.HexagonQdsp6Compat = Args.hasArg(OPT_mqdsp6_compat); - Opts.FakeAddressSpaceMap = Args.hasArg(OPT_ffake_address_space_map); - Opts.ParseUnknownAnytype = Args.hasArg(OPT_funknown_anytype); - Opts.DebuggerSupport = Args.hasArg(OPT_fdebugger_support); - Opts.DebuggerCastResultToId = Args.hasArg(OPT_fdebugger_cast_result_to_id); - Opts.DebuggerObjCLiteral = Args.hasArg(OPT_fdebugger_objc_literal); - Opts.ApplePragmaPack = Args.hasArg(OPT_fapple_pragma_pack); Opts.ModuleName = std::string(Args.getLastArgValue(OPT_fmodule_name_EQ)); Opts.CurrentModule = Opts.ModuleName; - Opts.AppExt = Args.hasArg(OPT_fapplication_extension); Opts.ModuleFeatures = Args.getAllArgValues(OPT_fmodule_feature); llvm::sort(Opts.ModuleFeatures); Opts.NativeHalfType |= Args.hasArg(OPT_fnative_half_type); @@ -2884,8 +2771,6 @@ // is enabled. Opts.HalfArgsAndReturns = Args.hasArg(OPT_fallow_half_arguments_and_returns) | Opts.NativeHalfArgsAndReturns; - Opts.GNUAsm = !Args.hasArg(OPT_fno_gnu_inline_asm); - Opts.Cmse = Args.hasArg(OPT_mcmse); // Armv8-M Security Extensions Opts.ArmSveVectorBits = getLastArgIntValue(Args, options::OPT_msve_vector_bits_EQ, 0, Diags); @@ -2971,11 +2856,6 @@ Opts.setDefaultCallingConv(DefaultCC); } - Opts.SemanticInterposition = Args.hasArg(OPT_fsemantic_interposition); - // An explicit -fno-semantic-interposition infers dso_local. - Opts.ExplicitNoSemanticInterposition = - Args.hasArg(OPT_fno_semantic_interposition); - // -mrtd option if (Arg *A = Args.getLastArg(OPT_mrtd)) { if (Opts.getDefaultCallingConv() != LangOptions::DCC_None) @@ -2991,8 +2871,6 @@ } } - // Check if -fopenmp is specified and set default version to 5.0. - Opts.OpenMP = Args.hasArg(options::OPT_fopenmp) ? 50 : 0; // Check if -fopenmp-simd is specified. bool IsSimdSpecified = Args.hasFlag(options::OPT_fopenmp_simd, options::OPT_fno_openmp_simd, @@ -3047,11 +2925,6 @@ Opts.OpenMPCUDAReductionBufNum, Diags); } - // Prevent auto-widening the representation of loop counters during an - // OpenMP collapse clause. - Opts.OpenMPOptimisticCollapse = - Args.hasArg(options::OPT_fopenmp_optimistic_collapse) ? 1 : 0; - // Get the OpenMP target triples if any. if (Arg *A = Args.getLastArg(options::OPT_fopenmp_targets_EQ)) { enum ArchPtrSize { Arch16Bit, Arch32Bit, Arch64Bit }; @@ -3143,12 +3016,7 @@ Diags.Report(diag::err_drv_invalid_value) << A->getAsString(Args) << Val; } - auto FPRM = llvm::RoundingMode::NearestTiesToEven; - if (Args.hasArg(OPT_frounding_math)) { - FPRM = llvm::RoundingMode::Dynamic; - } - Opts.setFPRoundingMode(FPRM); - + // Are these really needed in CC1? if (Args.hasArg(OPT_ftrapping_math)) { Opts.setFPExceptionMode(LangOptions::FPE_Strict); } @@ -3171,9 +3039,6 @@ } Opts.setFPExceptionMode(FPEB); - Opts.RetainCommentsFromSystemHeaders = - Args.hasArg(OPT_fretain_comments_from_system_headers); - unsigned SSP = getLastArgIntValue(Args, OPT_stack_protector, 0, Diags); switch (SSP) { default: @@ -3224,14 +3089,6 @@ Args.getAllArgValues(OPT_fxray_never_instrument); Opts.XRayAttrListFiles = Args.getAllArgValues(OPT_fxray_attr_list); - // -fforce-emit-vtables - Opts.ForceEmitVTables = Args.hasArg(OPT_fforce_emit_vtables); - - // -fallow-editor-placeholders - Opts.AllowEditorPlaceholders = Args.hasArg(OPT_fallow_editor_placeholders); - - Opts.RegisterStaticDestructors = !Args.hasArg(OPT_fno_cxx_static_destructors); - if (Arg *A = Args.getLastArg(OPT_fclang_abi_compat_EQ)) { Opts.setClangABICompat(LangOptions::ClangABI::Latest); @@ -3267,12 +3124,6 @@ } } - Opts.CompleteMemberPointers = Args.hasArg(OPT_fcomplete_member_pointers); - Opts.BuildingPCHWithObjectFile = Args.hasArg(OPT_building_pch_with_obj); - Opts.PCHInstantiateTemplates = Args.hasArg(OPT_fpch_instantiate_templates); - - Opts.MatrixTypes = Args.hasArg(OPT_fenable_matrix); - Opts.MaxTokens = getLastArgIntValue(Args, OPT_fmax_tokens_EQ, 0, Diags); if (Arg *A = Args.getLastArg(OPT_msign_return_address_EQ)) { @@ -3306,17 +3157,6 @@ } } } - - Opts.BranchTargetEnforcement = Args.hasArg(OPT_mbranch_target_enforce); - Opts.SpeculativeLoadHardening = Args.hasArg(OPT_mspeculative_load_hardening); - - Opts.CompatibilityQualifiedIdBlockParamTypeChecking = - Args.hasArg(OPT_fcompatibility_qualified_id_block_param_type_checking); - - Opts.RelativeCXXABIVTables = - Args.hasFlag(OPT_fexperimental_relative_cxx_abi_vtables, - OPT_fno_experimental_relative_cxx_abi_vtables, - /*default=*/false); } static bool isStrictlyPreprocessorAction(frontend::ActionKind Action) { @@ -3596,7 +3436,6 @@ } Success &= Res.parseSimpleArgs(Args, Diags); - FixupInvocation(Res); Success &= ParseAnalyzerArgs(*Res.getAnalyzerOpts(), Args, Diags); ParseDependencyOutputArgs(Res.getDependencyOutputOpts(), Args); @@ -3620,15 +3459,9 @@ llvm::Triple T(Res.getTargetOpts().Triple); if (DashX.getFormat() == InputKind::Precompiled || DashX.getLanguage() == Language::LLVM_IR) { - // ObjCAAutoRefCount and Sanitize LangOpts are used to setup the - // PassManager in BackendUtil.cpp. They need to be initializd no matter - // what the input type is. - if (Args.hasArg(OPT_fobjc_arc)) - LangOpts.ObjCAutoRefCount = 1; // PIClevel and PIELevel are needed during code generation and this should be // set regardless of the input type. LangOpts.PICLevel = getLastArgIntValue(Args, OPT_pic_level, 0, Diags); - LangOpts.PIE = Args.hasArg(OPT_pic_is_pie); parseSanitizerKinds("-fsanitize=", Args.getAllArgValues(OPT_fsanitize_EQ), Diags, LangOpts.Sanitize); } else { @@ -3689,6 +3522,8 @@ Res.getCodeGenOpts().Argv0 = Argv0; Res.getCodeGenOpts().CommandLineArgs = CommandLineArgs; + FixupInvocation(Res, Diags); + return Success; } @@ -3815,7 +3650,7 @@ if (((FLAGS)&options::CC1Option) && \ (ALWAYS_EMIT || \ (EXTRACTOR(this->KEYPATH) != \ - ((IMPLIED_CHECK) ? (IMPLIED_VALUE) : (DEFAULT_VALUE))))) { \ + static_castKEYPATH)>(((IMPLIED_CHECK) ? (IMPLIED_VALUE) : (DEFAULT_VALUE)))))) { \ DENORMALIZER(Args, SPELLING, SA, TABLE_INDEX, EXTRACTOR(this->KEYPATH)); \ }