Lines Matching full:args

72 // Deserialization (from args)
81 static unsigned getOptimizationLevel(ArgList &Args, InputKind IK, in getOptimizationLevel() argument
84 if (IK == IK_OpenCL && !Args.hasArg(OPT_cl_opt_disable)) in getOptimizationLevel()
87 if (Arg *A = Args.getLastArg(options::OPT_O_Group)) { in getOptimizationLevel()
100 return getLastArgIntValue(Args, OPT_O, DefaultOpt, Diags); in getOptimizationLevel()
106 static unsigned getOptimizationLevelSize(ArgList &Args) { in getOptimizationLevelSize() argument
107 if (Arg *A = Args.getLastArg(options::OPT_O_Group)) { in getOptimizationLevelSize()
122 static void addDiagnosticArgs(ArgList &Args, OptSpecifier Group, in addDiagnosticArgs() argument
125 for (Arg *A : Args.filtered(Group)) { in addDiagnosticArgs()
141 static void getAllNoBuiltinFuncValues(ArgList &Args, in getAllNoBuiltinFuncValues() argument
144 for (const auto &Arg : Args) { in getAllNoBuiltinFuncValues()
155 static bool ParseAnalyzerArgs(AnalyzerOptions &Opts, ArgList &Args, in ParseAnalyzerArgs() argument
159 if (Arg *A = Args.getLastArg(OPT_analyzer_store)) { in ParseAnalyzerArgs()
168 << A->getAsString(Args) << Name; in ParseAnalyzerArgs()
175 if (Arg *A = Args.getLastArg(OPT_analyzer_constraints)) { in ParseAnalyzerArgs()
184 << A->getAsString(Args) << Name; in ParseAnalyzerArgs()
191 if (Arg *A = Args.getLastArg(OPT_analyzer_output)) { in ParseAnalyzerArgs()
200 << A->getAsString(Args) << Name; in ParseAnalyzerArgs()
207 if (Arg *A = Args.getLastArg(OPT_analyzer_purge)) { in ParseAnalyzerArgs()
216 << A->getAsString(Args) << Name; in ParseAnalyzerArgs()
223 if (Arg *A = Args.getLastArg(OPT_analyzer_inlining_mode)) { in ParseAnalyzerArgs()
232 << A->getAsString(Args) << Name; in ParseAnalyzerArgs()
239 Opts.ShowCheckerHelp = Args.hasArg(OPT_analyzer_checker_help); in ParseAnalyzerArgs()
240 Opts.DisableAllChecks = Args.hasArg(OPT_analyzer_disable_all_checks); in ParseAnalyzerArgs()
243 Args.hasArg(OPT_analyzer_viz_egraph_graphviz); in ParseAnalyzerArgs()
245 Args.hasArg(OPT_analyzer_viz_egraph_ubigraph); in ParseAnalyzerArgs()
246 Opts.NoRetryExhausted = Args.hasArg(OPT_analyzer_disable_retry_exhausted); in ParseAnalyzerArgs()
247 Opts.AnalyzeAll = Args.hasArg(OPT_analyzer_opt_analyze_headers); in ParseAnalyzerArgs()
248 Opts.AnalyzerDisplayProgress = Args.hasArg(OPT_analyzer_display_progress); in ParseAnalyzerArgs()
250 Args.hasArg(OPT_analyzer_opt_analyze_nested_blocks); in ParseAnalyzerArgs()
251 Opts.eagerlyAssumeBinOpBifurcation = Args.hasArg(OPT_analyzer_eagerly_assume); in ParseAnalyzerArgs()
252 Opts.AnalyzeSpecificFunction = Args.getLastArgValue(OPT_analyze_function); in ParseAnalyzerArgs()
253 Opts.UnoptimizedCFG = Args.hasArg(OPT_analysis_UnoptimizedCFG); in ParseAnalyzerArgs()
254 Opts.TrimGraph = Args.hasArg(OPT_trim_egraph); in ParseAnalyzerArgs()
256 getLastArgIntValue(Args, OPT_analyzer_max_loop, 4, Diags); in ParseAnalyzerArgs()
257 Opts.PrintStats = Args.hasArg(OPT_analyzer_stats); in ParseAnalyzerArgs()
259 getLastArgIntValue(Args, OPT_analyzer_inline_max_stack_depth, in ParseAnalyzerArgs()
264 Args.filtered(OPT_analyzer_checker, OPT_analyzer_disable_checker)) { in ParseAnalyzerArgs()
277 for (const Arg *A : Args.filtered(OPT_analyzer_config)) { in ParseAnalyzerArgs()
307 static bool ParseMigratorArgs(MigratorOptions &Opts, ArgList &Args) { in ParseMigratorArgs() argument
308 Opts.NoNSAllocReallocError = Args.hasArg(OPT_migrator_no_nsalloc_error); in ParseMigratorArgs()
309 Opts.NoFinalizeRemoval = Args.hasArg(OPT_migrator_no_finalize_removal); in ParseMigratorArgs()
313 static void ParseCommentArgs(CommentOptions &Opts, ArgList &Args) { in ParseCommentArgs() argument
314 Opts.BlockCommandNames = Args.getAllArgValues(OPT_fcomment_block_commands); in ParseCommentArgs()
315 Opts.ParseAllComments = Args.hasArg(OPT_fparse_all_comments); in ParseCommentArgs()
318 static StringRef getCodeModel(ArgList &Args, DiagnosticsEngine &Diags) { in getCodeModel() argument
319 if (Arg *A = Args.getLastArg(OPT_mcode_model)) { in getCodeModel()
324 Diags.Report(diag::err_drv_invalid_value) << A->getAsString(Args) << Value; in getCodeModel()
332 GenerateOptimizationRemarkRegex(DiagnosticsEngine &Diags, ArgList &Args, in GenerateOptimizationRemarkRegex() argument
339 << RegexError << RpassArg->getAsString(Args); in GenerateOptimizationRemarkRegex()
381 static void setPGOInstrumentor(CodeGenOptions &Opts, ArgList &Args, in setPGOInstrumentor() argument
383 Arg *A = Args.getLastArg(OPT_fprofile_instrument_EQ); in setPGOInstrumentor()
393 Diags.Report(diag::err_drv_invalid_pgo_instrumentor) << A->getAsString(Args) in setPGOInstrumentor()
420 static bool ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, InputKind IK, in ParseCodeGenArgs() argument
427 unsigned OptimizationLevel = getOptimizationLevel(Args, IK, Diags); in ParseCodeGenArgs()
434 << Args.getLastArg(OPT_O)->getAsString(Args) << "-O" << MaxOptLevel; in ParseCodeGenArgs()
444 Opts.NoInline = Args.hasArg(OPT_fno_inline); in ParseCodeGenArgs()
445 if (Arg* InlineArg = Args.getLastArg(options::OPT_finline_functions, in ParseCodeGenArgs()
457 if (Arg *A = Args.getLastArg(OPT_fveclib)) { in ParseCodeGenArgs()
464 Diags.Report(diag::err_drv_invalid_value) << A->getAsString(Args) << Name; in ParseCodeGenArgs()
467 if (Arg *A = Args.getLastArg(OPT_debug_info_kind_EQ)) { in ParseCodeGenArgs()
475 Diags.Report(diag::err_drv_invalid_value) << A->getAsString(Args) in ParseCodeGenArgs()
480 if (Arg *A = Args.getLastArg(OPT_debugger_tuning_EQ)) { in ParseCodeGenArgs()
487 Diags.Report(diag::err_drv_invalid_value) << A->getAsString(Args) in ParseCodeGenArgs()
492 Opts.DwarfVersion = getLastArgIntValue(Args, OPT_dwarf_version_EQ, 0, Diags); in ParseCodeGenArgs()
493 Opts.DebugColumnInfo = Args.hasArg(OPT_dwarf_column_info); in ParseCodeGenArgs()
494 Opts.EmitCodeView = Args.hasArg(OPT_gcodeview); in ParseCodeGenArgs()
495 Opts.WholeProgramVTables = Args.hasArg(OPT_fwhole_program_vtables); in ParseCodeGenArgs()
496 Opts.LTOVisibilityPublicStd = Args.hasArg(OPT_flto_visibility_public_std); in ParseCodeGenArgs()
497 Opts.SplitDwarfFile = Args.getLastArgValue(OPT_split_dwarf_file); in ParseCodeGenArgs()
498 Opts.DebugTypeExtRefs = Args.hasArg(OPT_dwarf_ext_refs); in ParseCodeGenArgs()
501 for (const auto &Arg : Args.getAllArgValues(OPT_fdebug_prefix_map_EQ)) in ParseCodeGenArgs()
505 Args.getLastArg(OPT_emit_llvm_uselists, OPT_no_emit_llvm_uselists)) in ParseCodeGenArgs()
508 Opts.DisableLLVMOpts = Args.hasArg(OPT_disable_llvm_optzns); in ParseCodeGenArgs()
509 Opts.DisableLLVMPasses = Args.hasArg(OPT_disable_llvm_passes); in ParseCodeGenArgs()
510 Opts.DisableRedZone = Args.hasArg(OPT_disable_red_zone); in ParseCodeGenArgs()
511 Opts.ForbidGuardVariables = Args.hasArg(OPT_fforbid_guard_variables); in ParseCodeGenArgs()
512 Opts.UseRegisterSizedBitfieldAccess = Args.hasArg( in ParseCodeGenArgs()
514 Opts.RelaxedAliasing = Args.hasArg(OPT_relaxed_aliasing); in ParseCodeGenArgs()
515 Opts.StructPathTBAA = !Args.hasArg(OPT_no_struct_path_tbaa); in ParseCodeGenArgs()
516 Opts.DwarfDebugFlags = Args.getLastArgValue(OPT_dwarf_debug_flags); in ParseCodeGenArgs()
517 Opts.MergeAllConstants = !Args.hasArg(OPT_fno_merge_all_constants); in ParseCodeGenArgs()
518 Opts.NoCommon = Args.hasArg(OPT_fno_common); in ParseCodeGenArgs()
519 Opts.NoImplicitFloat = Args.hasArg(OPT_no_implicit_float); in ParseCodeGenArgs()
520 Opts.OptimizeSize = getOptimizationLevelSize(Args); in ParseCodeGenArgs()
521 Opts.SimplifyLibCalls = !(Args.hasArg(OPT_fno_builtin) || in ParseCodeGenArgs()
522 Args.hasArg(OPT_ffreestanding)); in ParseCodeGenArgs()
524 getAllNoBuiltinFuncValues(Args, Opts.NoBuiltinFuncs); in ParseCodeGenArgs()
526 Args.hasFlag(OPT_funroll_loops, OPT_fno_unroll_loops, in ParseCodeGenArgs()
528 Opts.RerollLoops = Args.hasArg(OPT_freroll_loops); in ParseCodeGenArgs()
530 Opts.DisableIntegratedAS = Args.hasArg(OPT_fno_integrated_as); in ParseCodeGenArgs()
531 Opts.Autolink = !Args.hasArg(OPT_fno_autolink); in ParseCodeGenArgs()
532 Opts.SampleProfileFile = Args.getLastArgValue(OPT_fprofile_sample_use_EQ); in ParseCodeGenArgs()
534 setPGOInstrumentor(Opts, Args, Diags); in ParseCodeGenArgs()
536 Args.getLastArgValue(OPT_fprofile_instrument_path_EQ); in ParseCodeGenArgs()
538 Args.getLastArgValue(OPT_fprofile_instrument_use_path_EQ); in ParseCodeGenArgs()
543 Args.hasFlag(OPT_fcoverage_mapping, OPT_fno_coverage_mapping, false); in ParseCodeGenArgs()
544 Opts.DumpCoverageMapping = Args.hasArg(OPT_dump_coverage_mapping); in ParseCodeGenArgs()
545 Opts.AsmVerbose = Args.hasArg(OPT_masm_verbose); in ParseCodeGenArgs()
546 Opts.AssumeSaneOperatorNew = !Args.hasArg(OPT_fno_assume_sane_operator_new); in ParseCodeGenArgs()
547 Opts.ObjCAutoRefCountExceptions = Args.hasArg(OPT_fobjc_arc_exceptions); in ParseCodeGenArgs()
548 Opts.CXAAtExit = !Args.hasArg(OPT_fno_use_cxa_atexit); in ParseCodeGenArgs()
549 Opts.CXXCtorDtorAliases = Args.hasArg(OPT_mconstructor_aliases); in ParseCodeGenArgs()
550 Opts.CodeModel = getCodeModel(Args, Diags); in ParseCodeGenArgs()
551 Opts.DebugPass = Args.getLastArgValue(OPT_mdebug_pass); in ParseCodeGenArgs()
553 (Args.hasArg(OPT_mdisable_fp_elim) || Args.hasArg(OPT_pg)); in ParseCodeGenArgs()
554 Opts.DisableFree = Args.hasArg(OPT_disable_free); in ParseCodeGenArgs()
555 Opts.DiscardValueNames = Args.hasArg(OPT_discard_value_names); in ParseCodeGenArgs()
556 Opts.DisableTailCalls = Args.hasArg(OPT_mdisable_tail_calls); in ParseCodeGenArgs()
557 Opts.FloatABI = Args.getLastArgValue(OPT_mfloat_abi); in ParseCodeGenArgs()
558 Opts.LessPreciseFPMAD = Args.hasArg(OPT_cl_mad_enable); in ParseCodeGenArgs()
559 Opts.LimitFloatPrecision = Args.getLastArgValue(OPT_mlimit_float_precision); in ParseCodeGenArgs()
560 Opts.NoInfsFPMath = (Args.hasArg(OPT_menable_no_infinities) || in ParseCodeGenArgs()
561 Args.hasArg(OPT_cl_finite_math_only) || in ParseCodeGenArgs()
562 Args.hasArg(OPT_cl_fast_relaxed_math)); in ParseCodeGenArgs()
563 Opts.NoNaNsFPMath = (Args.hasArg(OPT_menable_no_nans) || in ParseCodeGenArgs()
564 Args.hasArg(OPT_cl_unsafe_math_optimizations) || in ParseCodeGenArgs()
565 Args.hasArg(OPT_cl_finite_math_only) || in ParseCodeGenArgs()
566 Args.hasArg(OPT_cl_fast_relaxed_math)); in ParseCodeGenArgs()
567 Opts.NoSignedZeros = (Args.hasArg(OPT_fno_signed_zeros) || in ParseCodeGenArgs()
568 Args.hasArg(OPT_cl_no_signed_zeros)); in ParseCodeGenArgs()
569 Opts.ReciprocalMath = Args.hasArg(OPT_freciprocal_math); in ParseCodeGenArgs()
570 Opts.NoZeroInitializedInBSS = Args.hasArg(OPT_mno_zero_initialized_in_bss); in ParseCodeGenArgs()
571 Opts.BackendOptions = Args.getAllArgValues(OPT_backend_option); in ParseCodeGenArgs()
572 Opts.NumRegisterParameters = getLastArgIntValue(Args, OPT_mregparm, 0, Diags); in ParseCodeGenArgs()
573 Opts.NoExecStack = Args.hasArg(OPT_mno_exec_stack); in ParseCodeGenArgs()
574 Opts.FatalWarnings = Args.hasArg(OPT_massembler_fatal_warnings); in ParseCodeGenArgs()
575 Opts.EnableSegmentedStacks = Args.hasArg(OPT_split_stacks); in ParseCodeGenArgs()
576 Opts.RelaxAll = Args.hasArg(OPT_mrelax_all); in ParseCodeGenArgs()
578 Args.hasArg(OPT_mincremental_linker_compatible); in ParseCodeGenArgs()
579 Opts.OmitLeafFramePointer = Args.hasArg(OPT_momit_leaf_frame_pointer); in ParseCodeGenArgs()
580 Opts.SaveTempLabels = Args.hasArg(OPT_msave_temp_labels); in ParseCodeGenArgs()
581 Opts.NoDwarfDirectoryAsm = Args.hasArg(OPT_fno_dwarf_directory_asm); in ParseCodeGenArgs()
582 Opts.SoftFloat = Args.hasArg(OPT_msoft_float); in ParseCodeGenArgs()
583 Opts.StrictEnums = Args.hasArg(OPT_fstrict_enums); in ParseCodeGenArgs()
584 Opts.StrictVTablePointers = Args.hasArg(OPT_fstrict_vtable_pointers); in ParseCodeGenArgs()
585 Opts.UnsafeFPMath = Args.hasArg(OPT_menable_unsafe_fp_math) || in ParseCodeGenArgs()
586 Args.hasArg(OPT_cl_unsafe_math_optimizations) || in ParseCodeGenArgs()
587 Args.hasArg(OPT_cl_fast_relaxed_math); in ParseCodeGenArgs()
588 Opts.UnwindTables = Args.hasArg(OPT_munwind_tables); in ParseCodeGenArgs()
589 Opts.RelocationModel = Args.getLastArgValue(OPT_mrelocation_model, "pic"); in ParseCodeGenArgs()
590 Opts.ThreadModel = Args.getLastArgValue(OPT_mthread_model, "posix"); in ParseCodeGenArgs()
593 << Args.getLastArg(OPT_mthread_model)->getAsString(Args) in ParseCodeGenArgs()
595 Opts.TrapFuncName = Args.getLastArgValue(OPT_ftrap_function_EQ); in ParseCodeGenArgs()
596 Opts.UseInitArray = Args.hasArg(OPT_fuse_init_array); in ParseCodeGenArgs()
598 Opts.FunctionSections = Args.hasFlag(OPT_ffunction_sections, in ParseCodeGenArgs()
600 Opts.DataSections = Args.hasFlag(OPT_fdata_sections, in ParseCodeGenArgs()
602 Opts.UniqueSectionNames = Args.hasFlag(OPT_funique_section_names, in ParseCodeGenArgs()
605 Opts.MergeFunctions = Args.hasArg(OPT_fmerge_functions); in ParseCodeGenArgs()
607 Opts.NoUseJumpTables = Args.hasArg(OPT_fno_jump_tables); in ParseCodeGenArgs()
609 Opts.PrepareForLTO = Args.hasArg(OPT_flto, OPT_flto_EQ); in ParseCodeGenArgs()
610 const Arg *A = Args.getLastArg(OPT_flto, OPT_flto_EQ); in ParseCodeGenArgs()
612 if (Arg *A = Args.getLastArg(OPT_fthinlto_index_EQ)) { in ParseCodeGenArgs()
615 << A->getAsString(Args) << "-x ir"; in ParseCodeGenArgs()
616 Opts.ThinLTOIndexFile = Args.getLastArgValue(OPT_fthinlto_index_EQ); in ParseCodeGenArgs()
619 Opts.MSVolatile = Args.hasArg(OPT_fms_volatile); in ParseCodeGenArgs()
621 Opts.VectorizeBB = Args.hasArg(OPT_vectorize_slp_aggressive); in ParseCodeGenArgs()
622 Opts.VectorizeLoop = Args.hasArg(OPT_vectorize_loops); in ParseCodeGenArgs()
623 Opts.VectorizeSLP = Args.hasArg(OPT_vectorize_slp); in ParseCodeGenArgs()
625 Opts.MainFileName = Args.getLastArgValue(OPT_main_file_name); in ParseCodeGenArgs()
626 Opts.VerifyModule = !Args.hasArg(OPT_disable_llvm_verifier); in ParseCodeGenArgs()
628 Opts.DisableGCov = Args.hasArg(OPT_test_coverage); in ParseCodeGenArgs()
629 Opts.EmitGcovArcs = Args.hasArg(OPT_femit_coverage_data); in ParseCodeGenArgs()
630 Opts.EmitGcovNotes = Args.hasArg(OPT_femit_coverage_notes); in ParseCodeGenArgs()
632 Opts.CoverageFile = Args.getLastArgValue(OPT_coverage_file); in ParseCodeGenArgs()
633 Opts.CoverageExtraChecksum = Args.hasArg(OPT_coverage_cfg_checksum); in ParseCodeGenArgs()
635 Args.hasArg(OPT_coverage_no_function_names_in_data); in ParseCodeGenArgs()
637 Args.hasArg(OPT_coverage_exit_block_before_body); in ParseCodeGenArgs()
638 if (Args.hasArg(OPT_coverage_version_EQ)) { in ParseCodeGenArgs()
639 StringRef CoverageVersion = Args.getLastArgValue(OPT_coverage_version_EQ); in ParseCodeGenArgs()
642 << Args.getLastArg(OPT_coverage_version_EQ)->getAsString(Args) in ParseCodeGenArgs()
650 if (Arg *A = Args.getLastArg(OPT_fembed_bitcode_EQ)) { in ParseCodeGenArgs()
659 Diags.Report(diag::err_drv_invalid_value) << A->getAsString(Args) << Name; in ParseCodeGenArgs()
669 for (const auto &A : Args) { in ParseCodeGenArgs()
679 A->render(Args, ASL); in ParseCodeGenArgs()
689 Opts.InstrumentFunctions = Args.hasArg(OPT_finstrument_functions); in ParseCodeGenArgs()
690 Opts.XRayInstrumentFunctions = Args.hasArg(OPT_fxray_instrument); in ParseCodeGenArgs()
692 getLastArgIntValue(Args, OPT_fxray_instruction_threshold_, 200, Diags); in ParseCodeGenArgs()
693 Opts.InstrumentForProfiling = Args.hasArg(OPT_pg); in ParseCodeGenArgs()
694 Opts.EmitOpenCLArgMetadata = Args.hasArg(OPT_cl_kernel_arg_info); in ParseCodeGenArgs()
695 Opts.CompressDebugSections = Args.hasArg(OPT_compress_debug_sections); in ParseCodeGenArgs()
696 Opts.RelaxELFRelocations = Args.hasArg(OPT_mrelax_relocations); in ParseCodeGenArgs()
697 Opts.DebugCompilationDir = Args.getLastArgValue(OPT_fdebug_compilation_dir); in ParseCodeGenArgs()
698 for (auto A : Args.filtered(OPT_mlink_bitcode_file, OPT_mlink_cuda_bitcode)) { in ParseCodeGenArgs()
706 getLastArgIntValue(Args, OPT_fsanitize_coverage_type, 0, Diags); in ParseCodeGenArgs()
708 Args.hasArg(OPT_fsanitize_coverage_indirect_calls); in ParseCodeGenArgs()
709 Opts.SanitizeCoverageTraceBB = Args.hasArg(OPT_fsanitize_coverage_trace_bb); in ParseCodeGenArgs()
710 Opts.SanitizeCoverageTraceCmp = Args.hasArg(OPT_fsanitize_coverage_trace_cmp); in ParseCodeGenArgs()
712 Args.hasArg(OPT_fsanitize_coverage_8bit_counters); in ParseCodeGenArgs()
713 Opts.SanitizeCoverageTracePC = Args.hasArg(OPT_fsanitize_coverage_trace_pc); in ParseCodeGenArgs()
715 getLastArgIntValue(Args, OPT_fsanitize_memory_track_origins_EQ, 0, Diags); in ParseCodeGenArgs()
717 Args.hasArg(OPT_fsanitize_memory_use_after_dtor); in ParseCodeGenArgs()
718 Opts.SanitizeCfiCrossDso = Args.hasArg(OPT_fsanitize_cfi_cross_dso); in ParseCodeGenArgs()
719 Opts.SanitizeStats = Args.hasArg(OPT_fsanitize_stats); in ParseCodeGenArgs()
721 Args.hasArg(OPT_fsanitize_address_use_after_scope); in ParseCodeGenArgs()
723 getLastArgIntValue(Args, OPT_stack_protector_buffer_size, 8, Diags); in ParseCodeGenArgs()
724 Opts.StackRealignment = Args.hasArg(OPT_mstackrealign); in ParseCodeGenArgs()
725 if (Arg *A = Args.getLastArg(OPT_mstack_alignment)) { in ParseCodeGenArgs()
732 if (Arg *A = Args.getLastArg(OPT_mstack_probe_size)) { in ParseCodeGenArgs()
739 if (Arg *A = Args.getLastArg(OPT_fobjc_dispatch_method_EQ)) { in ParseCodeGenArgs()
747 Diags.Report(diag::err_drv_invalid_value) << A->getAsString(Args) << Name; in ParseCodeGenArgs()
756 Args.hasFlag(OPT_femulated_tls, OPT_fno_emulated_tls, false); in ParseCodeGenArgs()
758 if (Arg *A = Args.getLastArg(OPT_ftlsmodel_EQ)) { in ParseCodeGenArgs()
767 Diags.Report(diag::err_drv_invalid_value) << A->getAsString(Args) << Name; in ParseCodeGenArgs()
774 if (Arg *A = Args.getLastArg(OPT_ffp_contract)) { in ParseCodeGenArgs()
783 Diags.Report(diag::err_drv_invalid_value) << A->getAsString(Args) << Val; in ParseCodeGenArgs()
786 if (Arg *A = Args.getLastArg(OPT_fpcc_struct_return, OPT_freg_struct_return)) { in ParseCodeGenArgs()
795 Opts.DependentLibraries = Args.getAllArgValues(OPT_dependent_lib); in ParseCodeGenArgs()
796 Opts.LinkerOptions = Args.getAllArgValues(OPT_linker_option); in ParseCodeGenArgs()
799 if (Arg *A = Args.getLastArg(OPT_Rpass_EQ)) { in ParseCodeGenArgs()
801 GenerateOptimizationRemarkRegex(Diags, Args, A); in ParseCodeGenArgs()
805 if (Arg *A = Args.getLastArg(OPT_Rpass_missed_EQ)) { in ParseCodeGenArgs()
807 GenerateOptimizationRemarkRegex(Diags, Args, A); in ParseCodeGenArgs()
811 if (Arg *A = Args.getLastArg(OPT_Rpass_analysis_EQ)) { in ParseCodeGenArgs()
813 GenerateOptimizationRemarkRegex(Diags, Args, A); in ParseCodeGenArgs()
828 Opts.RewriteMapFiles = Args.getAllArgValues(OPT_frewrite_map_file); in ParseCodeGenArgs()
833 Args.getAllArgValues(OPT_fsanitize_recover_EQ), Diags, in ParseCodeGenArgs()
836 Args.getAllArgValues(OPT_fsanitize_trap_EQ), Diags, in ParseCodeGenArgs()
840 Args.getAllArgValues(OPT_fcuda_include_gpubinary); in ParseCodeGenArgs()
842 Opts.Backchain = Args.hasArg(OPT_mbackchain); in ParseCodeGenArgs()
845 Args, OPT_fsanitize_undefined_strip_path_components_EQ, 0, Diags); in ParseCodeGenArgs()
851 ArgList &Args) { in ParseDependencyOutputArgs() argument
853 Opts.OutputFile = Args.getLastArgValue(OPT_dependency_file); in ParseDependencyOutputArgs()
854 Opts.Targets = Args.getAllArgValues(OPT_MT); in ParseDependencyOutputArgs()
855 Opts.IncludeSystemHeaders = Args.hasArg(OPT_sys_header_deps); in ParseDependencyOutputArgs()
856 Opts.IncludeModuleFiles = Args.hasArg(OPT_module_file_deps); in ParseDependencyOutputArgs()
857 Opts.UsePhonyTargets = Args.hasArg(OPT_MP); in ParseDependencyOutputArgs()
858 Opts.ShowHeaderIncludes = Args.hasArg(OPT_H); in ParseDependencyOutputArgs()
859 Opts.HeaderIncludeOutputFile = Args.getLastArgValue(OPT_header_include_file); in ParseDependencyOutputArgs()
860 Opts.AddMissingHeaderDeps = Args.hasArg(OPT_MG); in ParseDependencyOutputArgs()
861 Opts.PrintShowIncludes = Args.hasArg(OPT_show_includes); in ParseDependencyOutputArgs()
862 Opts.DOTOutputFile = Args.getLastArgValue(OPT_dependency_dot); in ParseDependencyOutputArgs()
864 Args.getLastArgValue(OPT_module_dependency_dir); in ParseDependencyOutputArgs()
865 if (Args.hasArg(OPT_MV)) in ParseDependencyOutputArgs()
870 Opts.ExtraDeps = Args.getAllArgValues(OPT_fdepfile_entry); in ParseDependencyOutputArgs()
871 auto ModuleFiles = Args.getAllArgValues(OPT_fmodule_file); in ParseDependencyOutputArgs()
876 static bool parseShowColorsArgs(const ArgList &Args, bool DefaultColor) { in parseShowColorsArgs() argument
886 for (Arg *A : Args) { in parseShowColorsArgs()
918 bool clang::ParseDiagnosticArgs(DiagnosticOptions &Opts, ArgList &Args, in ParseDiagnosticArgs() argument
924 Opts.DiagnosticLogFile = Args.getLastArgValue(OPT_diagnostic_log_file); in ParseDiagnosticArgs()
926 Args.getLastArg(OPT_diagnostic_serialized_file, OPT__serialize_diags)) in ParseDiagnosticArgs()
928 Opts.IgnoreWarnings = Args.hasArg(OPT_w); in ParseDiagnosticArgs()
929 Opts.NoRewriteMacros = Args.hasArg(OPT_Wno_rewrite_macros); in ParseDiagnosticArgs()
930 Opts.Pedantic = Args.hasArg(OPT_pedantic); in ParseDiagnosticArgs()
931 Opts.PedanticErrors = Args.hasArg(OPT_pedantic_errors); in ParseDiagnosticArgs()
932 Opts.ShowCarets = !Args.hasArg(OPT_fno_caret_diagnostics); in ParseDiagnosticArgs()
933 Opts.ShowColors = parseShowColorsArgs(Args, DefaultDiagColor); in ParseDiagnosticArgs()
934 Opts.ShowColumn = Args.hasFlag(OPT_fshow_column, in ParseDiagnosticArgs()
937 Opts.ShowFixits = !Args.hasArg(OPT_fno_diagnostics_fixit_info); in ParseDiagnosticArgs()
938 Opts.ShowLocation = !Args.hasArg(OPT_fno_show_source_location); in ParseDiagnosticArgs()
939 Opts.ShowOptionNames = Args.hasArg(OPT_fdiagnostics_show_option); in ParseDiagnosticArgs()
941 llvm::sys::Process::UseANSIEscapeCodes(Args.hasArg(OPT_fansi_escape_codes)); in ParseDiagnosticArgs()
945 if (Arg *A = Args.getLastArg(OPT_fdiagnostics_show_note_include_stack, in ParseDiagnosticArgs()
951 Args.getLastArgValue(OPT_fshow_overloads_EQ, "all"); in ParseDiagnosticArgs()
960 << Args.getLastArg(OPT_fshow_overloads_EQ)->getAsString(Args) in ParseDiagnosticArgs()
965 Args.getLastArgValue(OPT_fdiagnostics_show_category, "none"); in ParseDiagnosticArgs()
976 << Args.getLastArg(OPT_fdiagnostics_show_category)->getAsString(Args) in ParseDiagnosticArgs()
981 Args.getLastArgValue(OPT_fdiagnostics_format, "clang"); in ParseDiagnosticArgs()
995 << Args.getLastArg(OPT_fdiagnostics_format)->getAsString(Args) in ParseDiagnosticArgs()
999 Opts.ShowSourceRanges = Args.hasArg(OPT_fdiagnostics_print_source_range_info); in ParseDiagnosticArgs()
1000 Opts.ShowParseableFixits = Args.hasArg(OPT_fdiagnostics_parseable_fixits); in ParseDiagnosticArgs()
1001 Opts.ShowPresumedLoc = !Args.hasArg(OPT_fno_diagnostics_use_presumed_location); in ParseDiagnosticArgs()
1002 Opts.VerifyDiagnostics = Args.hasArg(OPT_verify); in ParseDiagnosticArgs()
1005 Args.getAllArgValues(OPT_verify_ignore_unexpected_EQ), in ParseDiagnosticArgs()
1007 if (Args.hasArg(OPT_verify_ignore_unexpected)) in ParseDiagnosticArgs()
1010 Opts.ElideType = !Args.hasArg(OPT_fno_elide_type); in ParseDiagnosticArgs()
1011 Opts.ShowTemplateTree = Args.hasArg(OPT_fdiagnostics_show_template_tree); in ParseDiagnosticArgs()
1012 Opts.ErrorLimit = getLastArgIntValue(Args, OPT_ferror_limit, 0, Diags); in ParseDiagnosticArgs()
1014 getLastArgIntValue(Args, OPT_fmacro_backtrace_limit, in ParseDiagnosticArgs()
1017 Args, OPT_ftemplate_backtrace_limit, in ParseDiagnosticArgs()
1020 Args, OPT_fconstexpr_backtrace_limit, in ParseDiagnosticArgs()
1023 Args, OPT_fspell_checking_limit, in ParseDiagnosticArgs()
1025 Opts.TabStop = getLastArgIntValue(Args, OPT_ftabstop, in ParseDiagnosticArgs()
1033 Opts.MessageLength = getLastArgIntValue(Args, OPT_fmessage_length, 0, Diags); in ParseDiagnosticArgs()
1034 addDiagnosticArgs(Args, OPT_W_Group, OPT_W_value_Group, Opts.Warnings); in ParseDiagnosticArgs()
1035 addDiagnosticArgs(Args, OPT_R_Group, OPT_R_value_Group, Opts.Remarks); in ParseDiagnosticArgs()
1040 static void ParseFileSystemArgs(FileSystemOptions &Opts, ArgList &Args) { in ParseFileSystemArgs() argument
1041 Opts.WorkingDir = Args.getLastArgValue(OPT_working_directory); in ParseFileSystemArgs()
1054 SmallVector<StringRef, 5> Args; in parseTestModuleFileExtensionArg() local
1055 Arg.split(Args, ':', 5); in parseTestModuleFileExtensionArg()
1056 if (Args.size() < 5) in parseTestModuleFileExtensionArg()
1059 BlockName = Args[0]; in parseTestModuleFileExtensionArg()
1060 if (Args[1].getAsInteger(10, MajorVersion)) return true; in parseTestModuleFileExtensionArg()
1061 if (Args[2].getAsInteger(10, MinorVersion)) return true; in parseTestModuleFileExtensionArg()
1062 if (Args[3].getAsInteger(2, Hashed)) return true; in parseTestModuleFileExtensionArg()
1063 if (Args.size() > 4) in parseTestModuleFileExtensionArg()
1064 UserInfo = Args[4]; in parseTestModuleFileExtensionArg()
1068 static InputKind ParseFrontendArgs(FrontendOptions &Opts, ArgList &Args, in ParseFrontendArgs() argument
1072 if (const Arg *A = Args.getLastArg(OPT_Action_Group)) { in ParseFrontendArgs()
1143 if (const Arg* A = Args.getLastArg(OPT_plugin)) { in ParseFrontendArgs()
1148 Opts.AddPluginActions = Args.getAllArgValues(OPT_add_plugin); in ParseFrontendArgs()
1149 for (const Arg *AA : Args.filtered(OPT_plugin_arg)) in ParseFrontendArgs()
1153 Args.getAllArgValues(OPT_ftest_module_file_extension_EQ)) { in ParseFrontendArgs()
1172 if (const Arg *A = Args.getLastArg(OPT_code_completion_at)) { in ParseFrontendArgs()
1177 << A->getAsString(Args) << A->getValue(); in ParseFrontendArgs()
1179 Opts.DisableFree = Args.hasArg(OPT_disable_free); in ParseFrontendArgs()
1181 Opts.OutputFile = Args.getLastArgValue(OPT_o); in ParseFrontendArgs()
1182 Opts.Plugins = Args.getAllArgValues(OPT_load); in ParseFrontendArgs()
1183 Opts.RelocatablePCH = Args.hasArg(OPT_relocatable_pch); in ParseFrontendArgs()
1184 Opts.ShowHelp = Args.hasArg(OPT_help); in ParseFrontendArgs()
1185 Opts.ShowStats = Args.hasArg(OPT_print_stats); in ParseFrontendArgs()
1186 Opts.ShowTimers = Args.hasArg(OPT_ftime_report); in ParseFrontendArgs()
1187 Opts.ShowVersion = Args.hasArg(OPT_version); in ParseFrontendArgs()
1188 Opts.ASTMergeFiles = Args.getAllArgValues(OPT_ast_merge); in ParseFrontendArgs()
1189 Opts.LLVMArgs = Args.getAllArgValues(OPT_mllvm); in ParseFrontendArgs()
1190 Opts.FixWhatYouCan = Args.hasArg(OPT_fix_what_you_can); in ParseFrontendArgs()
1191 Opts.FixOnlyWarnings = Args.hasArg(OPT_fix_only_warnings); in ParseFrontendArgs()
1192 Opts.FixAndRecompile = Args.hasArg(OPT_fixit_recompile); in ParseFrontendArgs()
1193 Opts.FixToTemporaries = Args.hasArg(OPT_fixit_to_temp); in ParseFrontendArgs()
1194 Opts.ASTDumpDecls = Args.hasArg(OPT_ast_dump); in ParseFrontendArgs()
1195 Opts.ASTDumpFilter = Args.getLastArgValue(OPT_ast_dump_filter); in ParseFrontendArgs()
1196 Opts.ASTDumpLookups = Args.hasArg(OPT_ast_dump_lookups); in ParseFrontendArgs()
1197 Opts.UseGlobalModuleIndex = !Args.hasArg(OPT_fno_modules_global_index); in ParseFrontendArgs()
1199 Opts.ModuleMapFiles = Args.getAllArgValues(OPT_fmodule_map_file); in ParseFrontendArgs()
1200 Opts.ModuleFiles = Args.getAllArgValues(OPT_fmodule_file); in ParseFrontendArgs()
1201 Opts.ModulesEmbedFiles = Args.getAllArgValues(OPT_fmodules_embed_file_EQ); in ParseFrontendArgs()
1202 Opts.ModulesEmbedAllFiles = Args.hasArg(OPT_fmodules_embed_all_files); in ParseFrontendArgs()
1203 Opts.IncludeTimestamps = !Args.hasArg(OPT_fno_pch_timestamp); in ParseFrontendArgs()
1206 = Args.hasArg(OPT_code_completion_macros); in ParseFrontendArgs()
1208 = Args.hasArg(OPT_code_completion_patterns); in ParseFrontendArgs()
1210 = !Args.hasArg(OPT_no_code_completion_globals); in ParseFrontendArgs()
1212 = Args.hasArg(OPT_code_completion_brief_comments); in ParseFrontendArgs()
1215 = Args.getLastArgValue(OPT_foverride_record_layout_EQ); in ParseFrontendArgs()
1217 llvm::Triple::normalize(Args.getLastArgValue(OPT_aux_triple)); in ParseFrontendArgs()
1218 Opts.FindPchSource = Args.getLastArgValue(OPT_find_pch_source_EQ); in ParseFrontendArgs()
1220 if (const Arg *A = Args.getLastArg(OPT_arcmt_check, in ParseFrontendArgs()
1237 Opts.MTMigrateDir = Args.getLastArgValue(OPT_mt_migrate_directory); in ParseFrontendArgs()
1239 = Args.getLastArgValue(OPT_arcmt_migrate_report_output); in ParseFrontendArgs()
1241 = Args.hasArg(OPT_arcmt_migrate_emit_arc_errors); in ParseFrontendArgs()
1243 if (Args.hasArg(OPT_objcmt_migrate_literals)) in ParseFrontendArgs()
1245 if (Args.hasArg(OPT_objcmt_migrate_subscripting)) in ParseFrontendArgs()
1247 if (Args.hasArg(OPT_objcmt_migrate_property_dot_syntax)) in ParseFrontendArgs()
1249 if (Args.hasArg(OPT_objcmt_migrate_property)) in ParseFrontendArgs()
1251 if (Args.hasArg(OPT_objcmt_migrate_readonly_property)) in ParseFrontendArgs()
1253 if (Args.hasArg(OPT_objcmt_migrate_readwrite_property)) in ParseFrontendArgs()
1255 if (Args.hasArg(OPT_objcmt_migrate_annotation)) in ParseFrontendArgs()
1257 if (Args.hasArg(OPT_objcmt_returns_innerpointer_property)) in ParseFrontendArgs()
1259 if (Args.hasArg(OPT_objcmt_migrate_instancetype)) in ParseFrontendArgs()
1261 if (Args.hasArg(OPT_objcmt_migrate_nsmacros)) in ParseFrontendArgs()
1263 if (Args.hasArg(OPT_objcmt_migrate_protocol_conformance)) in ParseFrontendArgs()
1265 if (Args.hasArg(OPT_objcmt_atomic_property)) in ParseFrontendArgs()
1267 if (Args.hasArg(OPT_objcmt_ns_nonatomic_iosonly)) in ParseFrontendArgs()
1269 if (Args.hasArg(OPT_objcmt_migrate_designated_init)) in ParseFrontendArgs()
1271 if (Args.hasArg(OPT_objcmt_migrate_all)) in ParseFrontendArgs()
1274 Opts.ObjCMTWhiteListPath = Args.getLastArgValue(OPT_objcmt_whitelist_dir_path); in ParseFrontendArgs()
1283 if (const Arg *A = Args.getLastArg(OPT_x)) { in ParseFrontendArgs()
1310 << A->getAsString(Args) << A->getValue(); in ParseFrontendArgs()
1314 std::vector<std::string> Inputs = Args.getAllArgValues(OPT_INPUT); in ParseFrontendArgs()
1351 static void ParseHeaderSearchArgs(HeaderSearchOptions &Opts, ArgList &Args) { in ParseHeaderSearchArgs() argument
1353 Opts.Sysroot = Args.getLastArgValue(OPT_isysroot, "/"); in ParseHeaderSearchArgs()
1354 Opts.Verbose = Args.hasArg(OPT_v); in ParseHeaderSearchArgs()
1355 Opts.UseBuiltinIncludes = !Args.hasArg(OPT_nobuiltininc); in ParseHeaderSearchArgs()
1356 Opts.UseStandardSystemIncludes = !Args.hasArg(OPT_nostdsysteminc); in ParseHeaderSearchArgs()
1357 Opts.UseStandardCXXIncludes = !Args.hasArg(OPT_nostdincxx); in ParseHeaderSearchArgs()
1358 if (const Arg *A = Args.getLastArg(OPT_stdlib_EQ)) in ParseHeaderSearchArgs()
1360 Opts.ResourceDir = Args.getLastArgValue(OPT_resource_dir); in ParseHeaderSearchArgs()
1361 Opts.ModuleCachePath = Args.getLastArgValue(OPT_fmodules_cache_path); in ParseHeaderSearchArgs()
1362 Opts.ModuleUserBuildPath = Args.getLastArgValue(OPT_fmodules_user_build_path); in ParseHeaderSearchArgs()
1363 Opts.DisableModuleHash = Args.hasArg(OPT_fdisable_module_hash); in ParseHeaderSearchArgs()
1364 Opts.ImplicitModuleMaps = Args.hasArg(OPT_fimplicit_module_maps); in ParseHeaderSearchArgs()
1365 Opts.ModuleMapFileHomeIsCwd = Args.hasArg(OPT_fmodule_map_file_home_is_cwd); in ParseHeaderSearchArgs()
1367 getLastArgIntValue(Args, OPT_fmodules_prune_interval, 7 * 24 * 60 * 60); in ParseHeaderSearchArgs()
1369 getLastArgIntValue(Args, OPT_fmodules_prune_after, 31 * 24 * 60 * 60); in ParseHeaderSearchArgs()
1371 Args.hasArg(OPT_fmodules_validate_once_per_build_session); in ParseHeaderSearchArgs()
1373 getLastArgUInt64Value(Args, OPT_fbuild_session_timestamp, 0); in ParseHeaderSearchArgs()
1375 Args.hasArg(OPT_fmodules_validate_system_headers); in ParseHeaderSearchArgs()
1376 if (const Arg *A = Args.getLastArg(OPT_fmodule_format_EQ)) in ParseHeaderSearchArgs()
1379 for (const Arg *A : Args.filtered(OPT_fmodules_ignore_macro)) { in ParseHeaderSearchArgs()
1387 Args.hasArg(OPT__sysroot_EQ) || Args.hasArg(OPT_isysroot); in ParseHeaderSearchArgs()
1388 for (const Arg *A : Args.filtered(OPT_I, OPT_F, OPT_index_header_map)) { in ParseHeaderSearchArgs()
1416 Args.filtered(OPT_iprefix, OPT_iwithprefix, OPT_iwithprefixbefore)) { in ParseHeaderSearchArgs()
1425 for (const Arg *A : Args.filtered(OPT_idirafter)) in ParseHeaderSearchArgs()
1427 for (const Arg *A : Args.filtered(OPT_iquote)) in ParseHeaderSearchArgs()
1429 for (const Arg *A : Args.filtered(OPT_isystem, OPT_iwithsysroot)) in ParseHeaderSearchArgs()
1432 for (const Arg *A : Args.filtered(OPT_iframework)) in ParseHeaderSearchArgs()
1436 for (const Arg *A : Args.filtered(OPT_c_isystem)) in ParseHeaderSearchArgs()
1438 for (const Arg *A : Args.filtered(OPT_cxx_isystem)) in ParseHeaderSearchArgs()
1440 for (const Arg *A : Args.filtered(OPT_objc_isystem)) in ParseHeaderSearchArgs()
1442 for (const Arg *A : Args.filtered(OPT_objcxx_isystem)) in ParseHeaderSearchArgs()
1447 Args.filtered(OPT_internal_isystem, OPT_internal_externc_isystem)) { in ParseHeaderSearchArgs()
1456 Args.filtered(OPT_system_header_prefix, OPT_no_system_header_prefix)) in ParseHeaderSearchArgs()
1460 for (const Arg *A : Args.filtered(OPT_ivfsoverlay)) in ParseHeaderSearchArgs()
1589 static Visibility parseVisibility(Arg *arg, ArgList &args, in parseVisibility() argument
1602 << arg->getAsString(args) << value; in parseVisibility()
1606 static void ParseLangArgs(LangOptions &Opts, ArgList &Args, InputKind IK, in ParseLangArgs() argument
1612 if (const Arg *A = Args.getLastArg(OPT_std_EQ)) { in ParseLangArgs()
1622 << A->getAsString(Args) << A->getValue(); in ParseLangArgs()
1634 << A->getAsString(Args) << "C/ObjC"; in ParseLangArgs()
1642 << A->getAsString(Args) << "C++/ObjC++"; in ParseLangArgs()
1647 << A->getAsString(Args) << "OpenCL"; in ParseLangArgs()
1653 << A->getAsString(Args) << "CUDA"; in ParseLangArgs()
1663 if (const Arg *A = Args.getLastArg(OPT_cl_std_EQ)) { in ParseLangArgs()
1674 << A->getAsString(Args) << A->getValue(); in ParseLangArgs()
1680 Opts.IncludeDefaultHeader = Args.hasArg(OPT_finclude_default_header); in ParseLangArgs()
1688 if (Args.getLastArg(OPT_cl_strict_aliasing) in ParseLangArgs()
1694 << VerSpec << Args.getLastArg(OPT_cl_strict_aliasing)->getAsString(Args); in ParseLangArgs()
1702 Opts.GNUKeywords = Args.hasFlag(OPT_fgnu_keywords, OPT_fno_gnu_keywords, in ParseLangArgs()
1705 if (Args.hasArg(OPT_fno_operator_names)) in ParseLangArgs()
1708 if (Args.hasArg(OPT_fcuda_is_device)) in ParseLangArgs()
1711 if (Args.hasArg(OPT_fcuda_allow_variadic_functions)) in ParseLangArgs()
1714 if (Args.hasArg(OPT_fno_cuda_host_device_constexpr)) in ParseLangArgs()
1717 if (Opts.CUDAIsDevice && Args.hasArg(OPT_fcuda_flush_denormals_to_zero)) in ParseLangArgs()
1720 if (Opts.CUDAIsDevice && Args.hasArg(OPT_fcuda_approx_transcendentals)) in ParseLangArgs()
1724 if (Arg *arg = Args.getLastArg(OPT_fobjc_runtime_EQ)) { in ParseLangArgs()
1730 if (Args.hasArg(OPT_fobjc_gc_only)) in ParseLangArgs()
1732 else if (Args.hasArg(OPT_fobjc_gc)) in ParseLangArgs()
1734 else if (Args.hasArg(OPT_fobjc_arc)) { in ParseLangArgs()
1744 if (Args.hasArg(OPT_fobjc_runtime_has_weak)) in ParseLangArgs()
1751 if (auto weakArg = Args.getLastArg(OPT_fobjc_weak, OPT_fno_objc_weak)) { in ParseLangArgs()
1765 if (Args.hasArg(OPT_fno_objc_infer_related_result_type)) in ParseLangArgs()
1768 if (Args.hasArg(OPT_fobjc_subscripting_legacy_runtime)) in ParseLangArgs()
1773 if (Args.hasArg(OPT_fgnu89_inline)) { in ParseLangArgs()
1781 if (Args.hasArg(OPT_fapple_kext)) { in ParseLangArgs()
1788 if (Args.hasArg(OPT_print_ivar_layout)) in ParseLangArgs()
1790 if (Args.hasArg(OPT_fno_constant_cfstrings)) in ParseLangArgs()
1793 if (Args.hasArg(OPT_faltivec)) in ParseLangArgs()
1796 if (Args.hasArg(OPT_fzvector)) in ParseLangArgs()
1799 if (Args.hasArg(OPT_pthread)) in ParseLangArgs()
1803 if (Arg *visOpt = Args.getLastArg(OPT_fvisibility)) { in ParseLangArgs()
1804 Opts.setValueVisibilityMode(parseVisibility(visOpt, Args, Diags)); in ParseLangArgs()
1810 if (Arg *typeVisOpt = Args.getLastArg(OPT_ftype_visibility)) { in ParseLangArgs()
1811 Opts.setTypeVisibilityMode(parseVisibility(typeVisOpt, Args, Diags)); in ParseLangArgs()
1816 if (Args.hasArg(OPT_fvisibility_inlines_hidden)) in ParseLangArgs()
1819 if (Args.hasArg(OPT_ftrapv)) { in ParseLangArgs()
1823 Args.getLastArgValue(OPT_ftrapv_handler); in ParseLangArgs()
1825 else if (Args.hasArg(OPT_fwrapv)) in ParseLangArgs()
1828 Opts.MSVCCompat = Args.hasArg(OPT_fms_compatibility); in ParseLangArgs()
1829 Opts.MicrosoftExt = Opts.MSVCCompat || Args.hasArg(OPT_fms_extensions); in ParseLangArgs()
1830 Opts.AsmBlocks = Args.hasArg(OPT_fasm_blocks) || Opts.MicrosoftExt; in ParseLangArgs()
1832 if (const Arg *A = Args.getLastArg(OPT_fms_compatibility_version)) { in ParseLangArgs()
1835 Diags.Report(diag::err_drv_invalid_value) << A->getAsString(Args) in ParseLangArgs()
1847 Args.hasFlag(OPT_ftrigraphs, OPT_fno_trigraphs, Opts.Trigraphs); in ParseLangArgs()
1849 Opts.DollarIdents = Args.hasFlag(OPT_fdollars_in_identifiers, in ParseLangArgs()
1852 Opts.PascalStrings = Args.hasArg(OPT_fpascal_strings); in ParseLangArgs()
1853 Opts.VtorDispMode = getLastArgIntValue(Args, OPT_vtordisp_mode_EQ, 1, Diags); in ParseLangArgs()
1854 Opts.Borland = Args.hasArg(OPT_fborland_extensions); in ParseLangArgs()
1855 Opts.WritableStrings = Args.hasArg(OPT_fwritable_strings); in ParseLangArgs()
1856 Opts.ConstStrings = Args.hasFlag(OPT_fconst_strings, OPT_fno_const_strings, in ParseLangArgs()
1858 if (Args.hasArg(OPT_fno_lax_vector_conversions)) in ParseLangArgs()
1860 if (Args.hasArg(OPT_fno_threadsafe_statics)) in ParseLangArgs()
1862 Opts.Exceptions = Args.hasArg(OPT_fexceptions); in ParseLangArgs()
1863 Opts.ObjCExceptions = Args.hasArg(OPT_fobjc_exceptions); in ParseLangArgs()
1864 Opts.CXXExceptions = Args.hasArg(OPT_fcxx_exceptions); in ParseLangArgs()
1865 Opts.SjLjExceptions = Args.hasArg(OPT_fsjlj_exceptions); in ParseLangArgs()
1866 Opts.ExternCNoUnwind = Args.hasArg(OPT_fexternc_nounwind); in ParseLangArgs()
1867 Opts.TraditionalCPP = Args.hasArg(OPT_traditional_cpp); in ParseLangArgs()
1869 Opts.RTTI = Opts.CPlusPlus && !Args.hasArg(OPT_fno_rtti); in ParseLangArgs()
1870 Opts.RTTIData = Opts.RTTI && !Args.hasArg(OPT_fno_rtti_data); in ParseLangArgs()
1871 Opts.Blocks = Args.hasArg(OPT_fblocks) || (Opts.OpenCL in ParseLangArgs()
1873 Opts.BlocksRuntimeOptional = Args.hasArg(OPT_fblocks_runtime_optional); in ParseLangArgs()
1874 Opts.Coroutines = Args.hasArg(OPT_fcoroutines); in ParseLangArgs()
1875 Opts.Modules = Args.hasArg(OPT_fmodules); in ParseLangArgs()
1876 Opts.ModulesStrictDeclUse = Args.hasArg(OPT_fmodules_strict_decluse); in ParseLangArgs()
1878 Args.hasArg(OPT_fmodules_decluse) || Opts.ModulesStrictDeclUse; in ParseLangArgs()
1880 Args.hasArg(OPT_fmodules_local_submodule_visibility); in ParseLangArgs()
1882 !Args.hasArg(OPT_fno_modules_search_all) && in ParseLangArgs()
1883 Args.hasArg(OPT_fmodules_search_all); in ParseLangArgs()
1884 Opts.ModulesErrorRecovery = !Args.hasArg(OPT_fno_modules_error_recovery); in ParseLangArgs()
1885 Opts.ImplicitModules = !Args.hasArg(OPT_fno_implicit_modules); in ParseLangArgs()
1886 Opts.CharIsSigned = Opts.OpenCL || !Args.hasArg(OPT_fno_signed_char); in ParseLangArgs()
1887 Opts.WChar = Opts.CPlusPlus && !Args.hasArg(OPT_fno_wchar); in ParseLangArgs()
1888 Opts.ShortWChar = Args.hasFlag(OPT_fshort_wchar, OPT_fno_short_wchar, false); in ParseLangArgs()
1889 Opts.ShortEnums = Args.hasArg(OPT_fshort_enums); in ParseLangArgs()
1890 Opts.Freestanding = Args.hasArg(OPT_ffreestanding); in ParseLangArgs()
1891 Opts.NoBuiltin = Args.hasArg(OPT_fno_builtin) || Opts.Freestanding; in ParseLangArgs()
1893 getAllNoBuiltinFuncValues(Args, Opts.NoBuiltinFuncs); in ParseLangArgs()
1894 Opts.NoMathBuiltin = Args.hasArg(OPT_fno_math_builtin); in ParseLangArgs()
1895 Opts.SizedDeallocation = Args.hasArg(OPT_fsized_deallocation); in ParseLangArgs()
1896 Opts.ConceptsTS = Args.hasArg(OPT_fconcepts_ts); in ParseLangArgs()
1897 Opts.HeinousExtensions = Args.hasArg(OPT_fheinous_gnu_extensions); in ParseLangArgs()
1898 Opts.AccessControl = !Args.hasArg(OPT_fno_access_control); in ParseLangArgs()
1899 Opts.ElideConstructors = !Args.hasArg(OPT_fno_elide_constructors); in ParseLangArgs()
1900 Opts.MathErrno = !Opts.OpenCL && Args.hasArg(OPT_fmath_errno); in ParseLangArgs()
1902 getLastArgIntValue(Args, OPT_ftemplate_depth, 256, Diags); in ParseLangArgs()
1904 getLastArgIntValue(Args, OPT_foperator_arrow_depth, 256, Diags); in ParseLangArgs()
1906 getLastArgIntValue(Args, OPT_fconstexpr_depth, 512, Diags); in ParseLangArgs()
1908 getLastArgIntValue(Args, OPT_fconstexpr_steps, 1048576, Diags); in ParseLangArgs()
1909 Opts.BracketDepth = getLastArgIntValue(Args, OPT_fbracket_depth, 256, Diags); in ParseLangArgs()
1910 Opts.DelayedTemplateParsing = Args.hasArg(OPT_fdelayed_template_parsing); in ParseLangArgs()
1912 getLastArgIntValue(Args, OPT_Wlarge_by_value_copy_EQ, 0, Diags); in ParseLangArgs()
1913 Opts.MSBitfields = Args.hasArg(OPT_mms_bitfields); in ParseLangArgs()
1915 Args.getLastArgValue(OPT_fconstant_string_class); in ParseLangArgs()
1917 !Args.hasArg(OPT_disable_objc_default_synthesize_properties); in ParseLangArgs()
1919 Args.hasArg(OPT_fencode_extended_block_signature); in ParseLangArgs()
1920 Opts.EmitAllDecls = Args.hasArg(OPT_femit_all_decls); in ParseLangArgs()
1921 Opts.PackStruct = getLastArgIntValue(Args, OPT_fpack_struct_EQ, 0, Diags); in ParseLangArgs()
1922 Opts.MaxTypeAlign = getLastArgIntValue(Args, OPT_fmax_type_align_EQ, 0, Diags); in ParseLangArgs()
1923 Opts.AlignDouble = Args.hasArg(OPT_malign_double); in ParseLangArgs()
1924 Opts.PICLevel = getLastArgIntValue(Args, OPT_pic_level, 0, Diags); in ParseLangArgs()
1925 Opts.PIE = Args.hasArg(OPT_pic_is_pie); in ParseLangArgs()
1926 Opts.Static = Args.hasArg(OPT_static_define); in ParseLangArgs()
1927 Opts.DumpRecordLayoutsSimple = Args.hasArg(OPT_fdump_record_layouts_simple); in ParseLangArgs()
1929 || Args.hasArg(OPT_fdump_record_layouts); in ParseLangArgs()
1930 Opts.DumpVTableLayouts = Args.hasArg(OPT_fdump_vtable_layouts); in ParseLangArgs()
1931 Opts.SpellChecking = !Args.hasArg(OPT_fno_spell_checking); in ParseLangArgs()
1932 Opts.NoBitFieldTypeAlign = Args.hasArg(OPT_fno_bitfield_type_align); in ParseLangArgs()
1933 Opts.SinglePrecisionConstants = Args.hasArg(OPT_cl_single_precision_constant); in ParseLangArgs()
1934 Opts.FastRelaxedMath = Args.hasArg(OPT_cl_fast_relaxed_math); in ParseLangArgs()
1935 Opts.HexagonQdsp6Compat = Args.hasArg(OPT_mqdsp6_compat); in ParseLangArgs()
1936 Opts.FakeAddressSpaceMap = Args.hasArg(OPT_ffake_address_space_map); in ParseLangArgs()
1937 Opts.ParseUnknownAnytype = Args.hasArg(OPT_funknown_anytype); in ParseLangArgs()
1938 Opts.DebuggerSupport = Args.hasArg(OPT_fdebugger_support); in ParseLangArgs()
1939 Opts.DebuggerCastResultToId = Args.hasArg(OPT_fdebugger_cast_result_to_id); in ParseLangArgs()
1940 Opts.DebuggerObjCLiteral = Args.hasArg(OPT_fdebugger_objc_literal); in ParseLangArgs()
1941 Opts.ApplePragmaPack = Args.hasArg(OPT_fapple_pragma_pack); in ParseLangArgs()
1942 Opts.CurrentModule = Args.getLastArgValue(OPT_fmodule_name_EQ); in ParseLangArgs()
1943 Opts.AppExt = Args.hasArg(OPT_fapplication_extension); in ParseLangArgs()
1944 Opts.ModuleFeatures = Args.getAllArgValues(OPT_fmodule_feature); in ParseLangArgs()
1946 Opts.NativeHalfType |= Args.hasArg(OPT_fnative_half_type); in ParseLangArgs()
1947 Opts.NativeHalfArgsAndReturns |= Args.hasArg(OPT_fnative_half_arguments_and_returns); in ParseLangArgs()
1948 // Enable HalfArgsAndReturns if present in Args or if NativeHalfArgsAndReturns in ParseLangArgs()
1950 Opts.HalfArgsAndReturns = Args.hasArg(OPT_fallow_half_arguments_and_returns) in ParseLangArgs()
1952 Opts.GNUAsm = !Args.hasArg(OPT_fno_gnu_inline_asm); in ParseLangArgs()
1962 Args.hasFlag(OPT_fdeclspec, OPT_fno_declspec, in ParseLangArgs()
1971 if (Arg *A = Args.getLastArg(OPT_faddress_space_map_mangling_EQ)) { in ParseLangArgs()
1993 if (Arg *A = Args.getLastArg(OPT_fms_memptr_rep_EQ)) { in ParseLangArgs()
2012 if (Arg *A = Args.getLastArg(OPT_fdefault_calling_conv_EQ)) { in ParseLangArgs()
2040 if (Arg *A = Args.getLastArg(OPT_mrtd)) { in ParseLangArgs()
2055 Opts.OpenMP = Args.hasArg(options::OPT_fopenmp) ? 1 : 0; in ParseLangArgs()
2057 Opts.OpenMP && !Args.hasArg(options::OPT_fnoopenmp_use_tls); in ParseLangArgs()
2059 Opts.OpenMP && Args.hasArg(options::OPT_fopenmp_is_device); in ParseLangArgs()
2063 getLastArgIntValue(Args, OPT_fopenmp_version_EQ, Opts.OpenMP, Diags); in ParseLangArgs()
2083 if (Arg *A = Args.getLastArg(options::OPT_fopenmp_targets_EQ)) { in ParseLangArgs()
2097 if (Arg *A = Args.getLastArg(options::OPT_fopenmp_host_ir_file_path)) { in ParseLangArgs()
2105 Opts.Deprecated = Args.hasFlag(OPT_fdeprecated_macro, in ParseLangArgs()
2110 unsigned Opt = getOptimizationLevel(Args, IK, Diags), in ParseLangArgs()
2111 OptSize = getOptimizationLevelSize(Args); in ParseLangArgs()
2118 Opts.NoInlineDefine = !Opt || Args.hasArg(OPT_fno_inline); in ParseLangArgs()
2120 Opts.FastMath = Args.hasArg(OPT_ffast_math) || in ParseLangArgs()
2121 Args.hasArg(OPT_cl_fast_relaxed_math); in ParseLangArgs()
2122 Opts.FiniteMathOnly = Args.hasArg(OPT_ffinite_math_only) || in ParseLangArgs()
2123 Args.hasArg(OPT_cl_finite_math_only) || in ParseLangArgs()
2124 Args.hasArg(OPT_cl_fast_relaxed_math); in ParseLangArgs()
2125 Opts.UnsafeFPMath = Args.hasArg(OPT_menable_unsafe_fp_math) || in ParseLangArgs()
2126 Args.hasArg(OPT_cl_unsafe_math_optimizations) || in ParseLangArgs()
2127 Args.hasArg(OPT_cl_fast_relaxed_math); in ParseLangArgs()
2130 Args.hasArg(OPT_fretain_comments_from_system_headers); in ParseLangArgs()
2132 unsigned SSP = getLastArgIntValue(Args, OPT_stack_protector, 0, Diags); in ParseLangArgs()
2136 << Args.getLastArg(OPT_stack_protector)->getAsString(Args) << SSP; in ParseLangArgs()
2145 parseSanitizerKinds("-fsanitize=", Args.getAllArgValues(OPT_fsanitize_EQ), in ParseLangArgs()
2149 getLastArgIntValue(Args, OPT_fsanitize_address_field_padding, 0, Diags); in ParseLangArgs()
2150 Opts.SanitizerBlacklistFiles = Args.getAllArgValues(OPT_fsanitize_blacklist); in ParseLangArgs()
2153 static void ParsePreprocessorArgs(PreprocessorOptions &Opts, ArgList &Args, in ParsePreprocessorArgs() argument
2157 Opts.ImplicitPCHInclude = Args.getLastArgValue(OPT_include_pch); in ParsePreprocessorArgs()
2158 Opts.ImplicitPTHInclude = Args.getLastArgValue(OPT_include_pth); in ParsePreprocessorArgs()
2159 if (const Arg *A = Args.getLastArg(OPT_token_cache)) in ParsePreprocessorArgs()
2163 Opts.UsePredefines = !Args.hasArg(OPT_undef); in ParsePreprocessorArgs()
2164 Opts.DetailedRecord = Args.hasArg(OPT_detailed_preprocessing_record); in ParsePreprocessorArgs()
2165 Opts.DisablePCHValidation = Args.hasArg(OPT_fno_validate_pch); in ParsePreprocessorArgs()
2167 Opts.DumpDeserializedPCHDecls = Args.hasArg(OPT_dump_deserialized_pch_decls); in ParsePreprocessorArgs()
2168 for (const Arg *A : Args.filtered(OPT_error_on_deserialized_pch_decl)) in ParsePreprocessorArgs()
2171 if (const Arg *A = Args.getLastArg(OPT_preamble_bytes_EQ)) { in ParsePreprocessorArgs()
2188 for (const Arg *A : Args.filtered(OPT_D, OPT_U)) { in ParsePreprocessorArgs()
2195 Opts.MacroIncludes = Args.getAllArgValues(OPT_imacros); in ParsePreprocessorArgs()
2198 for (const Arg *A : Args.filtered(OPT_include)) in ParsePreprocessorArgs()
2201 for (const Arg *A : Args.filtered(OPT_chain_include)) in ParsePreprocessorArgs()
2204 for (const Arg *A : Args.filtered(OPT_remap_file)) { in ParsePreprocessorArgs()
2208 Diags.Report(diag::err_drv_invalid_remap_file) << A->getAsString(Args); in ParsePreprocessorArgs()
2215 if (Arg *A = Args.getLastArg(OPT_fobjc_arc_cxxlib_EQ)) { in ParsePreprocessorArgs()
2223 Diags.Report(diag::err_drv_invalid_value) << A->getAsString(Args) << Name; in ParsePreprocessorArgs()
2230 ArgList &Args, in ParsePreprocessorOutputArgs() argument
2269 Opts.ShowCPP = !Args.hasArg(OPT_dM); in ParsePreprocessorOutputArgs()
2273 Opts.ShowComments = Args.hasArg(OPT_C); in ParsePreprocessorOutputArgs()
2274 Opts.ShowLineMarkers = !Args.hasArg(OPT_P); in ParsePreprocessorOutputArgs()
2275 Opts.ShowMacroComments = Args.hasArg(OPT_CC); in ParsePreprocessorOutputArgs()
2276 Opts.ShowMacros = Args.hasArg(OPT_dM) || Args.hasArg(OPT_dD); in ParsePreprocessorOutputArgs()
2277 Opts.RewriteIncludes = Args.hasArg(OPT_frewrite_includes); in ParsePreprocessorOutputArgs()
2278 Opts.UseLineDirectives = Args.hasArg(OPT_fuse_line_directives); in ParsePreprocessorOutputArgs()
2281 static void ParseTargetArgs(TargetOptions &Opts, ArgList &Args, in ParseTargetArgs() argument
2284 Opts.ABI = Args.getLastArgValue(OPT_target_abi); in ParseTargetArgs()
2285 if (Arg *A = Args.getLastArg(OPT_meabi)) { in ParseTargetArgs()
2294 Diags.Report(diag::err_drv_invalid_value) << A->getAsString(Args) in ParseTargetArgs()
2299 Opts.CPU = Args.getLastArgValue(OPT_target_cpu); in ParseTargetArgs()
2300 Opts.FPMath = Args.getLastArgValue(OPT_mfpmath); in ParseTargetArgs()
2301 Opts.FeaturesAsWritten = Args.getAllArgValues(OPT_target_feature); in ParseTargetArgs()
2302 Opts.LinkerVersion = Args.getLastArgValue(OPT_target_linker_version); in ParseTargetArgs()
2303 Opts.Triple = llvm::Triple::normalize(Args.getLastArgValue(OPT_triple)); in ParseTargetArgs()
2304 Opts.Reciprocals = Args.getAllArgValues(OPT_mrecip_EQ); in ParseTargetArgs()
2320 InputArgList Args = in CreateFromArgs() local
2328 << Args.getArgString(MissingArgIndex) << MissingArgCount; in CreateFromArgs()
2333 for (const Arg *A : Args.filtered(OPT_UNKNOWN)) { in CreateFromArgs()
2334 Diags.Report(diag::err_drv_unknown_argument) << A->getAsString(Args); in CreateFromArgs()
2338 Success &= ParseAnalyzerArgs(*Res.getAnalyzerOpts(), Args, Diags); in CreateFromArgs()
2339 Success &= ParseMigratorArgs(Res.getMigratorOpts(), Args); in CreateFromArgs()
2340 ParseDependencyOutputArgs(Res.getDependencyOutputOpts(), Args); in CreateFromArgs()
2341 Success &= ParseDiagnosticArgs(Res.getDiagnosticOpts(), Args, &Diags, in CreateFromArgs()
2343 ParseCommentArgs(LangOpts.CommentOpts, Args); in CreateFromArgs()
2344 ParseFileSystemArgs(Res.getFileSystemOpts(), Args); in CreateFromArgs()
2346 InputKind DashX = ParseFrontendArgs(Res.getFrontendOpts(), Args, Diags); in CreateFromArgs()
2347 ParseTargetArgs(Res.getTargetOpts(), Args, Diags); in CreateFromArgs()
2348 Success &= ParseCodeGenArgs(Res.getCodeGenOpts(), Args, DashX, Diags, in CreateFromArgs()
2350 ParseHeaderSearchArgs(Res.getHeaderSearchOpts(), Args); in CreateFromArgs()
2355 if (Args.hasArg(OPT_fobjc_arc)) in CreateFromArgs()
2359 LangOpts.PICLevel = getLastArgIntValue(Args, OPT_pic_level, 0, Diags); in CreateFromArgs()
2360 LangOpts.PIE = Args.hasArg(OPT_pic_is_pie); in CreateFromArgs()
2361 parseSanitizerKinds("-fsanitize=", Args.getAllArgValues(OPT_fsanitize_EQ), in CreateFromArgs()
2365 ParseLangArgs(LangOpts, Args, DashX, Res.getTargetOpts(), in CreateFromArgs()
2378 if (!Args.hasArg(OPT_ffp_contract)) in CreateFromArgs()
2394 ParsePreprocessorArgs(Res.getPreprocessorOpts(), Args, FileMgr, Diags); in CreateFromArgs()
2395 ParsePreprocessorOutputArgs(Res.getPreprocessorOutputOpts(), Args, in CreateFromArgs()
2499 static IntTy getLastArgIntValueImpl(const ArgList &Args, OptSpecifier Id, in getLastArgIntValueImpl() argument
2503 if (Arg *A = Args.getLastArg(Id)) { in getLastArgIntValueImpl()
2506 Diags->Report(diag::err_drv_invalid_int_value) << A->getAsString(Args) in getLastArgIntValueImpl()
2515 int getLastArgIntValue(const ArgList &Args, OptSpecifier Id, int Default, in getLastArgIntValue() argument
2517 return getLastArgIntValueImpl<int>(Args, Id, Default, Diags); in getLastArgIntValue()
2520 uint64_t getLastArgUInt64Value(const ArgList &Args, OptSpecifier Id, in getLastArgUInt64Value() argument
2523 return getLastArgIntValueImpl<uint64_t>(Args, Id, Default, Diags); in getLastArgUInt64Value()