jansvoboda11 updated this revision to Diff 307780.
jansvoboda11 added a comment.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Revert accidental help change, do not AlwaysEmit
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D83892/new/
https://reviews.llvm.org/D83892
Files:
clang/include/clang/Driver/Options.td
clang/lib/Frontend/CompilerInvocation.cpp
clang/unittests/Frontend/CompilerInvocationTest.cpp
llvm/include/llvm/Option/OptParser.td
Index: llvm/include/llvm/Option/OptParser.td
===================================================================
--- llvm/include/llvm/Option/OptParser.td
+++ llvm/include/llvm/Option/OptParser.td
@@ -177,7 +177,6 @@
class MarshallingInfoBooleanFlag<code keypath, code defaultvalue, Option negopt>
: MarshallingInfoFlag<keypath, defaultvalue> {
- bit ShouldAlwaysEmit = 1;
string MarshallingInfoKind = "BooleanFlag";
code Normalizer = "normalizeBooleanFlag";
code Denormalizer = "denormalizeBooleanFlag";
Index: clang/unittests/Frontend/CompilerInvocationTest.cpp
===================================================================
--- clang/unittests/Frontend/CompilerInvocationTest.cpp
+++ clang/unittests/Frontend/CompilerInvocationTest.cpp
@@ -76,6 +76,63 @@
ASSERT_TRUE(CInvok.getLangOpts()->AllowRecip);
}
+TEST_F(OptsPopulationTest, OptInFFlag) {
+ const char *ArgsEmpty[] = {"clang"};
+ CompilerInvocation InvocationEmpty;
+ CompilerInvocation::CreateFromArgs(InvocationEmpty, ArgsEmpty, *Diags);
+ ASSERT_FALSE(Diags->hasErrorOccurred());
+ ASSERT_FALSE(InvocationEmpty.getCodeGenOpts().CoverageMapping);
+
+ const char *ArgsPosFlag[] = {"clang", "-fcoverage-mapping"};
+ CompilerInvocation InvocationPosFlag;
+ CompilerInvocation::CreateFromArgs(InvocationPosFlag, ArgsPosFlag, *Diags);
+ ASSERT_FALSE(Diags->hasErrorOccurred());
+ ASSERT_TRUE(InvocationPosFlag.getCodeGenOpts().CoverageMapping);
+
+ const char *ArgsNegFlag[] = {"clang", "-fno-coverage-mapping"};
+ CompilerInvocation InvocationNegFlag;
+ CompilerInvocation::CreateFromArgs(InvocationNegFlag, ArgsNegFlag, *Diags);
+ ASSERT_TRUE(Diags->hasErrorOccurred());
+}
+
+TEST_F(OptsPopulationTest, OptOutPositiveFFlag) {
+ const char *ArgsEmpty[] = {"clang"};
+ CompilerInvocation InvocationEmpty;
+ CompilerInvocation::CreateFromArgs(InvocationEmpty, ArgsEmpty, *Diags);
+ ASSERT_FALSE(Diags->hasErrorOccurred());
+ ASSERT_TRUE(InvocationEmpty.getCodeGenOpts().Autolink);
+
+ const char *ArgsNegFlag[] = {"clang", "-fno-autolink"};
+ CompilerInvocation InvocationNegFlag;
+ CompilerInvocation::CreateFromArgs(InvocationNegFlag, ArgsNegFlag, *Diags);
+ ASSERT_FALSE(Diags->hasErrorOccurred());
+ ASSERT_FALSE(InvocationNegFlag.getCodeGenOpts().Autolink);
+
+ const char *ArgsPosFlag[] = {"clang", "-fautolink"};
+ CompilerInvocation InvocationPosFlag;
+ CompilerInvocation::CreateFromArgs(InvocationPosFlag, ArgsPosFlag, *Diags);
+ ASSERT_TRUE(Diags->hasErrorOccurred());
+}
+
+TEST_F(OptsPopulationTest, OptOutFFlag) {
+ const char *ArgsEmpty[] = {"clang"};
+ CompilerInvocation InvocationEmpty;
+ CompilerInvocation::CreateFromArgs(InvocationEmpty, ArgsEmpty, *Diags);
+ ASSERT_FALSE(Diags->hasErrorOccurred());
+ ASSERT_FALSE(InvocationEmpty.getCodeGenOpts().NoUseJumpTables);
+
+ const char *ArgsNegFlag[] = {"clang", "-fno-jump-tables"};
+ CompilerInvocation InvocationNegFlag;
+ CompilerInvocation::CreateFromArgs(InvocationNegFlag, ArgsNegFlag, *Diags);
+ ASSERT_FALSE(Diags->hasErrorOccurred());
+ ASSERT_TRUE(InvocationNegFlag.getCodeGenOpts().NoUseJumpTables);
+
+ const char *ArgsPosFlag[] = {"clang", "-fjump-tables"};
+ CompilerInvocation InvocationPosFlag;
+ CompilerInvocation::CreateFromArgs(InvocationPosFlag, ArgsPosFlag, *Diags);
+ ASSERT_TRUE(Diags->hasErrorOccurred());
+}
+
TEST_F(CC1CommandLineGenerationTest, CanGenerateCC1CommandLineFlag) {
const char *Args[] = {"clang", "-xc++", "-fmodules-strict-context-hash", "-"};
Index: clang/lib/Frontend/CompilerInvocation.cpp
===================================================================
--- clang/lib/Frontend/CompilerInvocation.cpp
+++ clang/lib/Frontend/CompilerInvocation.cpp
@@ -285,9 +285,11 @@
DiagnosticOptions &DiagOpts = Invocation.getDiagnosticOpts();
CodeGenOptions &CodeGenOpts = Invocation.getCodeGenOpts();
FrontendOptions &FrontendOpts = Invocation.getFrontendOpts();
+
CodeGenOpts.XRayInstrumentFunctions = LangOpts.XRayInstrument;
CodeGenOpts.XRayAlwaysEmitCustomEvents = LangOpts.XRayAlwaysEmitCustomEvents;
CodeGenOpts.XRayAlwaysEmitTypedEvents = LangOpts.XRayAlwaysEmitTypedEvents;
+ CodeGenOpts.DisableFree = FrontendOpts.DisableFree;
FrontendOpts.GenerateGlobalModuleIndex = FrontendOpts.UseGlobalModuleIndex;
llvm::sys::Process::UseANSIEscapeCodes(DiagOpts.UseANSIEscapeCodes);
@@ -826,10 +828,6 @@
}
}
- Opts.DebugPassManager =
- Args.hasFlag(OPT_fdebug_pass_manager, OPT_fno_debug_pass_manager,
- /* Default */ false);
-
if (Arg *A = Args.getLastArg(OPT_fveclib)) {
StringRef Name = A->getValue();
if (Name == "Accelerate")
@@ -881,23 +879,9 @@
Opts.setDebuggerTuning(static_cast<llvm::DebuggerKind>(Val));
}
Opts.DwarfVersion = getLastArgIntValue(Args, OPT_dwarf_version_EQ, 0, Diags);
- Opts.DebugColumnInfo = !Args.hasArg(OPT_gno_column_info);
- Opts.EmitCodeView = Args.hasArg(OPT_gcodeview);
- Opts.CodeViewGHash = Args.hasArg(OPT_gcodeview_ghash);
- Opts.MacroDebugInfo = Args.hasArg(OPT_debug_info_macro);
- Opts.WholeProgramVTables = Args.hasArg(OPT_fwhole_program_vtables);
- Opts.VirtualFunctionElimination =
- Args.hasArg(OPT_fvirtual_function_elimination);
- Opts.LTOVisibilityPublicStd = Args.hasArg(OPT_flto_visibility_public_std);
Opts.SplitDwarfFile = std::string(Args.getLastArgValue(OPT_split_dwarf_file));
Opts.SplitDwarfOutput =
std::string(Args.getLastArgValue(OPT_split_dwarf_output));
- Opts.SplitDwarfInlining = !Args.hasArg(OPT_fno_split_dwarf_inlining);
- Opts.DebugTypeExtRefs = Args.hasArg(OPT_dwarf_ext_refs);
- Opts.DebugExplicitImport = Args.hasArg(OPT_dwarf_explicit_import);
- Opts.DebugFwdTemplateParams = Args.hasArg(OPT_debug_forward_template_params);
- Opts.EmbedSource = Args.hasArg(OPT_gembed_source);
- Opts.ForceDwarfFrameSection = Args.hasArg(OPT_fforce_dwarf_frame);
for (const auto &Arg : Args.getAllArgValues(OPT_fdebug_prefix_map_EQ)) {
auto Split = StringRef(Arg).split('=');
@@ -905,13 +889,6 @@
{std::string(Split.first), std::string(Split.second)});
}
- if (const Arg *A =
- Args.getLastArg(OPT_emit_llvm_uselists, OPT_no_emit_llvm_uselists))
- Opts.EmitLLVMUseLists = A->getOption().getID() == OPT_emit_llvm_uselists;
-
- Opts.DisableLLVMPasses = Args.hasArg(OPT_disable_llvm_passes);
- Opts.DisableLifetimeMarkers = Args.hasArg(OPT_disable_lifetimemarkers);
-
const llvm::Triple::ArchType DebugEntryValueArchs[] = {
llvm::Triple::x86, llvm::Triple::x86_64, llvm::Triple::aarch64,
llvm::Triple::arm, llvm::Triple::armeb, llvm::Triple::mips,
@@ -922,30 +899,12 @@
llvm::is_contained(DebugEntryValueArchs, T.getArch()))
Opts.EmitCallSiteInfo = true;
- Opts.ValueTrackingVariableLocations =
- Args.hasArg(OPT_fexperimental_debug_variable_locations);
-
- Opts.DisableO0ImplyOptNone = Args.hasArg(OPT_disable_O0_optnone);
- Opts.DisableRedZone = Args.hasArg(OPT_disable_red_zone);
- Opts.IndirectTlsSegRefs = Args.hasArg(OPT_mno_tls_direct_seg_refs);
- Opts.ForbidGuardVariables = Args.hasArg(OPT_fforbid_guard_variables);
- Opts.UseRegisterSizedBitfieldAccess = Args.hasArg(
- OPT_fuse_register_sized_bitfield_access);
- Opts.RelaxedAliasing = Args.hasArg(OPT_relaxed_aliasing);
- Opts.StructPathTBAA = !Args.hasArg(OPT_no_struct_path_tbaa);
Opts.NewStructPathTBAA = !Args.hasArg(OPT_no_struct_path_tbaa) &&
Args.hasArg(OPT_new_struct_path_tbaa);
- Opts.FineGrainedBitfieldAccesses =
- Args.hasFlag(OPT_ffine_grained_bitfield_accesses,
- OPT_fno_fine_grained_bitfield_accesses, false);
Opts.DwarfDebugFlags =
std::string(Args.getLastArgValue(OPT_dwarf_debug_flags));
Opts.RecordCommandLine =
std::string(Args.getLastArgValue(OPT_record_command_line));
- Opts.MergeAllConstants = Args.hasArg(OPT_fmerge_all_constants);
- Opts.NoCommon = !Args.hasArg(OPT_fcommon);
- Opts.NoInlineLineTables = Args.hasArg(OPT_gno_inline_line_tables);
- Opts.NoImplicitFloat = Args.hasArg(OPT_no_implicit_float);
Opts.OptimizeSize = getOptimizationLevelSize(Args);
Opts.SimplifyLibCalls = !(Args.hasArg(OPT_fno_builtin) ||
Args.hasArg(OPT_ffreestanding));
@@ -954,24 +913,17 @@
Opts.UnrollLoops =
Args.hasFlag(OPT_funroll_loops, OPT_fno_unroll_loops,
(Opts.OptimizationLevel > 1));
- Opts.RerollLoops = Args.hasArg(OPT_freroll_loops);
- Opts.DisableIntegratedAS = Args.hasArg(OPT_fno_integrated_as);
- Opts.Autolink = !Args.hasArg(OPT_fno_autolink);
Opts.SampleProfileFile =
std::string(Args.getLastArgValue(OPT_fprofile_sample_use_EQ));
- Opts.DebugInfoForProfiling = Args.hasFlag(
- OPT_fdebug_info_for_profiling, OPT_fno_debug_info_for_profiling, false);
Opts.DebugNameTable = static_cast<unsigned>(
Args.hasArg(OPT_ggnu_pubnames)
? llvm::DICompileUnit::DebugNameTableKind::GNU
: Args.hasArg(OPT_gpubnames)
? llvm::DICompileUnit::DebugNameTableKind::Default
: llvm::DICompileUnit::DebugNameTableKind::None);
- Opts.DebugRangesBaseAddress = Args.hasArg(OPT_fdebug_ranges_base_address);
setPGOInstrumentor(Opts, Args, Diags);
- Opts.AtomicProfileUpdate = Args.hasArg(OPT_fprofile_update_EQ);
Opts.InstrProfileOutput =
std::string(Args.getLastArgValue(OPT_fprofile_instrument_path_EQ));
Opts.ProfileInstrumentUsePath =
@@ -986,17 +938,6 @@
<< "-fexperimental-new-pass-manager";
}
- Opts.CoverageMapping =
- Args.hasFlag(OPT_fcoverage_mapping, OPT_fno_coverage_mapping, false);
- Opts.DumpCoverageMapping = Args.hasArg(OPT_dump_coverage_mapping);
- Opts.AsmVerbose = !Args.hasArg(OPT_fno_verbose_asm);
- Opts.PreserveAsmComments = !Args.hasArg(OPT_fno_preserve_as_comments);
- Opts.AssumeSaneOperatorNew = !Args.hasArg(OPT_fno_assume_sane_operator_new);
- Opts.ObjCAutoRefCountExceptions = Args.hasArg(OPT_fobjc_arc_exceptions);
- Opts.CXAAtExit = !Args.hasArg(OPT_fno_use_cxa_atexit);
- Opts.RegisterGlobalDtorsWithAtExit =
- Args.hasArg(OPT_fregister_global_dtors_with_atexit);
- Opts.CXXCtorDtorAliases = Args.hasArg(OPT_mconstructor_aliases);
Opts.CodeModel = TargetOpts.CodeModel;
Opts.DebugPass = std::string(Args.getLastArgValue(OPT_mdebug_pass));
@@ -1020,40 +961,14 @@
Opts.setFramePointer(FP);
}
- Opts.DisableFree = Args.hasArg(OPT_disable_free);
- Opts.DiscardValueNames = Args.hasArg(OPT_discard_value_names);
- Opts.DisableTailCalls = Args.hasArg(OPT_mdisable_tail_calls);
- Opts.NoEscapingBlockTailCalls =
- Args.hasArg(OPT_fno_escaping_block_tail_calls);
Opts.FloatABI = std::string(Args.getLastArgValue(OPT_mfloat_abi));
Opts.LimitFloatPrecision =
std::string(Args.getLastArgValue(OPT_mlimit_float_precision));
Opts.Reciprocals = Args.getAllArgValues(OPT_mrecip_EQ);
- Opts.StrictFloatCastOverflow =
- !Args.hasArg(OPT_fno_strict_float_cast_overflow);
- Opts.NoZeroInitializedInBSS = Args.hasArg(OPT_fno_zero_initialized_in_bss);
Opts.NumRegisterParameters = getLastArgIntValue(Args, OPT_mregparm, 0, Diags);
- Opts.NoExecStack = Args.hasArg(OPT_mno_exec_stack);
Opts.SmallDataLimit =
getLastArgIntValue(Args, OPT_msmall_data_limit, 0, Diags);
- Opts.FatalWarnings = Args.hasArg(OPT_massembler_fatal_warnings);
- Opts.NoWarn = Args.hasArg(OPT_massembler_no_warn);
- Opts.EnableSegmentedStacks = Args.hasArg(OPT_split_stacks);
- Opts.RelaxAll = Args.hasArg(OPT_mrelax_all);
- Opts.IncrementalLinkerCompatible =
- Args.hasArg(OPT_mincremental_linker_compatible);
- Opts.PIECopyRelocations =
- Args.hasArg(OPT_mpie_copy_relocations);
- Opts.NoPLT = Args.hasArg(OPT_fno_plt);
- Opts.SaveTempLabels = Args.hasArg(OPT_msave_temp_labels);
- Opts.NoDwarfDirectoryAsm = Args.hasArg(OPT_fno_dwarf_directory_asm);
- Opts.SoftFloat = Args.hasArg(OPT_msoft_float);
- Opts.StrictEnums = Args.hasArg(OPT_fstrict_enums);
- Opts.StrictReturn = !Args.hasArg(OPT_fno_strict_return);
- Opts.StrictVTablePointers = Args.hasArg(OPT_fstrict_vtable_pointers);
- Opts.ForceEmitVTables = Args.hasArg(OPT_fforce_emit_vtables);
- Opts.UnwindTables = Args.hasArg(OPT_munwind_tables);
Opts.ThreadModel =
std::string(Args.getLastArgValue(OPT_mthread_model, "posix"));
if (Opts.ThreadModel != "posix" && Opts.ThreadModel != "single")
@@ -1061,7 +976,6 @@
<< Args.getLastArg(OPT_mthread_model)->getAsString(Args)
<< Opts.ThreadModel;
Opts.TrapFuncName = std::string(Args.getLastArgValue(OPT_ftrap_function_EQ));
- Opts.UseInitArray = !Args.hasArg(OPT_fno_use_init_array);
Opts.BBSections =
std::string(Args.getLastArgValue(OPT_fbasic_block_sections_EQ, "none"));
@@ -1071,24 +985,6 @@
Args.hasArg(OPT_ffunction_sections) ||
(Opts.BBSections != "none" && Opts.BBSections != "labels");
- Opts.DataSections = Args.hasArg(OPT_fdata_sections);
- Opts.StackSizeSection = Args.hasArg(OPT_fstack_size_section);
- Opts.UniqueSectionNames = !Args.hasArg(OPT_fno_unique_section_names);
- Opts.UniqueBasicBlockSectionNames =
- Args.hasArg(OPT_funique_basic_block_section_names);
- Opts.UniqueInternalLinkageNames =
- Args.hasArg(OPT_funique_internal_linkage_names);
-
- Opts.SplitMachineFunctions = Args.hasArg(OPT_fsplit_machine_functions);
-
- Opts.MergeFunctions = Args.hasArg(OPT_fmerge_functions);
-
- Opts.NoUseJumpTables = Args.hasArg(OPT_fno_jump_tables);
-
- Opts.NullPointerIsValid = Args.hasArg(OPT_fno_delete_null_pointer_checks);
-
- Opts.ProfileSampleAccurate = Args.hasArg(OPT_fprofile_sample_accurate);
-
Opts.PrepareForLTO = Args.hasArg(OPT_flto, OPT_flto_EQ);
Opts.PrepareForThinLTO = false;
if (Arg *A = Args.getLastArg(OPT_flto_EQ)) {
@@ -1098,8 +994,6 @@
else if (S != "full")
Diags.Report(diag::err_drv_invalid_value) << A->getAsString(Args) << S;
}
- Opts.LTOUnit = Args.hasFlag(OPT_flto_unit, OPT_fno_lto_unit, false);
- Opts.EnableSplitLTOUnit = Args.hasArg(OPT_fsplit_lto_unit);
if (Arg *A = Args.getLastArg(OPT_fthinlto_index_EQ)) {
if (IK.getLanguage() != Language::LLVM_IR)
Diags.Report(diag::err_drv_argument_only_allowed_with)
@@ -1126,22 +1020,11 @@
} else if (Args.hasArg(OPT_fmemory_profile))
Opts.MemoryProfileOutput = MemProfileBasename;
- Opts.MSVolatile = Args.hasArg(OPT_fms_volatile);
-
- Opts.VectorizeLoop = Args.hasArg(OPT_vectorize_loops);
- Opts.VectorizeSLP = Args.hasArg(OPT_vectorize_slp);
-
Opts.PreferVectorWidth =
std::string(Args.getLastArgValue(OPT_mprefer_vector_width_EQ));
Opts.MainFileName = std::string(Args.getLastArgValue(OPT_main_file_name));
- Opts.VerifyModule = !Args.hasArg(OPT_disable_llvm_verifier);
-
- Opts.ControlFlowGuardNoChecks = Args.hasArg(OPT_cfguard_no_checks);
- Opts.ControlFlowGuard = Args.hasArg(OPT_cfguard);
- Opts.EmitGcovNotes = Args.hasArg(OPT_ftest_coverage);
- Opts.EmitGcovArcs = Args.hasArg(OPT_fprofile_arcs);
if (Opts.EmitGcovArcs || Opts.EmitGcovNotes) {
Opts.CoverageDataFile =
std::string(Args.getLastArgValue(OPT_coverage_data_file));
@@ -1199,13 +1082,6 @@
}
}
- Opts.PreserveVec3Type = Args.hasArg(OPT_fpreserve_vec3_type);
- Opts.InstrumentFunctions = Args.hasArg(OPT_finstrument_functions);
- Opts.InstrumentFunctionsAfterInlining =
- Args.hasArg(OPT_finstrument_functions_after_inlining);
- Opts.InstrumentFunctionEntryBare =
- Args.hasArg(OPT_finstrument_function_entry_bare);
-
Opts.XRayInstructionThreshold =
getLastArgIntValue(Args, OPT_fxray_instruction_threshold_EQ, 200, Diags);
Opts.XRayTotalFunctionGroups =
@@ -1226,11 +1102,6 @@
getLastArgIntValue(Args, OPT_fpatchable_function_entry_EQ, 0, Diags);
Opts.PatchableFunctionEntryOffset = getLastArgIntValue(
Args, OPT_fpatchable_function_entry_offset_EQ, 0, Diags);
- Opts.InstrumentForProfiling = Args.hasArg(OPT_pg);
- Opts.CallFEntry = Args.hasArg(OPT_mfentry);
- Opts.MNopMCount = Args.hasArg(OPT_mnop_mcount);
- Opts.RecordMCount = Args.hasArg(OPT_mrecord_mcount);
- Opts.PackedStack = Args.hasArg(OPT_mpacked_stack);
if (const Arg *A = Args.getLastArg(OPT_fcf_protection_EQ)) {
StringRef Name = A->getValue();
@@ -1256,7 +1127,6 @@
Opts.setCompressDebugSections(DCT);
}
- Opts.RelaxELFRelocations = Args.hasArg(OPT_mrelax_relocations);
Opts.DebugCompilationDir =
std::string(Args.getLastArgValue(OPT_fdebug_compilation_dir));
for (auto *A :
@@ -1274,61 +1144,12 @@
}
Opts.SanitizeCoverageType =
getLastArgIntValue(Args, OPT_fsanitize_coverage_type, 0, Diags);
- Opts.SanitizeCoverageIndirectCalls =
- Args.hasArg(OPT_fsanitize_coverage_indirect_calls);
- Opts.SanitizeCoverageTraceBB = Args.hasArg(OPT_fsanitize_coverage_trace_bb);
- Opts.SanitizeCoverageTraceCmp = Args.hasArg(OPT_fsanitize_coverage_trace_cmp);
- Opts.SanitizeCoverageTraceDiv = Args.hasArg(OPT_fsanitize_coverage_trace_div);
- Opts.SanitizeCoverageTraceGep = Args.hasArg(OPT_fsanitize_coverage_trace_gep);
- Opts.SanitizeCoverage8bitCounters =
- Args.hasArg(OPT_fsanitize_coverage_8bit_counters);
- Opts.SanitizeCoverageTracePC = Args.hasArg(OPT_fsanitize_coverage_trace_pc);
- Opts.SanitizeCoverageTracePCGuard =
- Args.hasArg(OPT_fsanitize_coverage_trace_pc_guard);
- Opts.SanitizeCoverageNoPrune = Args.hasArg(OPT_fsanitize_coverage_no_prune);
- Opts.SanitizeCoverageInline8bitCounters =
- Args.hasArg(OPT_fsanitize_coverage_inline_8bit_counters);
- Opts.SanitizeCoverageInlineBoolFlag =
- Args.hasArg(OPT_fsanitize_coverage_inline_bool_flag);
- Opts.SanitizeCoveragePCTable = Args.hasArg(OPT_fsanitize_coverage_pc_table);
- Opts.SanitizeCoverageStackDepth =
- Args.hasArg(OPT_fsanitize_coverage_stack_depth);
Opts.SanitizeCoverageAllowlistFiles =
Args.getAllArgValues(OPT_fsanitize_coverage_allowlist);
Opts.SanitizeCoverageBlocklistFiles =
Args.getAllArgValues(OPT_fsanitize_coverage_blocklist);
Opts.SanitizeMemoryTrackOrigins =
getLastArgIntValue(Args, OPT_fsanitize_memory_track_origins_EQ, 0, Diags);
- Opts.SanitizeMemoryUseAfterDtor =
- Args.hasFlag(OPT_fsanitize_memory_use_after_dtor,
- OPT_fno_sanitize_memory_use_after_dtor,
- false);
- Opts.SanitizeMinimalRuntime = Args.hasArg(OPT_fsanitize_minimal_runtime);
- Opts.SanitizeCfiCrossDso = Args.hasArg(OPT_fsanitize_cfi_cross_dso);
- Opts.SanitizeCfiICallGeneralizePointers =
- Args.hasArg(OPT_fsanitize_cfi_icall_generalize_pointers);
- Opts.SanitizeCfiCanonicalJumpTables =
- Args.hasArg(OPT_fsanitize_cfi_canonical_jump_tables);
- Opts.SanitizeStats = Args.hasArg(OPT_fsanitize_stats);
- if (Arg *A = Args.getLastArg(
- OPT_fsanitize_address_poison_custom_array_cookie,
- OPT_fno_sanitize_address_poison_custom_array_cookie)) {
- Opts.SanitizeAddressPoisonCustomArrayCookie =
- A->getOption().getID() ==
- OPT_fsanitize_address_poison_custom_array_cookie;
- }
- if (Arg *A = Args.getLastArg(OPT_fsanitize_address_use_after_scope,
- OPT_fno_sanitize_address_use_after_scope)) {
- Opts.SanitizeAddressUseAfterScope =
- A->getOption().getID() == OPT_fsanitize_address_use_after_scope;
- }
- Opts.SanitizeAddressGlobalsDeadStripping =
- Args.hasArg(OPT_fsanitize_address_globals_dead_stripping);
- if (Arg *A = Args.getLastArg(OPT_fsanitize_address_use_odr_indicator,
- OPT_fno_sanitize_address_use_odr_indicator)) {
- Opts.SanitizeAddressUseOdrIndicator =
- A->getOption().getID() == OPT_fsanitize_address_use_odr_indicator;
- }
Opts.SSPBufferSize =
getLastArgIntValue(Args, OPT_stack_protector_buffer_size, 8, Diags);
@@ -1346,7 +1167,6 @@
std::string(Args.getLastArgValue(OPT_mstack_protector_guard_reg_EQ,
"none"));
- Opts.StackRealignment = Args.hasArg(OPT_mstackrealign);
if (Arg *A = Args.getLastArg(OPT_mstack_alignment)) {
StringRef Val = A->getValue();
unsigned StackAlignment = Opts.StackAlignment;
@@ -1361,10 +1181,6 @@
Opts.StackProbeSize = StackProbeSize;
}
- Opts.NoStackArgProbe = Args.hasArg(OPT_mno_stack_arg_probe);
-
- Opts.StackClashProtector = Args.hasArg(OPT_fstack_clash_protection);
-
if (Arg *A = Args.getLastArg(OPT_fobjc_dispatch_method_EQ)) {
StringRef Name = A->getValue();
unsigned Method = llvm::StringSwitch<unsigned>(Name)
@@ -1382,9 +1198,6 @@
}
- if (Args.hasArg(OPT_fno_objc_convert_messages_to_runtime_calls))
- Opts.ObjCConvertMessagesToRuntimeCalls = 0;
-
if (Args.getLastArg(OPT_femulated_tls) ||
Args.getLastArg(OPT_fno_emulated_tls)) {
Opts.ExplicitEmulatedTLS = true;
@@ -1486,8 +1299,6 @@
NeedLocTracking = true;
}
- Opts.DiagnosticsWithHotness =
- Args.hasArg(options::OPT_fdiagnostics_show_hotness);
bool UsingSampleProfile = !Opts.SampleProfileFile.empty();
bool UsingProfile = UsingSampleProfile ||
(Opts.getProfileUse() != CodeGenOptions::ProfileNone);
@@ -1529,19 +1340,9 @@
Opts.CudaGpuBinaryFileName =
std::string(Args.getLastArgValue(OPT_fcuda_include_gpubinary));
- Opts.Backchain = Args.hasArg(OPT_mbackchain);
-
Opts.EmitCheckPathComponentsToStrip = getLastArgIntValue(
Args, OPT_fsanitize_undefined_strip_path_components_EQ, 0, Diags);
- Opts.EmitVersionIdentMetadata = Args.hasFlag(OPT_Qy, OPT_Qn, true);
-
- Opts.Addrsig = Args.hasArg(OPT_faddrsig);
-
- Opts.KeepStaticConsts = Args.hasArg(OPT_fkeep_static_consts);
-
- Opts.SpeculativeLoadHardening = Args.hasArg(OPT_mspeculative_load_hardening);
-
Opts.DefaultFunctionAttrs = Args.getAllArgValues(OPT_default_function_attr);
Opts.PassPlugins = Args.getAllArgValues(OPT_fpass_plugin_EQ);
@@ -1549,12 +1350,6 @@
Opts.SymbolPartition =
std::string(Args.getLastArgValue(OPT_fsymbol_partition_EQ));
- Opts.ForceAAPCSBitfieldLoad = Args.hasArg(OPT_ForceAAPCSBitfieldLoad);
- Opts.AAPCSBitfieldWidth =
- Args.hasFlag(OPT_AAPCSBitfieldWidth, OPT_ForceNoAAPCSBitfieldWidth, true);
-
- Opts.PassByValueIsNoAlias = Args.hasArg(OPT_fpass_by_value_is_noalias);
-
return Success;
}
Index: clang/include/clang/Driver/Options.td
===================================================================
--- clang/include/clang/Driver/Options.td
+++ clang/include/clang/Driver/Options.td
@@ -243,7 +243,11 @@
// A boolean option which is opt-in in CC1. The positive option exists in CC1 and
// Args.hasArg(OPT_ffoo) is used to check that the flag is enabled.
-// This is useful if the option is usually disabled.
+//
+// This is useful if the option has positive semantics (e.g. `FastMath`) that is by
+// default disabled (FastMath == false), can be reaffirmed by -fno-fast-math
+// (FastMath == false) and enabled by -ffast-math (FastMath == true).
+// todo: rename to OptInPositiveFFlag
multiclass OptInFFlag<string name, string pos_prefix, string neg_prefix="",
string help="", list<OptionFlag> flags=[], code keypath="",
list<Option> enablers = []> {
@@ -255,8 +259,29 @@
Group<f_Group>, HelpText<!strconcat(neg_prefix, help)>;
}
+// A boolean option which is opt-out in CC1. The negative option exists in CC1 and
+// Args.has(OPT_ffoo) or !Arg.has(OPT_fno_foo) is used to check that the flag is disabled.
+//
+// This is useful if the option has positive semantics (e.g. `Autolink`) that is by
+// default enabled (Autolink == true), can be reaffirmed by -fautolink
+// (Autolink == true) and disabled by -fno-autolink (Autolink == false).
+// todo: add ImpliedByAnyOf if necessary
+multiclass OptOutPositiveFFlag<string name, string pos_prefix, string neg_prefix,
+ string help="", list<OptionFlag> flags=[], code keypath=""> {
+ def f#NAME : Flag<["-"], "f"#name>, Flags<flags>,
+ Group<f_Group>, HelpText<!strconcat(pos_prefix, help)>;
+ def fno_#NAME : Flag<["-"], "fno-"#name>, Flags<!listconcat([CC1Option], flags)>,
+ Group<f_Group>, HelpText<!strconcat(neg_prefix, help)>,
+ MarshallingInfoFlag<keypath, "true">, IsNegative;
+}
+
// A boolean option which is opt-out in CC1. The negative option exists in CC1 and
// Args.hasArg(OPT_fno_foo) is used to check that the flag is disabled.
+//
+// This is useful if the option has negative semantics (e.g. `NoUseJumpTables`) that
+// is by default disabled (NoUseJumpTables == false), can be reaffirmed by -fuse-jump-tables
+// (NoUseJumpTables == false) and enabled by -fno-use-jump-tables (NoUseJumpTables == true).
+// todo: rename to OptInNegativeFFlag
multiclass OptOutFFlag<string name, string pos_prefix, string neg_prefix,
string help="", list<OptionFlag> flags=[], code keypath="",
list<Option> disablers = []> {
@@ -478,10 +503,11 @@
def Ofast : Joined<["-"], "Ofast">, Group<O_Group>, Flags<[CC1Option]>;
def P : Flag<["-"], "P">, Flags<[CC1Option]>, Group<Preprocessor_Group>,
HelpText<"Disable linemarker output in -E mode">;
-def Qy : Flag<["-"], "Qy">, Flags<[CC1Option]>,
- HelpText<"Emit metadata containing compiler name and version">;
def Qn : Flag<["-"], "Qn">, Flags<[CC1Option]>,
HelpText<"Do not emit metadata containing compiler name and version">;
+def Qy : Flag<["-"], "Qy">, Flags<[CC1Option]>,
+ HelpText<"Emit metadata containing compiler name and version">,
+ MarshallingInfoBooleanFlag<"CodeGenOpts.EmitVersionIdentMetadata", "true", Qn>;
def : Flag<["-"], "fident">, Group<f_Group>, Alias<Qy>, Flags<[CC1Option]>;
def : Flag<["-"], "fno-ident">, Group<f_Group>, Alias<Qn>, Flags<[CC1Option]>;
def Qunused_arguments : Flag<["-"], "Qunused-arguments">, Flags<[NoXarchOption, CoreOption]>,
@@ -799,7 +825,8 @@
Group<f_Group>, Flags<[NoXarchOption, CC1Option]>,
HelpText<"Disable '[[]]' attributes in all C and C++ language modes">;
-defm autolink : OptOutFFlag<"autolink", "", "Disable generation of linker directives for automatic library linking">;
+defm autolink : OptOutPositiveFFlag<"autolink", "", "Disable generation of linker directives for automatic library linking",
+ "", [], "CodeGenOpts.Autolink">;
// C++ Coroutines TS
defm coroutines_ts : OptInFFlag<"coroutines-ts", "Enable support for the C++ Coroutines TS">;
@@ -828,7 +855,8 @@
DocBrief<[{Specifies that the sample profile is accurate. If the sample
profile is accurate, callsites without profile samples are marked
as cold. Otherwise, treat callsites without profile samples as if
- we have no profile}]>;
+ we have no profile}]>,
+ MarshallingInfoFlag<"CodeGenOpts.ProfileSampleAccurate">;
def fno_profile_sample_accurate : Flag<["-"], "fno-profile-sample-accurate">,
Group<f_Group>, Flags<[NoXarchOption]>;
def fauto_profile : Flag<["-"], "fauto-profile">, Group<f_Group>,
@@ -848,7 +876,7 @@
Group<f_Group>, Flags<[CC1Option, CC1AsOption, CoreOption]>,
Alias<fdebug_compilation_dir>;
defm debug_info_for_profiling : OptInFFlag<"debug-info-for-profiling",
- "Emit extra debug info to make sample profile more accurate">;
+ "Emit extra debug info to make sample profile more accurate", "", "", [], "CodeGenOpts.DebugInfoForProfiling">;
def fprofile_instr_generate : Flag<["-"], "fprofile-instr-generate">,
Group<f_Group>, Flags<[CoreOption]>,
HelpText<"Generate instrumented code to collect execution counts into default.profraw file (overridden by '=' form of option or LLVM_PROFILE_FILE env var)">;
@@ -867,7 +895,7 @@
Group<f_Group>, Flags<[CoreOption]>, Alias<fprofile_remapping_file_EQ>;
defm coverage_mapping : OptInFFlag<"coverage-mapping",
"Generate coverage mapping to enable code coverage analysis", "Disable code coverage analysis", "",
- [CoreOption]>;
+ [CoreOption], "CodeGenOpts.CoverageMapping">;
def fprofile_generate : Flag<["-"], "fprofile-generate">,
Group<f_Group>, Flags<[CoreOption]>,
HelpText<"Generate instrumented code to collect execution counts into default.profraw (overridden by LLVM_PROFILE_FILE env var)">;
@@ -904,12 +932,13 @@
HelpText<"Instrument only functions from files where names don't match all the regexes separated by a semi-colon">;
def fprofile_update_EQ : Joined<["-"], "fprofile-update=">,
Group<f_Group>, Flags<[CC1Option, CoreOption]>, Values<"atomic,prefer-atomic,single">,
- MetaVarName<"<method>">, HelpText<"Set update method of profile counters (atomic,prefer-atomic,single)">;
+ MetaVarName<"<method>">, HelpText<"Set update method of profile counters (atomic,prefer-atomic,single)">,
+ MarshallingInfoFlag<"CodeGenOpts.AtomicProfileUpdate">;
def forder_file_instrumentation : Flag<["-"], "forder-file-instrumentation">,
Group<f_Group>, Flags<[CC1Option, CoreOption]>,
HelpText<"Generate instrumented code to collect order file into default.profraw file (overridden by '=' form of option or LLVM_PROFILE_FILE env var)">;
-defm addrsig : OptInFFlag<"addrsig", "Emit", "Don't emit", " an address-significance table", [CoreOption]>;
+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<f_Group>;
def fborland_extensions : Flag<["-"], "fborland-extensions">, Group<f_Group>, Flags<[CC1Option]>,
@@ -942,7 +971,8 @@
def : Flag<["-"], "frecord-gcc-switches">, Alias<frecord_command_line>;
def : Flag<["-"], "fno-record-gcc-switches">, Alias<fno_record_command_line>;
def fcommon : Flag<["-"], "fcommon">, Group<f_Group>,
- Flags<[CoreOption, CC1Option]>, HelpText<"Place uninitialized global variables in a common block">;
+ 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<f_Group>;
def fcomplete_member_pointers : Flag<["-"], "fcomplete-member-pointers">, Group<f_clang_Group>,
Flags<[CoreOption, CC1Option]>,
@@ -977,8 +1007,8 @@
def fdiagnostics_print_source_range_info : Flag<["-"], "fdiagnostics-print-source-range-info">,
Group<f_clang_Group>, Flags<[CC1Option]>,
HelpText<"Print source range spans in numeric form">;
-def fdiagnostics_show_hotness : Flag<["-"], "fdiagnostics-show-hotness">, Group<f_Group>,
- Flags<[CC1Option]>, HelpText<"Enable profile hotness information in diagnostic line">;
+defm diagnostics_show_hotness : OptInFFlag<"diagnostics-show-hotness",
+ "Enable profile hotness information in diagnostic line", "", "", [], "CodeGenOpts.DiagnosticsWithHotness">;
def fdiagnostics_hotness_threshold_EQ : Joined<["-"], "fdiagnostics-hotness-threshold=">,
Group<f_Group>, Flags<[CC1Option]>, MetaVarName<"<number>">,
HelpText<"Prevent optimization remarks from being output if they do not have at least this profile count">;
@@ -1001,7 +1031,7 @@
HelpText<"Allow '$' in identifiers">, Flags<[CC1Option]>;
def fdwarf2_cfi_asm : Flag<["-"], "fdwarf2-cfi-asm">, Group<clang_ignored_f_Group>;
def fno_dwarf2_cfi_asm : Flag<["-"], "fno-dwarf2-cfi-asm">, Group<clang_ignored_f_Group>;
-defm dwarf_directory_asm : OptOutFFlag<"dwarf-directory-asm", "", "">;
+defm dwarf_directory_asm : OptOutFFlag<"dwarf-directory-asm", "", "", "", [], "CodeGenOpts.NoDwarfDirectoryAsm">;
def felide_constructors : Flag<["-"], "felide-constructors">, Group<f_Group>;
def fno_elide_type : Flag<["-"], "fno-elide-type">, Group<f_Group>,
Flags<[CC1Option]>,
@@ -1052,9 +1082,9 @@
def fbracket_depth_EQ : Joined<["-"], "fbracket-depth=">, Group<f_Group>, Flags<[CoreOption]>;
def fsignaling_math : Flag<["-"], "fsignaling-math">, Group<f_Group>;
def fno_signaling_math : Flag<["-"], "fno-signaling-math">, Group<f_Group>;
-defm jump_tables : OptOutFFlag<"jump-tables", "Use", "Do not use", " jump tables for lowering switches">;
+defm jump_tables : OptOutFFlag<"jump-tables", "Use", "Do not use", " jump tables for lowering switches", [], "CodeGenOpts.NoUseJumpTables">;
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]>;
+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">;
@@ -1116,41 +1146,39 @@
Group<f_clang_Group>,
Flags<[CoreOption, NoXarchOption]>,
HelpText<"Disable origins tracking in MemorySanitizer">;
-def fsanitize_memory_use_after_dtor : Flag<["-"], "fsanitize-memory-use-after-dtor">,
- Group<f_clang_Group>,
- HelpText<"Enable use-after-destroy detection in MemorySanitizer">;
-def fno_sanitize_memory_use_after_dtor : Flag<["-"], "fno-sanitize-memory-use-after-dtor">,
- Group<f_clang_Group>,
- HelpText<"Disable use-after-destroy detection in MemorySanitizer">;
+// todo: simplify this into a version of OptInFFlag that doesn't append CC1Option flag
+defm sanitize_memory_use_after_dtor : BooleanMarshalledFFlag<"sanitize-memory-use-after-dtor",
+ "CodeGenOpts.SanitizeMemoryUseAfterDtor", "false",
+ "Enable use-after-destroy detection in MemorySanitizer", "Disable use-after-destroy detection in MemorySanitizer">,
+ Group<f_clang_Group>;
def fsanitize_address_field_padding : Joined<["-"], "fsanitize-address-field-padding=">,
Group<f_clang_Group>,
HelpText<"Level of field padding for AddressSanitizer">;
-def fsanitize_address_use_after_scope : Flag<["-"], "fsanitize-address-use-after-scope">,
- Group<f_clang_Group>,
- HelpText<"Enable use-after-scope detection in AddressSanitizer">;
+// todo: simplify these into a version of OptInFFlag that accepts different flags for each record
def fno_sanitize_address_use_after_scope : Flag<["-"], "fno-sanitize-address-use-after-scope">,
Group<f_clang_Group>,
Flags<[CoreOption, NoXarchOption]>,
HelpText<"Disable use-after-scope detection in AddressSanitizer">;
-def fsanitize_address_poison_custom_array_cookie
- : Flag<[ "-" ], "fsanitize-address-poison-custom-array-cookie">,
- Group<f_clang_Group>,
- HelpText<"Enable poisoning array cookies when using custom operator new[] in AddressSanitizer">;
-def fno_sanitize_address_poison_custom_array_cookie
- : Flag<[ "-" ], "fno-sanitize-address-poison-custom-array-cookie">,
- Group<f_clang_Group>,
- HelpText<"Disable poisoning array cookies when using custom operator new[] in AddressSanitizer">;
-def fsanitize_address_globals_dead_stripping : Flag<["-"], "fsanitize-address-globals-dead-stripping">,
+def fsanitize_address_use_after_scope : Flag<["-"], "fsanitize-address-use-after-scope">,
Group<f_clang_Group>,
- HelpText<"Enable linker dead stripping of globals in AddressSanitizer">;
-def fsanitize_address_use_odr_indicator
- : Flag<["-"], "fsanitize-address-use-odr-indicator">,
- Group<f_clang_Group>,
- HelpText<"Enable ODR indicator globals to avoid false ODR violation reports in partially sanitized programs at the cost of an increase in binary size">;
-def fno_sanitize_address_use_odr_indicator
- : Flag<["-"], "fno-sanitize-address-use-odr-indicator">,
- Group<f_clang_Group>,
- HelpText<"Disable ODR indicator globals">;
+ HelpText<"Enable use-after-scope detection in AddressSanitizer">,
+ MarshallingInfoBooleanFlag<"CodeGenOpts.SanitizeAddressUseAfterScope", "false",
+ fno_sanitize_address_use_after_scope>;
+// todo: simplify this into a version of OptInFFlag that doesn't append CC1Option flag
+defm sanitize_address_poison_custom_array_cookie : BooleanMarshalledFFlag<"sanitize-address-poison-custom-array-cookie",
+ "CodeGenOpts.SanitizeAddressPoisonCustomArrayCookie", "false",
+ "Enable poisoning array cookies when using custom operator new[] in AddressSanitizer",
+ "Disable poisoning array cookies when using custom operator new[] in AddressSanitizer">,
+ Group<f_clang_Group>;
+def fsanitize_address_globals_dead_stripping : Flag<["-"], "fsanitize-address-globals-dead-stripping">,
+ Group<f_clang_Group>, HelpText<"Enable linker dead stripping of globals in AddressSanitizer">,
+ MarshallingInfoFlag<"CodeGenOpts.SanitizeAddressGlobalsDeadStripping", "false">;
+// todo: simplify this into a version of OptInFFlag that doesn't append CC1Option flag
+defm sanitize_address_use_odr_indicator : BooleanMarshalledFFlag<"sanitize-address-use-odr-indicator",
+ "CodeGenOpts.SanitizeAddressUseOdrIndicator", "false",
+ "Enable ODR indicator globals to avoid false ODR violation reports in partially sanitized programs at the cost of an increase in binary size",
+ "Disable ODR indicator globals">,
+ Group<f_clang_Group>;
// Note: This flag was introduced when it was necessary to distinguish between
// ABI for correct codegen. This is no longer needed, but the flag is
// not removed since targeting either ABI will behave the same.
@@ -1190,10 +1218,9 @@
def fno_sanitize_undefined_trap_on_error
: Flag<["-"], "fno-sanitize-undefined-trap-on-error">, Group<f_clang_Group>,
Alias<fno_sanitize_trap_EQ>, AliasArgs<["undefined"]>;
-def fsanitize_minimal_runtime : Flag<["-"], "fsanitize-minimal-runtime">,
- Group<f_clang_Group>;
-def fno_sanitize_minimal_runtime : Flag<["-"], "fno-sanitize-minimal-runtime">,
- Group<f_clang_Group>;
+// todo: simplify this into a version of OptInFFlag that doesn't append CC1Option flag
+defm sanitize_minimal_runtime : BooleanMarshalledFFlag<"sanitize-minimal-runtime",
+ "CodeGenOpts.SanitizeMinimalRuntime", "false", "", "">, Group<f_clang_Group>;
def fsanitize_link_runtime : Flag<["-"], "fsanitize-link-runtime">,
Group<f_clang_Group>;
def fno_sanitize_link_runtime : Flag<["-"], "fno-sanitize-link-runtime">,
@@ -1202,26 +1229,33 @@
Group<f_clang_Group>;
def fno_sanitize_link_cxx_runtime : Flag<["-"], "fno-sanitize-link-c++-runtime">,
Group<f_clang_Group>;
+// todo: simplify these into a version of OptInFFlag that accepts different flags for each record
def fsanitize_cfi_cross_dso : Flag<["-"], "fsanitize-cfi-cross-dso">,
Group<f_clang_Group>,
- HelpText<"Enable control flow integrity (CFI) checks for cross-DSO calls.">;
+ HelpText<"Enable control flow integrity (CFI) checks for cross-DSO calls.">,
+ MarshallingInfoFlag<"CodeGenOpts.SanitizeCfiCrossDso">;
def fno_sanitize_cfi_cross_dso : Flag<["-"], "fno-sanitize-cfi-cross-dso">,
Flags<[CoreOption, NoXarchOption]>,
Group<f_clang_Group>,
HelpText<"Disable control flow integrity (CFI) checks for cross-DSO calls.">;
def fsanitize_cfi_icall_generalize_pointers : Flag<["-"], "fsanitize-cfi-icall-generalize-pointers">,
Group<f_clang_Group>,
- HelpText<"Generalize pointers in CFI indirect call type signature checks">;
+ HelpText<"Generalize pointers in CFI indirect call type signature checks">,
+ MarshallingInfoFlag<"CodeGenOpts.SanitizeCfiICallGeneralizePointers">;
+// todo: simplify these into a version of OptInFFlag that accepts different flags for each record
def fsanitize_cfi_canonical_jump_tables : Flag<["-"], "fsanitize-cfi-canonical-jump-tables">,
Group<f_clang_Group>,
- HelpText<"Make the jump table addresses canonical in the symbol table">;
+ HelpText<"Make the jump table addresses canonical in the symbol table">,
+ MarshallingInfoFlag<"CodeGenOpts.SanitizeCfiCanonicalJumpTables">;
def fno_sanitize_cfi_canonical_jump_tables : Flag<["-"], "fno-sanitize-cfi-canonical-jump-tables">,
Group<f_clang_Group>,
Flags<[CoreOption, NoXarchOption]>,
HelpText<"Do not make the jump table addresses canonical in the symbol table">;
+// todo: simplify these into a version of OptInFFlag that accepts different flags for each record
def fsanitize_stats : Flag<["-"], "fsanitize-stats">,
Group<f_clang_Group>,
- HelpText<"Enable sanitizer statistics gathering.">;
+ HelpText<"Enable sanitizer statistics gathering.">,
+ MarshallingInfoFlag<"CodeGenOpts.SanitizeStats">;
def fno_sanitize_stats : Flag<["-"], "fno-sanitize-stats">,
Group<f_clang_Group>,
Flags<[CoreOption, NoXarchOption]>,
@@ -1284,9 +1318,10 @@
" | on (according to FP_CONTRACT pragma) | off (never fuse). Default"
" is 'fast' for CUDA/HIP and 'on' otherwise.">, Values<"fast,on,off">;
-defm strict_float_cast_overflow : OptOutFFlag<"strict-float-cast-overflow",
+defm strict_float_cast_overflow : OptOutPositiveFFlag<"strict-float-cast-overflow",
"Assume that overflowing float-to-int casts are undefined (default)",
- "Relax language rules and try to match the behavior of the target's native float-to-int conversion instructions">;
+ "Relax language rules and try to match the behavior of the target's native float-to-int conversion instructions",
+ "", [], "CodeGenOpts.StrictFloatCastOverflow">;
def ffor_scope : Flag<["-"], "ffor-scope">, Group<f_Group>;
def fno_for_scope : Flag<["-"], "fno-for-scope">, Group<f_Group>;
@@ -1297,7 +1332,7 @@
defm delete_null_pointer_checks : OptOutFFlag<"delete-null-pointer-checks",
"Treat usage of null pointers as undefined behavior (default)",
"Do not treat usage of null pointers as undefined behavior",
- "", [CoreOption]>;
+ "", [CoreOption], "CodeGenOpts.NullPointerIsValid">;
def frewrite_map_file : Separate<["-"], "frewrite-map-file">,
Group<f_Group>,
@@ -1341,11 +1376,14 @@
def finput_charset_EQ : Joined<["-"], "finput-charset=">, Group<f_Group>;
def fexec_charset_EQ : Joined<["-"], "fexec-charset=">, Group<f_Group>;
def finstrument_functions : Flag<["-"], "finstrument-functions">, Group<f_Group>, Flags<[CC1Option]>,
- HelpText<"Generate calls to instrument function entry and exit">;
+ HelpText<"Generate calls to instrument function entry and exit">,
+ MarshallingInfoFlag<"CodeGenOpts.InstrumentFunctions">;
def finstrument_functions_after_inlining : Flag<["-"], "finstrument-functions-after-inlining">, Group<f_Group>, Flags<[CC1Option]>,
- HelpText<"Like -finstrument-functions, but insert the calls after inlining">;
+ HelpText<"Like -finstrument-functions, but insert the calls after inlining">,
+ MarshallingInfoFlag<"CodeGenOpts.InstrumentFunctionsAfterInlining">;
def finstrument_function_entry_bare : Flag<["-"], "finstrument-function-entry-bare">, Group<f_Group>, Flags<[CC1Option]>,
- HelpText<"Instrument function entry only, after inlining, without arguments to the instrumentation call">;
+ HelpText<"Instrument function entry only, after inlining, without arguments to the instrumentation call">,
+ MarshallingInfoFlag<"CodeGenOpts.InstrumentFunctionEntryBare">;
def fcf_protection_EQ : Joined<["-"], "fcf-protection=">, Flags<[CoreOption, CC1Option]>, Group<f_Group>,
HelpText<"Instrument control-flow architecture protection. Options: return, branch, full, none.">, Values<"return,branch,full,none">;
def fcf_protection : Flag<["-"], "fcf-protection">, Group<f_Group>, Flags<[CoreOption, CC1Option]>,
@@ -1412,12 +1450,10 @@
HelpText<"When using -fxray-function-groups, select which group of functions to instrument. Valid range is 0 to fxray-function-groups - 1">;
-def ffine_grained_bitfield_accesses : Flag<["-"],
- "ffine-grained-bitfield-accesses">, Group<f_clang_Group>, Flags<[CC1Option]>,
- HelpText<"Use separate accesses for consecutive bitfield runs with legal widths and alignments.">;
-def fno_fine_grained_bitfield_accesses : Flag<["-"],
- "fno-fine-grained-bitfield-accesses">, Group<f_clang_Group>, Flags<[CC1Option]>,
- HelpText<"Use large-integer access for consecutive bitfield runs.">;
+defm fine_grained_bitfield_accesses : BooleanMarshalledFFlag<"fine-grained-bitfield-accesses",
+ "CodeGenOpts.FineGrainedBitfieldAccesses", "false",
+ "Use separate accesses for consecutive bitfield runs with legal widths and alignments.",
+ "Use large-integer access for consecutive bitfield runs.">, Group<f_clang_Group>, Flags<[CC1Option]>;
def fexperimental_relative_cxx_abi_vtables : Flag<["-"], "fexperimental-relative-c++-abi-vtables">,
Group<f_Group>, Flags<[CC1Option]>,
@@ -1453,15 +1489,20 @@
HelpText<"Write minimized bitcode to <file> for the ThinLTO thin link only">;
def fmacro_backtrace_limit_EQ : Joined<["-"], "fmacro-backtrace-limit=">,
Group<f_Group>, Flags<[NoXarchOption, CoreOption]>;
+// todo: simplify these into a version of OptInFFlag that accepts different flags for each record
def fmerge_all_constants : Flag<["-"], "fmerge-all-constants">, Group<f_Group>,
- Flags<[CC1Option, CoreOption]>, HelpText<"Allow merging of constants">;
+ Flags<[CC1Option, CoreOption]>, HelpText<"Allow merging of constants">,
+ MarshallingInfoFlag<"CodeGenOpts.MergeAllConstants">;
+def fno_merge_all_constants : Flag<["-"], "fno-merge-all-constants">, Group<f_Group>,
+ HelpText<"Disallow merging of constants">;
def fmessage_length_EQ : Joined<["-"], "fmessage-length=">, Group<f_Group>, Flags<[CC1Option]>,
HelpText<"Format message diagnostics so that they fit within N columns">;
def fms_extensions : Flag<["-"], "fms-extensions">, Group<f_Group>, Flags<[CC1Option, CoreOption]>,
HelpText<"Accept some non-standard constructs supported by the Microsoft compiler">;
def fms_compatibility : Flag<["-"], "fms-compatibility">, Group<f_Group>, Flags<[CC1Option, CoreOption]>,
HelpText<"Enable full Microsoft Visual C++ compatibility">;
-def fms_volatile : Flag<["-"], "fms-volatile">, Group<f_Group>, Flags<[CC1Option]>;
+def fms_volatile : Flag<["-"], "fms-volatile">, Group<f_Group>, Flags<[CC1Option]>,
+ MarshallingInfoFlag<"CodeGenOpts.MSVolatile">;
def fmsc_version : Joined<["-"], "fmsc-version=">, Group<f_Group>, Flags<[NoXarchOption, CoreOption]>,
HelpText<"Microsoft compiler version number to report in _MSC_VER (0 = don't define it (default))">;
def fms_compatibility_version
@@ -1597,7 +1638,7 @@
def fno_asynchronous_unwind_tables : Flag<["-"], "fno-asynchronous-unwind-tables">, Group<f_Group>;
def fno_assume_sane_operator_new : Flag<["-"], "fno-assume-sane-operator-new">, Group<f_Group>,
HelpText<"Don't assume that C++'s global operator new can't alias any pointer">,
- Flags<[CC1Option]>;
+ Flags<[CC1Option]>, MarshallingInfoFlag<"CodeGenOpts.AssumeSaneOperatorNew", "true">, IsNegative;
def fno_borland_extensions : Flag<["-"], "fno-borland-extensions">, Group<f_Group>;
def fno_builtin : Flag<["-"], "fno-builtin">, Group<f_Group>, Flags<[CC1Option, CoreOption]>,
HelpText<"Disable implicit builtin knowledge of functions">;
@@ -1614,7 +1655,6 @@
Flags<[NoXarchOption]>;
def fno_diagnostics_fixit_info : Flag<["-"], "fno-diagnostics-fixit-info">, Group<f_Group>,
Flags<[CC1Option]>, HelpText<"Do not include fixit information in diagnostics">;
-def fno_diagnostics_show_hotness : Flag<["-"], "fno-diagnostics-show-hotness">, Group<f_Group>;
def fno_diagnostics_show_option : Flag<["-"], "fno-diagnostics-show-option">, Group<f_Group>, Flags<[CC1Option]>;
def fno_diagnostics_show_note_include_stack : Flag<["-"], "fno-diagnostics-show-note-include-stack">,
Flags<[CC1Option]>, Group<f_Group>;
@@ -1640,8 +1680,6 @@
HelpText<"Use the given vector functions library">, Values<"Accelerate,libmvec,MASSV,SVML,none">;
def fno_lax_vector_conversions : Flag<["-"], "fno-lax-vector-conversions">, Group<f_Group>,
Alias<flax_vector_conversions_EQ>, AliasArgs<["none"]>;
-def fno_merge_all_constants : Flag<["-"], "fno-merge-all-constants">, Group<f_Group>,
- HelpText<"Disallow merging of constants">;
def fno_modules : Flag <["-"], "fno-modules">, Group<f_Group>,
Flags<[NoXarchOption]>;
def fno_implicit_module_maps : Flag <["-"], "fno-implicit-module-maps">, Group<f_Group>,
@@ -1686,8 +1724,6 @@
def fstruct_path_tbaa : Flag<["-"], "fstruct-path-tbaa">, Group<f_Group>;
def fno_struct_path_tbaa : Flag<["-"], "fno-struct-path-tbaa">, Group<f_Group>;
def fno_strict_enums : Flag<["-"], "fno-strict-enums">, Group<f_Group>;
-def fno_strict_vtable_pointers: Flag<["-"], "fno-strict-vtable-pointers">,
- Group<f_Group>;
def fno_strict_overflow : Flag<["-"], "fno-strict-overflow">, Group<f_Group>;
def fno_temp_file : Flag<["-"], "fno-temp-file">, Group<f_Group>,
Flags<[CC1Option, CoreOption]>, HelpText<
@@ -1695,25 +1731,22 @@
MarshallingInfoFlag<"FrontendOpts.UseTemporary", "true">, IsNegative;
def fno_threadsafe_statics : Flag<["-"], "fno-threadsafe-statics">, Group<f_Group>,
Flags<[CC1Option]>, HelpText<"Do not emit code to make initialization of local statics thread safe">;
-def fno_use_cxa_atexit : Flag<["-"], "fno-use-cxa-atexit">, Group<f_Group>, Flags<[CC1Option]>,
- HelpText<"Don't use __cxa_atexit for calling destructors">;
-def fno_register_global_dtors_with_atexit : Flag<["-"], "fno-register-global-dtors-with-atexit">, Group<f_Group>,
- HelpText<"Don't use atexit or __cxa_atexit to register global destructors">;
+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<f_Group>;
def fno_unwind_tables : Flag<["-"], "fno-unwind-tables">, Group<f_Group>;
-def fno_verbose_asm : Flag<["-"], "fno-verbose-asm">, Group<f_Group>, Flags<[CC1Option]>;
+def fno_verbose_asm : Flag<["-"], "fno-verbose-asm">, Group<f_Group>, Flags<[CC1Option]>,
+ MarshallingInfoFlag<"CodeGenOpts.AsmVerbose", "true">, IsNegative;
def fno_working_directory : Flag<["-"], "fno-working-directory">, Group<f_Group>;
def fno_wrapv : Flag<["-"], "fno-wrapv">, Group<f_Group>;
def fobjc_arc : Flag<["-"], "fobjc-arc">, Group<f_Group>, Flags<[CC1Option]>,
HelpText<"Synthesize retain and release calls for Objective-C pointers">;
def fno_objc_arc : Flag<["-"], "fno-objc-arc">, Group<f_Group>;
-def fobjc_convert_messages_to_runtime_calls :
- Flag<["-"], "fobjc-convert-messages-to-runtime-calls">, Group<f_Group>;
-def fno_objc_convert_messages_to_runtime_calls :
- Flag<["-"], "fno-objc-convert-messages-to-runtime-calls">, Group<f_Group>, Flags<[CC1Option]>;
-def fobjc_arc_exceptions : Flag<["-"], "fobjc-arc-exceptions">, Group<f_Group>, Flags<[CC1Option]>,
- HelpText<"Use EH-safe code when synthesizing retains and releases in -fobjc-arc">;
-def fno_objc_arc_exceptions : Flag<["-"], "fno-objc-arc-exceptions">, Group<f_Group>;
+defm objc_convert_messages_to_runtime_calls : OptOutPositiveFFlag<"objc-convert-messages-to-runtime-calls", "", "", "",
+ [], "CodeGenOpts.ObjCConvertMessagesToRuntimeCalls">;
+defm objc_arc_exceptions : OptInFFlag<"objc-arc-exceptions",
+ "Use EH-safe code when synthesizing retains and releases in -fobjc-arc",
+ "", "", [], "CodeGenOpts.ObjCAutoRefCountExceptions">;
def fobjc_atdefs : Flag<["-"], "fobjc-atdefs">, Group<clang_ignored_f_Group>;
def fobjc_call_cxx_cdtors : Flag<["-"], "fobjc-call-cxx-cdtors">, Group<clang_ignored_f_Group>;
def fobjc_exceptions: Flag<["-"], "fobjc-exceptions">, Group<f_Group>,
@@ -1814,8 +1847,7 @@
HelpText<"Use the static host OpenMP runtime while linking.">;
def fno_optimize_sibling_calls : Flag<["-"], "fno-optimize-sibling-calls">, Group<f_Group>;
def foptimize_sibling_calls : Flag<["-"], "foptimize-sibling-calls">, Group<f_Group>;
-def fno_escaping_block_tail_calls : Flag<["-"], "fno-escaping-block-tail-calls">, Group<f_Group>, Flags<[CC1Option]>;
-def fescaping_block_tail_calls : Flag<["-"], "fescaping-block-tail-calls">, Group<f_Group>;
+defm escaping_block_tail_calls : OptOutFFlag<"escaping-block-tail-calls", "", "", "", [], "CodeGenOpts.NoEscapingBlockTailCalls">;
def force__cpusubtype__ALL : Flag<["-"], "force_cpusubtype_ALL">;
def force__flat__namespace : Flag<["-"], "force_flat_namespace">;
def force__load : Separate<["-"], "force_load">;
@@ -1840,7 +1872,7 @@
def fpie : Flag<["-"], "fpie">, Group<f_Group>;
def fno_pie : Flag<["-"], "fno-pie">, Group<f_Group>;
defm plt : OptOutFFlag<"plt", "",
- "Use GOT indirection instead of PLT to make external function calls (x86 only)">;
+ "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)">;
def fplugin_EQ : Joined<["-"], "fplugin=">, Group<f_Group>, Flags<[NoXarchOption]>, MetaVarName<"<dsopath>">,
@@ -1848,9 +1880,11 @@
def fpass_plugin_EQ : Joined<["-"], "fpass-plugin=">,
Group<f_Group>, Flags<[CC1Option]>, MetaVarName<"<dsopath>">,
HelpText<"Load pass plugin from a dynamic shared object file (only with new pass manager).">;
-defm preserve_as_comments : OptOutFFlag<"preserve-as-comments", "",
- "Do not preserve comments in inline assembly">;
-def fprofile_arcs : Flag<["-"], "fprofile-arcs">, Group<f_Group>, Flags<[CC1Option,LinkOption]>;
+defm preserve_as_comments : OptOutPositiveFFlag<"preserve-as-comments", "", "Do not preserve comments in inline assembly", "",
+ [], "CodeGenOpts.PreserveAsmComments">;
+// todo: simplify these into a version of OptInFFlag that accepts different flags for each record
+def fprofile_arcs : Flag<["-"], "fprofile-arcs">, Group<f_Group>, Flags<[CC1Option,LinkOption]>,
+ MarshallingInfoFlag<"CodeGenOpts.EmitGcovArcs">;
def fno_profile_arcs : Flag<["-"], "fno-profile-arcs">, Group<f_Group>;
def framework : Separate<["-"], "framework">, Flags<[LinkerInput]>;
def frandom_seed_EQ : Joined<["-"], "frandom-seed=">, Group<clang_ignored_f_Group>;
@@ -1881,10 +1915,8 @@
def fsplit_stack : Flag<["-"], "fsplit-stack">, Group<f_Group>;
def fstack_protector_all : Flag<["-"], "fstack-protector-all">, Group<f_Group>,
HelpText<"Enable stack protectors for all functions">;
-def fstack_clash_protection : Flag<["-"], "fstack-clash-protection">, Group<f_Group>, Flags<[CC1Option]>,
- HelpText<"Enable stack clash protection">;
-def fno_stack_clash_protection : Flag<["-"], "fno-stack-clash-protection">, Group<f_Group>,
- HelpText<"Disable stack clash protection">;
+defm stack_clash_protection : OptInFFlag<"stack-clash-protection", "Enable", "Disable", " stack clash protection",
+ [], "CodeGenOpts.StackClashProtector">;
def fstack_protector_strong : Flag<["-"], "fstack-protector-strong">, Group<f_Group>,
HelpText<"Enable stack protectors for some functions vulnerable to stack smashing. "
"Compared to -fstack-protector, this uses a stronger heuristic "
@@ -1923,11 +1955,11 @@
Flags<[NoXarchOption, CoreOption]>;
def fstrict_enums : Flag<["-"], "fstrict-enums">, Group<f_Group>, Flags<[CC1Option]>,
HelpText<"Enable optimizations based on the strict definition of an enum's "
- "value range">;
-def fstrict_vtable_pointers: Flag<["-"], "fstrict-vtable-pointers">,
- Group<f_Group>, Flags<[CC1Option]>,
- HelpText<"Enable optimizations based on the strict rules for overwriting "
- "polymorphic C++ objects">;
+ "value range">,
+ MarshallingInfoFlag<"CodeGenOpts.StrictEnums">;
+defm strict_vtable_pointers : OptInFFlag<"strict-vtable-pointers",
+ "Enable optimizations based on the strict rules for overwriting polymorphic C++ objects",
+ "", "", [], "CodeGenOpts.StrictVTablePointers">;
def fstrict_overflow : Flag<["-"], "fstrict-overflow">, Group<f_Group>;
def fsyntax_only : Flag<["-"], "fsyntax-only">,
Flags<[NoXarchOption,CoreOption,CC1Option]>, Group<Action_Group>;
@@ -1955,8 +1987,7 @@
HelpText<"Only include passes which match a specified regular expression in the generated optimization record (by default, include all passes)">,
MetaVarName<"<regex>">;
-def ftest_coverage : Flag<["-"], "ftest-coverage">, Flags<[CC1Option]>, Group<f_Group>;
-def fno_test_coverage : Flag<["-"], "fno-test-coverage">, Group<f_Group>;
+defm test_coverage : OptInFFlag<"test-coverage", "", "", "", [], "CodeGenOpts.EmitGcovNotes">;
def fvectorize : Flag<["-"], "fvectorize">, Group<f_Group>,
HelpText<"Enable the loop vectorization passes">;
def fno_vectorize : Flag<["-"], "fno-vectorize">, Group<f_Group>;
@@ -2011,7 +2042,7 @@
HelpText<"Turn on loop unroller">, Flags<[CC1Option]>;
def fno_unroll_loops : Flag<["-"], "fno-unroll-loops">, Group<f_Group>,
HelpText<"Turn off loop unroller">, Flags<[CC1Option]>;
-defm reroll_loops : OptInFFlag<"reroll-loops", "Turn on loop reroller">;
+defm reroll_loops : OptInFFlag<"reroll-loops", "Turn on loop reroller", "", "", [], "CodeGenOpts.RerollLoops">;
def ftrigraphs : Flag<["-"], "ftrigraphs">, Group<f_Group>,
HelpText<"Process trigraph sequences">, Flags<[CC1Option]>;
def fno_trigraphs : Flag<["-"], "fno-trigraphs">, Group<f_Group>,
@@ -2020,10 +2051,10 @@
def funsigned_char : Flag<["-"], "funsigned-char">, Group<f_Group>;
def fno_unsigned_char : Flag<["-"], "fno-unsigned-char">;
def funwind_tables : Flag<["-"], "funwind-tables">, Group<f_Group>;
-def fuse_cxa_atexit : Flag<["-"], "fuse-cxa-atexit">, Group<f_Group>;
-def fregister_global_dtors_with_atexit : Flag<["-"], "fregister-global-dtors-with-atexit">, Group<f_Group>, Flags<[CC1Option]>,
- HelpText<"Use atexit or __cxa_atexit to register global destructors">;
-defm use_init_array : OptOutFFlag<"use-init-array", "", "Use .ctors/.dtors instead of .init_array/.fini_array">;
+defm register_global_dtors_with_atexit : OptInFFlag<"register-global-dtors-with-atexit", "Use", "Don't use",
+ " atexit or __cxa_atexit to register global destructors", [], "CodeGenOpts.RegisterGlobalDtorsWithAtExit">;
+defm use_init_array : OptOutPositiveFFlag<"use-init-array", "", "Use .ctors/.dtors instead of .init_array/.fini_array", "",
+ [], "CodeGenOpts.UseInitArray">;
def fno_var_tracking : Flag<["-"], "fno-var-tracking">, Group<clang_ignored_f_Group>;
def fverbose_asm : Flag<["-"], "fverbose-asm">, Group<f_Group>,
HelpText<"Generate verbose assembly output">;
@@ -2059,40 +2090,47 @@
def fvisibility_global_new_delete_hidden : Flag<["-"], "fvisibility-global-new-delete-hidden">, Group<f_Group>,
HelpText<"Give global C++ operator new and delete declarations hidden visibility">, Flags<[CC1Option]>;
defm whole_program_vtables : OptInFFlag<"whole-program-vtables",
- "Enables whole-program vtable optimization. Requires -flto", "", "", [CoreOption]>;
+ "Enables whole-program vtable optimization. Requires -flto", "", "", [CoreOption], "CodeGenOpts.WholeProgramVTables">;
defm split_lto_unit : OptInFFlag<"split-lto-unit",
- "Enables splitting of the LTO unit", "", "", [CoreOption]>;
+ "Enables splitting of the LTO unit", "", "", [CoreOption], "CodeGenOpts.EnableSplitLTOUnit">;
defm force_emit_vtables : OptInFFlag<"force-emit-vtables",
- "Emits more virtual tables to improve devirtualization", "", "", [CoreOption]>;
+ "Emits more virtual tables to improve devirtualization", "", "", [CoreOption], "CodeGenOpts.ForceEmitVTables">;
defm virtual_function_elimination : OptInFFlag<"virtual-function-elimination",
- "Enables dead virtual function elimination optimization. Requires -flto=full", "", "", [CoreOption]>;
+ "Enables dead virtual function elimination optimization. Requires -flto=full", "", "", [CoreOption],
+ "CodeGenOpts.VirtualFunctionElimination">;
def fwrapv : Flag<["-"], "fwrapv">, Group<f_Group>, Flags<[CC1Option]>,
HelpText<"Treat signed integer overflow as two's complement">;
def fwritable_strings : Flag<["-"], "fwritable-strings">, Group<f_Group>, Flags<[CC1Option]>,
HelpText<"Store string literals as writable data">;
-defm zero_initialized_in_bss : OptOutFFlag<"zero-initialized-in-bss", "", "Don't place zero initialized data in BSS">;
+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">;
def fbasic_block_sections_EQ : Joined<["-"], "fbasic-block-sections=">, Group<f_Group>,
Flags<[CC1Option, CC1AsOption]>,
HelpText<"Place each function's basic blocks in unique sections (ELF Only) : all | labels | none | list=<file>">,
DocBrief<[{Generate labels for each basic block or place each basic block or a subset of basic blocks in its own section.}]>,
Values<"all,labels,none,list=">;
-defm data_sections : OptInFFlag<"data-sections", "Place each data in its own section">;
-defm stack_size_section : OptInFFlag<"stack-size-section", "Emit section containing metadata on function stack sizes">;
+defm data_sections : OptInFFlag<"data-sections", "Place each data in its own section", "", "", [], "CodeGenOpts.DataSections">;
+defm stack_size_section : OptInFFlag<"stack-size-section", "Emit section containing metadata on function stack sizes",
+ "", "", [], "CodeGenOpts.StackSizeSection">;
defm unique_basic_block_section_names : OptInFFlag<"unique-basic-block-section-names",
- "Use unique names for basic block sections (ELF Only)">;
+ "Use unique names for basic block sections (ELF Only)", "", "", [], "CodeGenOpts.UniqueBasicBlockSectionNames">;
defm unique_internal_linkage_names : OptInFFlag<"unique-internal-linkage-names",
- "Uniqueify Internal Linkage Symbol Names by appending the MD5 hash of the module path">;
-defm unique_section_names : OptOutFFlag<"unique-section-names",
- "", "Don't use unique names for text and data sections">;
+ "Uniqueify Internal Linkage Symbol Names by appending the MD5 hash of the module path", "", "", [],
+ "CodeGenOpts.UniqueInternalLinkageNames">;
+defm unique_section_names : OptOutPositiveFFlag<"unique-section-names",
+ "", "Don't use unique names for text and data sections", "",
+ [], "CodeGenOpts.UniqueSectionNames">;
defm split_machine_functions: OptInFFlag<"split-machine-functions",
- "Enable", "Disable", " late function splitting using profile information (x86 ELF)">;
+ "Enable", "Disable", " late function splitting using profile information (x86 ELF)",
+ [], "CodeGenOpts.SplitMachineFunctions">;
-defm strict_return : OptOutFFlag<"strict-return", "",
- "Don't treat control flow paths that fall off the end of a non-void function as unreachable">;
+defm strict_return : OptOutPositiveFFlag<"strict-return",
+ "", "Don't treat control flow paths that fall off the end of a non-void function as unreachable", "",
+ [], "CodeGenOpts.StrictReturn">;
def fenable_matrix : Flag<["-"], "fenable-matrix">, Group<f_Group>,
Flags<[CC1Option]>,
@@ -2103,11 +2141,10 @@
HelpText<"Place debug types in their own section (ELF Only)">;
def fno_debug_types_section: Flag<["-"], "fno-debug-types-section">, Group<f_Group>;
defm debug_ranges_base_address : OptInFFlag<"debug-ranges-base-address",
- "Use DWARF base address selection entries in .debug_ranges">;
-def fsplit_dwarf_inlining: Flag <["-"], "fsplit-dwarf-inlining">, Group<f_Group>,
- HelpText<"Provide minimal debug info in the object/executable to facilitate online symbolication/stack traces in the absence of .dwo/.dwp files when using Split DWARF">;
-def fno_split_dwarf_inlining: Flag<["-"], "fno-split-dwarf-inlining">, Group<f_Group>,
- Flags<[CC1Option]>;
+ "Use DWARF base address selection entries in .debug_ranges", "", "", [], "CodeGenOpts.DebugRangesBaseAddress">;
+defm split_dwarf_inlining : OptOutPositiveFFlag<"split-dwarf-inlining",
+ "Provide minimal debug info in the object/executable to facilitate online symbolication/stack traces in the absence of .dwo/.dwp files when using Split DWARF", "", "",
+ [], "CodeGenOpts.SplitDwarfInlining">;
def fdebug_default_version: Joined<["-"], "fdebug-default-version=">, Group<f_Group>,
HelpText<"Default DWARF version to use, if a -g option caused DWARF debug info to be produced">;
def fdebug_prefix_map_EQ
@@ -2120,7 +2157,7 @@
def fmacro_prefix_map_EQ
: Joined<["-"], "fmacro-prefix-map=">, Group<Preprocessor_Group>, Flags<[CC1Option]>,
HelpText<"remap file source paths in predefined preprocessor macros">;
-defm force_dwarf_frame : OptInFFlag<"force-dwarf-frame", "Always emit a debug frame section">;
+defm force_dwarf_frame : OptInFFlag<"force-dwarf-frame", "Always emit a debug frame section", "", "", [], "CodeGenOpts.ForceDwarfFrameSection">;
def g_Flag : Flag<["-"], "g">, Group<g_Group>,
HelpText<"Generate source-level debug information">;
def gline_tables_only : Flag<["-"], "gline-tables-only">, Group<gN_Group>,
@@ -2154,14 +2191,18 @@
def gcodeview : Flag<["-"], "gcodeview">,
HelpText<"Generate CodeView debug information">,
- Flags<[CC1Option, CC1AsOption, CoreOption]>;
+ Flags<[CC1Option, CC1AsOption, CoreOption]>,
+ MarshallingInfoFlag<"CodeGenOpts.EmitCodeView">;
def gcodeview_ghash : Flag<["-"], "gcodeview-ghash">,
HelpText<"Emit type record hashes in a .debug$H section">,
- Flags<[CC1Option, CoreOption]>;
+ Flags<[CC1Option, CoreOption]>,
+ MarshallingInfoFlag<"CodeGenOpts.CodeViewGHash">;
def gno_codeview_ghash : Flag<["-"], "gno-codeview-ghash">, Flags<[CoreOption]>;
+// todo: simplify these into a version of OptOutFFlag that doesn't imply `f_Group` and `f` in names
def ginline_line_tables : Flag<["-"], "ginline-line-tables">, Flags<[CoreOption]>;
def gno_inline_line_tables : Flag<["-"], "gno-inline-line-tables">,
- Flags<[CC1Option, CoreOption]>, HelpText<"Don't emit inline line tables">;
+ Flags<[CC1Option, CoreOption]>, HelpText<"Don't emit inline line tables">,
+ MarshallingInfoFlag<"CodeGenOpts.NoInlineLineTables">;
def gfull : Flag<["-"], "gfull">, Group<g_Group>;
def gused : Flag<["-"], "gused">, Group<g_Group>;
@@ -2178,8 +2219,10 @@
def : Flag<["-"], "gno-record-gcc-switches">, Alias<gno_record_command_line>;
def gstrict_dwarf : Flag<["-"], "gstrict-dwarf">, Group<g_flags_Group>;
def gno_strict_dwarf : Flag<["-"], "gno-strict-dwarf">, Group<g_flags_Group>;
+// todo: simplify these into a version of OptOutPositiveFFlag that doesn't imply `f_Group` and `f` in names
def gcolumn_info : Flag<["-"], "gcolumn-info">, Group<g_flags_Group>, Flags<[CoreOption]>;
-def gno_column_info : Flag<["-"], "gno-column-info">, Group<g_flags_Group>, Flags<[CoreOption, CC1Option]>;
+def gno_column_info : Flag<["-"], "gno-column-info">, Group<g_flags_Group>, Flags<[CoreOption, CC1Option]>,
+ MarshallingInfoFlag<"CodeGenOpts.DebugColumnInfo", "true">, IsNegative;
def gsplit_dwarf : Flag<["-"], "gsplit-dwarf">, Group<g_flags_Group>;
def gsplit_dwarf_EQ : Joined<["-"], "gsplit-dwarf=">, Group<g_flags_Group>,
HelpText<"Set DWARF fission mode to either 'split' or 'single'">,
@@ -2196,7 +2239,8 @@
HelpText<"DWARF debug sections compression type">;
def gz : Flag<["-"], "gz">, Alias<gz_EQ>, AliasArgs<["zlib"]>, Group<g_flags_Group>;
def gembed_source : Flag<["-"], "gembed-source">, Group<g_flags_Group>, Flags<[CC1Option]>,
- HelpText<"Embed source text in DWARF debug sections">;
+ HelpText<"Embed source text in DWARF debug sections">,
+ MarshallingInfoFlag<"CodeGenOpts.EmbedSource">;
def gno_embed_source : Flag<["-"], "gno-embed-source">, Group<g_flags_Group>,
Flags<[NoXarchOption]>,
HelpText<"Restore the default behavior of not embedding source text in DWARF debug sections">;
@@ -2374,7 +2418,8 @@
def mno_ms_bitfields : Flag<["-"], "mno-ms-bitfields">, Group<m_Group>,
HelpText<"Do not set the default structure layout to be compatible with the Microsoft compiler standard">;
def mstackrealign : Flag<["-"], "mstackrealign">, Group<m_Group>, Flags<[CC1Option]>,
- HelpText<"Force realign the stack at entry to every function">;
+ HelpText<"Force realign the stack at entry to every function">,
+ MarshallingInfoFlag<"CodeGenOpts.StackRealignment">;
def mstack_alignment : Joined<["-"], "mstack-alignment=">, Group<m_Group>, Flags<[CC1Option]>,
HelpText<"Set the stack alignment">;
def mstack_probe_size : Joined<["-"], "mstack-probe-size=">, Group<m_Group>, Flags<[CC1Option]>,
@@ -2382,7 +2427,8 @@
def mstack_arg_probe : Flag<["-"], "mstack-arg-probe">, Group<m_Group>,
HelpText<"Enable stack probes">;
def mno_stack_arg_probe : Flag<["-"], "mno-stack-arg-probe">, Group<m_Group>, Flags<[CC1Option]>,
- HelpText<"Disable stack probes which are enabled by default">;
+ HelpText<"Disable stack probes which are enabled by default">,
+ MarshallingInfoFlag<"CodeGenOpts.NoStackArgProbe">;
def mthread_model : Separate<["-"], "mthread-model">, Group<m_Group>, Flags<[CC1Option]>,
HelpText<"The thread model to use, e.g. posix, single (posix by default)">, Values<"posix,single">;
def meabi : Separate<["-"], "meabi">, Group<m_Group>, Flags<[CC1Option]>,
@@ -2395,7 +2441,8 @@
Alias<fno_pascal_strings>;
def mno_red_zone : Flag<["-"], "mno-red-zone">, Group<m_Group>;
def mno_tls_direct_seg_refs : Flag<["-"], "mno-tls-direct-seg-refs">, Group<m_Group>, Flags<[CC1Option]>,
- HelpText<"Disable direct TLS access through segment registers">;
+ HelpText<"Disable direct TLS access through segment registers">,
+ MarshallingInfoFlag<"CodeGenOpts.IndirectTlsSegRefs">;
def mno_relax_all : Flag<["-"], "mno-relax-all">, Group<m_Group>;
def mno_rtd: Flag<["-"], "mno-rtd">, Group<m_Group>;
def mno_soft_float : Flag<["-"], "mno-soft-float">, Group<m_Group>;
@@ -2404,7 +2451,8 @@
def mretpoline : Flag<["-"], "mretpoline">, Group<m_Group>, Flags<[CoreOption,NoXarchOption]>;
def mno_retpoline : Flag<["-"], "mno-retpoline">, Group<m_Group>, Flags<[CoreOption,NoXarchOption]>;
def mspeculative_load_hardening : Flag<["-"], "mspeculative-load-hardening">,
- Group<m_Group>, Flags<[CoreOption,CC1Option]>;
+ Group<m_Group>, Flags<[CoreOption,CC1Option]>,
+ MarshallingInfoFlag<"CodeGenOpts.SpeculativeLoadHardening">;
def mno_speculative_load_hardening : Flag<["-"], "mno-speculative-load-hardening">,
Group<m_Group>, Flags<[CoreOption]>;
def mlvi_hardening : Flag<["-"], "mlvi-hardening">, Group<m_Group>, Flags<[CoreOption,NoXarchOption]>,
@@ -2468,13 +2516,14 @@
HelpText<"Allow use of CMSE (Armv8-M Security Extensions)">;
def ForceAAPCSBitfieldLoad : Flag<["-"], "faapcs-bitfield-load">, Group<m_arm_Features_Group>,
Flags<[NoXarchOption,CC1Option]>,
- HelpText<"Follows the AAPCS standard that all volatile bit-field write generates at least one load. (ARM only).">;
-def ForceNoAAPCSBitfieldWidth : Flag<["-"], "fno-aapcs-bitfield-width">, Group<m_arm_Features_Group>,
- Flags<[NoXarchOption,CC1Option]>,
- HelpText<"Do not follow the AAPCS standard requirement that volatile bit-field width is dictated by the field container type. (ARM only).">;
-def AAPCSBitfieldWidth : Flag<["-"], "faapcs-bitfield-width">, Group<m_arm_Features_Group>,
- Flags<[NoXarchOption,CC1Option]>,
- HelpText<"Follow the AAPCS standard requirement stating that volatile bit-field width is dictated by the field container type. (ARM only).">;
+ HelpText<"Follows the AAPCS standard that all volatile bit-field write generates at least one load. (ARM only).">,
+ MarshallingInfoFlag<"CodeGenOpts.ForceAAPCSBitfieldLoad">;
+
+// todo: simplify this into a version of OptInFFlag that doesn't imply `f_Group`
+defm aapcs_bitfield_width : BooleanMarshalledFFlag<"aapcs-bitfield-width", "CodeGenOpts.AAPCSBitfieldWidth", "true",
+ "Follow the AAPCS standard requirement stating that volatile bit-field width is dictated by the field container type. (ARM only).",
+ "Do not follow the AAPCS standard requirement that volatile bit-field width is dictated by the field container type. (ARM only).">,
+ Group<m_arm_Features_Group>, Flags<[NoXarchOption,CC1Option]>;
def mgeneral_regs_only : Flag<["-"], "mgeneral-regs-only">, Group<m_aarch64_Features_Group>,
HelpText<"Generate code which only uses the general purpose registers (AArch64 only)">;
@@ -2647,8 +2696,10 @@
def mignore_xcoff_visibility : Flag<["-"], "mignore-xcoff-visibility">, Group<m_Group>,
HelpText<"Not emit the visibility attribute for asm in AIX OS or give all symbols 'unspecified' visibility in XCOFF object file">,
Flags<[CC1Option]>;
+// todo: simplify these into a version of OptInFFlag that doesn't imply `f_Group`, `f` in names and Flags
def mbackchain : Flag<["-"], "mbackchain">, Group<m_Group>, Flags<[NoXarchOption,CC1Option]>,
- HelpText<"Link stack frames through backchain on System Z">;
+ HelpText<"Link stack frames through backchain on System Z">,
+ MarshallingInfoFlag<"CodeGenOpts.Backchain">;
def mno_backchain : Flag<["-"], "mno-backchain">, Group<m_Group>, Flags<[NoXarchOption,CC1Option]>;
def mno_warn_nonportable_cfstrings : Flag<["-"], "mno-warn-nonportable-cfstrings">, Group<m_Group>;
@@ -2662,10 +2713,12 @@
HelpText<"Enable direct TLS access through segment registers (default)">;
def mregparm_EQ : Joined<["-"], "mregparm=">, Group<m_Group>;
def mrelax_all : Flag<["-"], "mrelax-all">, Group<m_Group>, Flags<[CC1Option,CC1AsOption]>,
- HelpText<"(integrated-as) Relax all machine instructions">;
+ HelpText<"(integrated-as) Relax all machine instructions">,
+ MarshallingInfoFlag<"CodeGenOpts.RelaxAll">;
def mincremental_linker_compatible : Flag<["-"], "mincremental-linker-compatible">, Group<m_Group>,
Flags<[CC1Option,CC1AsOption]>,
- HelpText<"(integrated-as) Emit an object file which can be used with an incremental linker">;
+ HelpText<"(integrated-as) Emit an object file which can be used with an incremental linker">,
+ MarshallingInfoFlag<"CodeGenOpts.IncrementalLinkerCompatible">;
def mno_incremental_linker_compatible : Flag<["-"], "mno-incremental-linker-compatible">, Group<m_Group>,
HelpText<"(integrated-as) Emit an object file which cannot be used with an incremental linker">;
def mrtd : Flag<["-"], "mrtd">, Group<m_Group>, Flags<[CC1Option]>,
@@ -2673,7 +2726,8 @@
def msmall_data_threshold_EQ : Joined <["-"], "msmall-data-threshold=">,
Group<m_Group>, Alias<G>;
def msoft_float : Flag<["-"], "msoft-float">, Group<m_Group>, Flags<[CC1Option]>,
- HelpText<"Use software floating point">;
+ HelpText<"Use software floating point">,
+ MarshallingInfoFlag<"CodeGenOpts.SoftFloat">;
def mno_implicit_float : Flag<["-"], "mno-implicit-float">, Group<m_Group>,
HelpText<"Don't generate implicit floating point instructions">;
def mimplicit_float : Flag<["-"], "mimplicit-float">, Group<m_Group>;
@@ -2687,18 +2741,24 @@
HelpText<"Use the given offset for addressing the stack-protector guard">;
def mstack_protector_guard_reg_EQ : Joined<["-"], "mstack-protector-guard-reg=">, Group<m_Group>, Flags<[CC1Option]>,
HelpText<"Use the given reg for addressing the stack-protector guard">;
+// todo: simplify these into a version of OptInFFlag that doesn't imply `f_Group` and `f` in names
def mpie_copy_relocations : Flag<["-"], "mpie-copy-relocations">, Group<m_Group>,
Flags<[CC1Option]>,
- HelpText<"Use copy relocations support for PIE builds">;
+ HelpText<"Use copy relocations support for PIE builds">,
+ MarshallingInfoFlag<"CodeGenOpts.PIECopyRelocations">;
def mno_pie_copy_relocations : Flag<["-"], "mno-pie-copy-relocations">, Group<m_Group>;
def mfentry : Flag<["-"], "mfentry">, HelpText<"Insert calls to fentry at function entry (x86/SystemZ only)">,
- Flags<[CC1Option]>, Group<m_Group>;
+ Flags<[CC1Option]>, Group<m_Group>,
+ MarshallingInfoFlag<"CodeGenOpts.CallFEntry">;
def mnop_mcount : Flag<["-"], "mnop-mcount">, HelpText<"Generate mcount/__fentry__ calls as nops. To activate they need to be patched in.">,
- Flags<[CC1Option]>, Group<m_Group>;
+ Flags<[CC1Option]>, Group<m_Group>,
+ MarshallingInfoFlag<"CodeGenOpts.MNopMCount">;
def mrecord_mcount : Flag<["-"], "mrecord-mcount">, HelpText<"Generate a __mcount_loc section entry for each __fentry__ call.">,
- Flags<[CC1Option]>, Group<m_Group>;
+ Flags<[CC1Option]>, Group<m_Group>,
+ MarshallingInfoFlag<"CodeGenOpts.RecordMCount">;
def mpacked_stack : Flag<["-"], "mpacked-stack">, HelpText<"Use packed stack layout (SystemZ only).">,
- Flags<[CC1Option]>, Group<m_Group>;
+ Flags<[CC1Option]>, Group<m_Group>,
+ MarshallingInfoFlag<"CodeGenOpts.PackedStack">;
def mno_packed_stack : Flag<["-"], "mno-packed-stack">, Flags<[CC1Option]>, Group<m_Group>;
def mips16 : Flag<["-"], "mips16">, Group<m_mips_Features_Group>;
def mno_mips16 : Flag<["-"], "mno-mips16">, Group<m_mips_Features_Group>;
@@ -2893,7 +2953,8 @@
def pass_exit_codes : Flag<["-", "--"], "pass-exit-codes">, Flags<[Unsupported]>;
def pedantic_errors : Flag<["-", "--"], "pedantic-errors">, Group<pedantic_Group>, Flags<[CC1Option]>;
def pedantic : Flag<["-", "--"], "pedantic">, Group<pedantic_Group>, Flags<[CC1Option]>;
-def pg : Flag<["-"], "pg">, HelpText<"Enable mcount instrumentation">, Flags<[CC1Option]>;
+def pg : Flag<["-"], "pg">, HelpText<"Enable mcount instrumentation">, Flags<[CC1Option]>,
+ MarshallingInfoFlag<"CodeGenOpts.InstrumentForProfiling">;
def pipe : Flag<["-", "--"], "pipe">,
HelpText<"Use pipes between commands, when possible">;
def prebind__all__twolevel__modules : Flag<["-"], "prebind_all_twolevel_modules">;
@@ -3059,7 +3120,8 @@
MetaVarName<"<language>">;
def y : Joined<["-"], "y">;
-defm integrated_as : OptOutFFlag<"integrated-as", "Enable the integrated assembler", "Disable the integrated assembler">;
+defm integrated_as : OptOutFFlag<"integrated-as", "Enable", "Disable", " the integrated assembler",
+ [], "CodeGenOpts.DisableIntegratedAS">;
def fintegrated_cc1 : Flag<["-"], "fintegrated-cc1">,
Flags<[CoreOption, NoXarchOption]>, Group<f_Group>,
@@ -3835,7 +3897,8 @@
let Flags = [CC1Option, CC1AsOption, NoDriverOption] in {
def debug_info_kind_EQ : Joined<["-"], "debug-info-kind=">;
def debug_info_macro : Flag<["-"], "debug-info-macro">,
- HelpText<"Emit macro debug information">;
+ HelpText<"Emit macro debug information">,
+ MarshallingInfoFlag<"CodeGenOpts.MacroDebugInfo">;
def default_function_attr : Separate<["-"], "default-function-attr">,
HelpText<"Apply given attribute to all functions">;
def dwarf_version_EQ : Joined<["-"], "dwarf-version=">;
@@ -3849,17 +3912,22 @@
def compress_debug_sections : Flag<["-", "--"], "compress-debug-sections">,
Alias<compress_debug_sections_EQ>, AliasArgs<["zlib"]>;
def mno_exec_stack : Flag<["-"], "mnoexecstack">,
- HelpText<"Mark the file as not needing an executable stack">;
+ HelpText<"Mark the file as not needing an executable stack">,
+ MarshallingInfoFlag<"CodeGenOpts.NoExecStack">;
def massembler_no_warn : Flag<["-"], "massembler-no-warn">,
- HelpText<"Make assembler not emit warnings">;
+ HelpText<"Make assembler not emit warnings">,
+ MarshallingInfoFlag<"CodeGenOpts.NoWarn">;
def massembler_fatal_warnings : Flag<["-"], "massembler-fatal-warnings">,
- HelpText<"Make assembler warnings fatal">;
+ HelpText<"Make assembler warnings fatal">,
+ MarshallingInfoFlag<"CodeGenOpts.FatalWarnings">;
def mrelax_relocations : Flag<["--"], "mrelax-relocations">,
- HelpText<"Use relaxable elf relocations">;
+ HelpText<"Use relaxable elf relocations">,
+ MarshallingInfoFlag<"CodeGenOpts.RelaxELFRelocations">;
def msave_temp_labels : Flag<["-"], "msave-temp-labels">,
HelpText<"Save temporary labels in the symbol table. "
"Note this may change .s semantics and shouldn't generally be used "
- "on compiler-generated code.">;
+ "on compiler-generated code.">,
+ MarshallingInfoFlag<"CodeGenOpts.SaveTempLabels">;
def mrelocation_model : Separate<["-"], "mrelocation-model">,
HelpText<"The relocation model to use">, Values<"static,pic,ropi,rwpi,ropi-rwpi,dynamic-no-pic">,
NormalizedValuesScope<"llvm::Reloc">,
@@ -3873,36 +3941,47 @@
}
def disable_llvm_verifier : Flag<["-"], "disable-llvm-verifier">,
- HelpText<"Don't run the LLVM IR verifier pass">;
+ HelpText<"Don't run the LLVM IR verifier pass">,
+ MarshallingInfoFlag<"CodeGenOpts.VerifyModule", "true">, IsNegative;
def disable_llvm_passes : Flag<["-"], "disable-llvm-passes">,
HelpText<"Use together with -emit-llvm to get pristine LLVM IR from the "
- "frontend by not running any LLVM passes at all">;
+ "frontend by not running any LLVM passes at all">,
+ MarshallingInfoFlag<"CodeGenOpts.DisableLLVMPasses">;
def disable_llvm_optzns : Flag<["-"], "disable-llvm-optzns">,
Alias<disable_llvm_passes>;
def disable_lifetimemarkers : Flag<["-"], "disable-lifetime-markers">,
HelpText<"Disable lifetime-markers emission even when optimizations are "
- "enabled">;
+ "enabled">,
+ MarshallingInfoFlag<"CodeGenOpts.DisableLifetimeMarkers">;
def disable_O0_optnone : Flag<["-"], "disable-O0-optnone">,
- HelpText<"Disable adding the optnone attribute to functions at O0">;
+ HelpText<"Disable adding the optnone attribute to functions at O0">,
+ MarshallingInfoFlag<"CodeGenOpts.DisableO0ImplyOptNone">;
def disable_red_zone : Flag<["-"], "disable-red-zone">,
- HelpText<"Do not emit code that uses the red zone.">;
+ HelpText<"Do not emit code that uses the red zone.">,
+ MarshallingInfoFlag<"CodeGenOpts.DisableRedZone">;
def dwarf_ext_refs : Flag<["-"], "dwarf-ext-refs">,
HelpText<"Generate debug info with external references to clang modules"
- " or precompiled headers">;
+ " or precompiled headers">,
+ MarshallingInfoFlag<"CodeGenOpts.DebugTypeExtRefs">;
def dwarf_explicit_import : Flag<["-"], "dwarf-explicit-import">,
HelpText<"Generate explicit import from anonymous namespace to containing"
- " scope">;
+ " scope">,
+ MarshallingInfoFlag<"CodeGenOpts.DebugExplicitImport">;
def debug_forward_template_params : Flag<["-"], "debug-forward-template-params">,
HelpText<"Emit complete descriptions of template parameters in forward"
- " declarations">;
+ " declarations">,
+ MarshallingInfoFlag<"CodeGenOpts.DebugFwdTemplateParams">;
def fforbid_guard_variables : Flag<["-"], "fforbid-guard-variables">,
- HelpText<"Emit an error if a C++ static local initializer would need a guard variable">;
+ HelpText<"Emit an error if a C++ static local initializer would need a guard variable">,
+ MarshallingInfoFlag<"CodeGenOpts.ForbidGuardVariables">;
def no_implicit_float : Flag<["-"], "no-implicit-float">,
- HelpText<"Don't generate implicit floating point instructions">;
+ 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">;
def fmerge_functions : Flag<["-"], "fmerge-functions">,
- HelpText<"Permit merging of identical functions when optimizing.">;
+ HelpText<"Permit merging of identical functions when optimizing.">,
+ MarshallingInfoFlag<"CodeGenOpts.MergeFunctions">;
def coverage_data_file : Separate<["-"], "coverage-data-file">,
HelpText<"Emit coverage data to this filename.">;
def coverage_data_file_EQ : Joined<["-"], "coverage-data-file=">,
@@ -3914,13 +3993,17 @@
def coverage_version_EQ : Joined<["-"], "coverage-version=">,
HelpText<"Four-byte version string for gcov files.">;
def dump_coverage_mapping : Flag<["-"], "dump-coverage-mapping">,
- HelpText<"Dump the coverage mapping records, for testing">;
+ HelpText<"Dump the coverage mapping records, for testing">,
+ MarshallingInfoFlag<"CodeGenOpts.DumpCoverageMapping">;
def fuse_register_sized_bitfield_access: Flag<["-"], "fuse-register-sized-bitfield-access">,
- HelpText<"Use register sized accesses to bit-fields, when possible.">;
+ HelpText<"Use register sized accesses to bit-fields, when possible.">,
+ MarshallingInfoFlag<"CodeGenOpts.UseRegisterSizedBitfieldAccess">;
def relaxed_aliasing : Flag<["-"], "relaxed-aliasing">,
- HelpText<"Turn off Type Based Alias Analysis">;
+ HelpText<"Turn off Type Based Alias Analysis">,
+ MarshallingInfoFlag<"CodeGenOpts.RelaxedAliasing">;
def no_struct_path_tbaa : Flag<["-"], "no-struct-path-tbaa">,
- HelpText<"Turn off struct-path aware Type Based Alias Analysis">;
+ HelpText<"Turn off struct-path aware Type Based Alias Analysis">,
+ MarshallingInfoFlag<"CodeGenOpts.StructPathTBAA", "true">, IsNegative;
def new_struct_path_tbaa : Flag<["-"], "new-struct-path-tbaa">,
HelpText<"Enable enhanced struct-path aware Type Based Alias Analysis">;
def mdebug_pass : Separate<["-"], "mdebug-pass">,
@@ -3928,7 +4011,8 @@
def mframe_pointer_EQ : Joined<["-"], "mframe-pointer=">,
HelpText<"Specify which frame pointers to retain (all, non-leaf, none).">, Values<"all,non-leaf,none">;
def mdisable_tail_calls : Flag<["-"], "mdisable-tail-calls">,
- HelpText<"Disable tail call optimization, keeping the call stack accurate">;
+ HelpText<"Disable tail call optimization, keeping the call stack accurate">,
+ MarshallingInfoFlag<"CodeGenOpts.DisableTailCalls">;
def menable_no_infinities : Flag<["-"], "menable-no-infs">,
HelpText<"Allow optimization to assume there are no infinities.">,
MarshallingInfoFlag<"LangOpts->NoHonorInfs">, ImpliedByAnyOf<[ffinite_math_only]>;
@@ -3947,15 +4031,18 @@
def mlimit_float_precision : Separate<["-"], "mlimit-float-precision">,
HelpText<"Limit float precision to the given value">;
def split_stacks : Flag<["-"], "split-stacks">,
- HelpText<"Try to use a split stack if possible.">;
+ HelpText<"Try to use a split stack if possible.">,
+ MarshallingInfoFlag<"CodeGenOpts.EnableSegmentedStacks">;
def mregparm : Separate<["-"], "mregparm">,
HelpText<"Limit the number of registers available for integer arguments">;
def msmall_data_limit : Separate<["-"], "msmall-data-limit">,
HelpText<"Put global and static data smaller than the limit into a special section">;
def munwind_tables : Flag<["-"], "munwind-tables">,
- HelpText<"Generate unwinding tables for all functions">;
+ HelpText<"Generate unwinding tables for all functions">,
+ MarshallingInfoFlag<"CodeGenOpts.UnwindTables">;
def mconstructor_aliases : Flag<["-"], "mconstructor-aliases">,
- HelpText<"Emit complete constructors and destructors as aliases when possible">;
+ HelpText<"Emit complete constructors and destructors as aliases when possible">,
+ MarshallingInfoFlag<"CodeGenOpts.CXXCtorDtorAliases">;
def mlink_bitcode_file : Separate<["-"], "mlink-bitcode-file">,
HelpText<"Link the given bitcode file before performing optimizations.">;
def mlink_builtin_bitcode : Separate<["-"], "mlink-builtin-bitcode">,
@@ -3964,9 +4051,11 @@
def mlink_cuda_bitcode : Separate<["-"], "mlink-cuda-bitcode">,
Alias<mlink_builtin_bitcode>;
def vectorize_loops : Flag<["-"], "vectorize-loops">,
- HelpText<"Run the Loop vectorization passes">;
+ HelpText<"Run the Loop vectorization passes">,
+ MarshallingInfoFlag<"CodeGenOpts.VectorizeLoop">;
def vectorize_slp : Flag<["-"], "vectorize-slp">,
- HelpText<"Run the SLP vectorization passes">;
+ HelpText<"Run the SLP vectorization passes">,
+ MarshallingInfoFlag<"CodeGenOpts.VectorizeSLP">;
def dependent_lib : Joined<["--"], "dependent-lib=">,
HelpText<"Add dependent library">;
def linker_option : Joined<["--"], "linker-option=">,
@@ -3975,43 +4064,56 @@
HelpText<"Sanitizer coverage type">;
def fsanitize_coverage_indirect_calls
: Flag<["-"], "fsanitize-coverage-indirect-calls">,
- HelpText<"Enable sanitizer coverage for indirect calls">;
+ HelpText<"Enable sanitizer coverage for indirect calls">,
+ MarshallingInfoFlag<"CodeGenOpts.SanitizeCoverageIndirectCalls">;
def fsanitize_coverage_trace_bb
: Flag<["-"], "fsanitize-coverage-trace-bb">,
- HelpText<"Enable basic block tracing in sanitizer coverage">;
+ HelpText<"Enable basic block tracing in sanitizer coverage">,
+ MarshallingInfoFlag<"CodeGenOpts.SanitizeCoverageTraceBB">;
def fsanitize_coverage_trace_cmp
: Flag<["-"], "fsanitize-coverage-trace-cmp">,
- HelpText<"Enable cmp instruction tracing in sanitizer coverage">;
+ HelpText<"Enable cmp instruction tracing in sanitizer coverage">,
+ MarshallingInfoFlag<"CodeGenOpts.SanitizeCoverageTraceCmp">;
def fsanitize_coverage_trace_div
: Flag<["-"], "fsanitize-coverage-trace-div">,
- HelpText<"Enable div instruction tracing in sanitizer coverage">;
+ HelpText<"Enable div instruction tracing in sanitizer coverage">,
+ MarshallingInfoFlag<"CodeGenOpts.SanitizeCoverageTraceDiv">;
def fsanitize_coverage_trace_gep
: Flag<["-"], "fsanitize-coverage-trace-gep">,
- HelpText<"Enable gep instruction tracing in sanitizer coverage">;
+ HelpText<"Enable gep instruction tracing in sanitizer coverage">,
+ MarshallingInfoFlag<"CodeGenOpts.SanitizeCoverageTraceGep">;
def fsanitize_coverage_8bit_counters
: Flag<["-"], "fsanitize-coverage-8bit-counters">,
- HelpText<"Enable frequency counters in sanitizer coverage">;
+ HelpText<"Enable frequency counters in sanitizer coverage">,
+ MarshallingInfoFlag<"CodeGenOpts.SanitizeCoverage8bitCounters">;
def fsanitize_coverage_inline_8bit_counters
: Flag<["-"], "fsanitize-coverage-inline-8bit-counters">,
- HelpText<"Enable inline 8-bit counters in sanitizer coverage">;
+ HelpText<"Enable inline 8-bit counters in sanitizer coverage">,
+ MarshallingInfoFlag<"CodeGenOpts.SanitizeCoverageInline8bitCounters">;
def fsanitize_coverage_inline_bool_flag
: Flag<["-"], "fsanitize-coverage-inline-bool-flag">,
- HelpText<"Enable inline bool flag in sanitizer coverage">;
+ HelpText<"Enable inline bool flag in sanitizer coverage">,
+ MarshallingInfoFlag<"CodeGenOpts.SanitizeCoverageInlineBoolFlag">;
def fsanitize_coverage_pc_table
: Flag<["-"], "fsanitize-coverage-pc-table">,
- HelpText<"Create a table of coverage-instrumented PCs">;
+ HelpText<"Create a table of coverage-instrumented PCs">,
+ MarshallingInfoFlag<"CodeGenOpts.SanitizeCoveragePCTable">;
def fsanitize_coverage_trace_pc
: Flag<["-"], "fsanitize-coverage-trace-pc">,
- HelpText<"Enable PC tracing in sanitizer coverage">;
+ HelpText<"Enable PC tracing in sanitizer coverage">,
+ MarshallingInfoFlag<"CodeGenOpts.SanitizeCoverageTracePC">;
def fsanitize_coverage_trace_pc_guard
: Flag<["-"], "fsanitize-coverage-trace-pc-guard">,
- HelpText<"Enable PC tracing with guard in sanitizer coverage">;
+ HelpText<"Enable PC tracing with guard in sanitizer coverage">,
+ MarshallingInfoFlag<"CodeGenOpts.SanitizeCoverageTracePCGuard">;
def fsanitize_coverage_no_prune
: Flag<["-"], "fsanitize-coverage-no-prune">,
- HelpText<"Disable coverage pruning (i.e. instrument all blocks/edges)">;
+ HelpText<"Disable coverage pruning (i.e. instrument all blocks/edges)">,
+ MarshallingInfoFlag<"CodeGenOpts.SanitizeCoverageNoPrune">;
def fsanitize_coverage_stack_depth
: Flag<["-"], "fsanitize-coverage-stack-depth">,
- HelpText<"Enable max stack depth tracing">;
+ HelpText<"Enable max stack depth tracing">,
+ MarshallingInfoFlag<"CodeGenOpts.SanitizeCoverageStackDepth">;
def fpatchable_function_entry_offset_EQ
: Joined<["-"], "fpatchable-function-entry-offset=">, MetaVarName<"<M>">,
HelpText<"Generate M NOPs before function entry">;
@@ -4026,17 +4128,17 @@
HelpText<"Specify the profile path in PGO use compilation">;
def flto_visibility_public_std:
Flag<["-"], "flto-visibility-public-std">,
- HelpText<"Use public LTO visibility for classes in std and stdext namespaces">;
-def flto_unit: Flag<["-"], "flto-unit">,
- HelpText<"Emit IR to support LTO unit features (CFI, whole program vtable opt)">;
-def fno_lto_unit: Flag<["-"], "fno-lto-unit">;
-def fdebug_pass_manager : Flag<["-"], "fdebug-pass-manager">,
- HelpText<"Prints debug information for the new pass manager">;
-def fno_debug_pass_manager : Flag<["-"], "fno-debug-pass-manager">,
- HelpText<"Disables debug printing for the new pass manager">;
+ HelpText<"Use public LTO visibility for classes in std and stdext namespaces">,
+ MarshallingInfoFlag<"CodeGenOpts.LTOVisibilityPublicStd">;
+defm lto_unit : BooleanMarshalledFFlag<"lto-unit", "CodeGenOpts.LTOUnit", "false",
+ "Emit IR to support LTO unit features (CFI, whole program vtable opt)">;
+defm debug_pass_manager : BooleanMarshalledFFlag<"debug-pass-manager", "CodeGenOpts.DebugPassManager",
+ "false", "Prints debug information for the new pass manager",
+ "Disables debug printing for the new pass manager">;
def fexperimental_debug_variable_locations : Flag<["-"],
"fexperimental-debug-variable-locations">,
- HelpText<"Use experimental new value-tracking variable locations">;
+ HelpText<"Use experimental new value-tracking variable locations">,
+ MarshallingInfoFlag<"CodeGenOpts.ValueTrackingVariableLocations">;
// The driver option takes the key as a parameter to the -msign-return-address=
// and -mbranch-protection= options, but CC1 has a separate option so we
// don't have to parse the parameter twice.
@@ -4045,9 +4147,11 @@
def mbranch_target_enforce : Flag<["-"], "mbranch-target-enforce">;
def fno_dllexport_inlines : Flag<["-"], "fno-dllexport-inlines">;
def cfguard_no_checks : Flag<["-"], "cfguard-no-checks">,
- HelpText<"Emit Windows Control Flow Guard tables only (no checks)">;
+ HelpText<"Emit Windows Control Flow Guard tables only (no checks)">,
+ MarshallingInfoFlag<"CodeGenOpts.ControlFlowGuardNoChecks">;
def cfguard : Flag<["-"], "cfguard">,
- HelpText<"Emit Windows Control Flow Guard tables and checks">;
+ HelpText<"Emit Windows Control Flow Guard tables and checks">,
+ MarshallingInfoFlag<"CodeGenOpts.ControlFlowGuard">;
def fdenormal_fp_math_f32_EQ : Joined<["-"], "fdenormal-fp-math-f32=">,
Group<f_Group>;
@@ -4159,7 +4263,8 @@
HelpText<"Disable freeing of memory on exit">,
MarshallingInfoFlag<"FrontendOpts.DisableFree">;
def discard_value_names : Flag<["-"], "discard-value-names">,
- HelpText<"Discard value names in LLVM IR">;
+ HelpText<"Discard value names in LLVM IR">,
+ MarshallingInfoFlag<"CodeGenOpts.DiscardValueNames">;
def load : Separate<["-"], "load">, MetaVarName<"<dsopath>">,
HelpText<"Load the named plugin (dynamic shared object)">;
def plugin : Separate<["-"], "plugin">, MetaVarName<"<name>">,
@@ -4300,10 +4405,12 @@
HelpText<"Print the output of the dependency directives source minimizer">;
}
-def emit_llvm_uselists : Flag<["-"], "emit-llvm-uselists">,
- HelpText<"Preserve order of LLVM use-lists when serializing">;
+// todo: simplify this into a version of OptInFFlag that doesn't imply `f_Group` and `f` in names, append CC1Option flag
def no_emit_llvm_uselists : Flag<["-"], "no-emit-llvm-uselists">,
HelpText<"Don't preserve order of LLVM use-lists when serializing">;
+def emit_llvm_uselists : Flag<["-"], "emit-llvm-uselists">,
+ HelpText<"Preserve order of LLVM use-lists when serializing">,
+ MarshallingInfoBooleanFlag<"CodeGenOpts.EmitLLVMUseLists", "false", no_emit_llvm_uselists>;
def mt_migrate_directory : Separate<["-"], "mt-migrate-directory">,
HelpText<"Directory for temporary files produced during ARC or ObjC migration">;
@@ -4478,7 +4585,8 @@
def fdeclare_opencl_builtins : Flag<["-"], "fdeclare-opencl-builtins">,
HelpText<"Add OpenCL builtin function declarations (experimental)">;
def fpreserve_vec3_type : Flag<["-"], "fpreserve-vec3-type">,
- HelpText<"Preserve 3-component vector 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">,
@@ -4490,7 +4598,8 @@
"the type system guarantees when a parameter is qualified id">;
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<f_Group>;
+ "Has no effect on non-trivially-copyable classes in C++.">, Group<f_Group>,
+ MarshallingInfoFlag<"CodeGenOpts.PassByValueIsNoAlias">;
// FIXME: Remove these entirely once functionality/tests have been excised.
def fobjc_gc_only : Flag<["-"], "fobjc-gc-only">, Group<f_Group>,
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits