Lines Matching refs:Args
69 // Deserialization (from args)
78 static unsigned getOptimizationLevel(ArgList &Args, InputKind IK,
81 if (IK == IK_OpenCL && !Args.hasArg(OPT_cl_opt_disable))
84 if (Arg *A = Args.getLastArg(options::OPT_O_Group)) {
97 return getLastArgIntValue(Args, OPT_O, DefaultOpt, Diags);
103 static unsigned getOptimizationLevelSize(ArgList &Args) {
104 if (Arg *A = Args.getLastArg(options::OPT_O_Group)) {
119 static void addDiagnosticArgs(ArgList &Args, OptSpecifier Group,
122 for (Arg *A : Args.filtered(Group)) {
138 static bool ParseAnalyzerArgs(AnalyzerOptions &Opts, ArgList &Args,
142 if (Arg *A = Args.getLastArg(OPT_analyzer_store)) {
151 << A->getAsString(Args) << Name;
158 if (Arg *A = Args.getLastArg(OPT_analyzer_constraints)) {
167 << A->getAsString(Args) << Name;
174 if (Arg *A = Args.getLastArg(OPT_analyzer_output)) {
183 << A->getAsString(Args) << Name;
190 if (Arg *A = Args.getLastArg(OPT_analyzer_purge)) {
199 << A->getAsString(Args) << Name;
206 if (Arg *A = Args.getLastArg(OPT_analyzer_inlining_mode)) {
215 << A->getAsString(Args) << Name;
222 Opts.ShowCheckerHelp = Args.hasArg(OPT_analyzer_checker_help);
223 Opts.DisableAllChecks = Args.hasArg(OPT_analyzer_disable_all_checks);
226 Args.hasArg(OPT_analyzer_viz_egraph_graphviz);
228 Args.hasArg(OPT_analyzer_viz_egraph_ubigraph);
229 Opts.NoRetryExhausted = Args.hasArg(OPT_analyzer_disable_retry_exhausted);
230 Opts.AnalyzeAll = Args.hasArg(OPT_analyzer_opt_analyze_headers);
231 Opts.AnalyzerDisplayProgress = Args.hasArg(OPT_analyzer_display_progress);
233 Args.hasArg(OPT_analyzer_opt_analyze_nested_blocks);
234 Opts.eagerlyAssumeBinOpBifurcation = Args.hasArg(OPT_analyzer_eagerly_assume);
235 Opts.AnalyzeSpecificFunction = Args.getLastArgValue(OPT_analyze_function);
236 Opts.UnoptimizedCFG = Args.hasArg(OPT_analysis_UnoptimizedCFG);
237 Opts.TrimGraph = Args.hasArg(OPT_trim_egraph);
239 getLastArgIntValue(Args, OPT_analyzer_max_loop, 4, Diags);
240 Opts.PrintStats = Args.hasArg(OPT_analyzer_stats);
242 getLastArgIntValue(Args, OPT_analyzer_inline_max_stack_depth,
247 Args.filtered(OPT_analyzer_checker, OPT_analyzer_disable_checker)) {
260 for (const Arg *A : Args.filtered(OPT_analyzer_config)) {
290 static bool ParseMigratorArgs(MigratorOptions &Opts, ArgList &Args) {
291 Opts.NoNSAllocReallocError = Args.hasArg(OPT_migrator_no_nsalloc_error);
292 Opts.NoFinalizeRemoval = Args.hasArg(OPT_migrator_no_finalize_removal);
296 static void ParseCommentArgs(CommentOptions &Opts, ArgList &Args) {
297 Opts.BlockCommandNames = Args.getAllArgValues(OPT_fcomment_block_commands);
298 Opts.ParseAllComments = Args.hasArg(OPT_fparse_all_comments);
301 static StringRef getCodeModel(ArgList &Args, DiagnosticsEngine &Diags) {
302 if (Arg *A = Args.getLastArg(OPT_mcode_model)) {
307 Diags.Report(diag::err_drv_invalid_value) << A->getAsString(Args) << Value;
315 GenerateOptimizationRemarkRegex(DiagnosticsEngine &Diags, ArgList &Args,
322 << RegexError << RpassArg->getAsString(Args);
363 static bool ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, InputKind IK,
370 unsigned OptimizationLevel = getOptimizationLevel(Args, IK, Diags);
377 << Args.getLastArg(OPT_O)->getAsString(Args) << "-O" << MaxOptLevel;
387 Opts.NoInline = Args.hasArg(OPT_fno_inline);
388 Opts.setInlining(Args.hasArg(OPT_fno_inline_functions) ?
391 if (Arg *A = Args.getLastArg(OPT_fveclib)) {
398 Diags.Report(diag::err_drv_invalid_value) << A->getAsString(Args) << Name;
401 if (Arg *A = Args.getLastArg(OPT_debug_info_kind_EQ)) {
408 if (Arg *A = Args.getLastArg(OPT_debugger_tuning_EQ)) {
415 Opts.DwarfVersion = getLastArgIntValue(Args, OPT_dwarf_version_EQ, 0, Diags);
416 Opts.DebugColumnInfo = Args.hasArg(OPT_dwarf_column_info);
417 Opts.EmitCodeView = Args.hasArg(OPT_gcodeview);
418 Opts.SplitDwarfFile = Args.getLastArgValue(OPT_split_dwarf_file);
419 Opts.DebugTypeExtRefs = Args.hasArg(OPT_dwarf_ext_refs);
423 for (const auto &Arg : Args.getAllArgValues(OPT_fdebug_prefix_map_EQ))
427 Args.getLastArg(OPT_emit_llvm_uselists, OPT_no_emit_llvm_uselists))
430 Opts.DisableLLVMOpts = Args.hasArg(OPT_disable_llvm_optzns);
431 Opts.DisableLLVMPasses = Args.hasArg(OPT_disable_llvm_passes);
432 Opts.DisableRedZone = Args.hasArg(OPT_disable_red_zone);
433 Args.hasArg(OPT_fforbid_guard_variables);
434 Opts.UseRegisterSizedBitfieldAccess = Args.hasArg(
436 Opts.RelaxedAliasing = Args.hasArg(OPT_relaxed_aliasing);
437 Opts.StructPathTBAA = !Args.hasArg(OPT_no_struct_path_tbaa);
438 Opts.DwarfDebugFlags = Args.getLastArgValue(OPT_dwarf_debug_flags);
439 Opts.MergeAllConstants = !Args.hasArg(OPT_fno_merge_all_constants);
440 Opts.NoCommon = Args.hasArg(OPT_fno_common);
441 Opts.NoImplicitFloat = Args.hasArg(OPT_no_implicit_float);
442 Opts.OptimizeSize = getOptimizationLevelSize(Args);
443 Opts.SimplifyLibCalls = !(Args.hasArg(OPT_fno_builtin) ||
444 Args.hasArg(OPT_ffreestanding));
446 Args.hasFlag(OPT_funroll_loops, OPT_fno_unroll_loops,
448 Opts.RerollLoops = Args.hasArg(OPT_freroll_loops);
450 Opts.DisableIntegratedAS = Args.hasArg(OPT_fno_integrated_as);
451 Opts.Autolink = !Args.hasArg(OPT_fno_autolink);
452 Opts.SampleProfileFile = Args.getLastArgValue(OPT_fprofile_sample_use_EQ);
453 Opts.ProfileInstrGenerate = Args.hasArg(OPT_fprofile_instr_generate) ||
454 Args.hasArg(OPT_fprofile_instr_generate_EQ);
455 Opts.InstrProfileOutput = Args.getLastArgValue(OPT_fprofile_instr_generate_EQ);
456 Opts.InstrProfileInput = Args.getLastArgValue(OPT_fprofile_instr_use_EQ);
458 Args.hasFlag(OPT_fcoverage_mapping, OPT_fno_coverage_mapping, false);
459 Opts.DumpCoverageMapping = Args.hasArg(OPT_dump_coverage_mapping);
460 Opts.AsmVerbose = Args.hasArg(OPT_masm_verbose);
461 Opts.ObjCAutoRefCountExceptions = Args.hasArg(OPT_fobjc_arc_exceptions);
462 Opts.CXAAtExit = !Args.hasArg(OPT_fno_use_cxa_atexit);
463 Opts.CXXCtorDtorAliases = Args.hasArg(OPT_mconstructor_aliases);
464 Opts.CodeModel = getCodeModel(Args, Diags);
465 Opts.DebugPass = Args.getLastArgValue(OPT_mdebug_pass);
467 (Args.hasArg(OPT_mdisable_fp_elim) || Args.hasArg(OPT_pg));
468 Opts.DisableFree = Args.hasArg(OPT_disable_free);
469 Opts.DisableTailCalls = Args.hasArg(OPT_mdisable_tail_calls);
470 Opts.FloatABI = Args.getLastArgValue(OPT_mfloat_abi);
471 if (Arg *A = Args.getLastArg(OPT_meabi)) {
480 Diags.Report(diag::err_drv_invalid_value) << A->getAsString(Args)
485 Opts.LessPreciseFPMAD = Args.hasArg(OPT_cl_mad_enable);
486 Opts.LimitFloatPrecision = Args.getLastArgValue(OPT_mlimit_float_precision);
487 Opts.NoInfsFPMath = (Args.hasArg(OPT_menable_no_infinities) ||
488 Args.hasArg(OPT_cl_finite_math_only) ||
489 Args.hasArg(OPT_cl_fast_relaxed_math));
490 Opts.NoNaNsFPMath = (Args.hasArg(OPT_menable_no_nans) ||
491 Args.hasArg(OPT_cl_unsafe_math_optimizations) ||
492 Args.hasArg(OPT_cl_finite_math_only) ||
493 Args.hasArg(OPT_cl_fast_relaxed_math));
494 Opts.NoSignedZeros = Args.hasArg(OPT_fno_signed_zeros);
495 Opts.ReciprocalMath = Args.hasArg(OPT_freciprocal_math);
496 Opts.NoZeroInitializedInBSS = Args.hasArg(OPT_mno_zero_initialized_in_bss);
497 Opts.BackendOptions = Args.getAllArgValues(OPT_backend_option);
498 Opts.NumRegisterParameters = getLastArgIntValue(Args, OPT_mregparm, 0, Diags);
499 Opts.NoExecStack = Args.hasArg(OPT_mno_exec_stack);
500 Opts.FatalWarnings = Args.hasArg(OPT_massembler_fatal_warnings);
501 Opts.EnableSegmentedStacks = Args.hasArg(OPT_split_stacks);
502 Opts.RelaxAll = Args.hasArg(OPT_mrelax_all);
504 Args.hasArg(OPT_mincremental_linker_compatible);
505 Opts.OmitLeafFramePointer = Args.hasArg(OPT_momit_leaf_frame_pointer);
506 Opts.SaveTempLabels = Args.hasArg(OPT_msave_temp_labels);
507 Opts.NoDwarfDirectoryAsm = Args.hasArg(OPT_fno_dwarf_directory_asm);
508 Opts.SoftFloat = Args.hasArg(OPT_msoft_float);
509 Opts.StrictEnums = Args.hasArg(OPT_fstrict_enums);
510 Opts.StrictVTablePointers = Args.hasArg(OPT_fstrict_vtable_pointers);
511 Opts.UnsafeFPMath = Args.hasArg(OPT_menable_unsafe_fp_math) ||
512 Args.hasArg(OPT_cl_unsafe_math_optimizations) ||
513 Args.hasArg(OPT_cl_fast_relaxed_math);
514 Opts.UnwindTables = Args.hasArg(OPT_munwind_tables);
515 Opts.RelocationModel = Args.getLastArgValue(OPT_mrelocation_model, "pic");
516 Opts.ThreadModel = Args.getLastArgValue(OPT_mthread_model, "posix");
519 << Args.getLastArg(OPT_mthread_model)->getAsString(Args)
521 Opts.TrapFuncName = Args.getLastArgValue(OPT_ftrap_function_EQ);
522 Opts.UseInitArray = Args.hasArg(OPT_fuse_init_array);
524 Opts.FunctionSections = Args.hasFlag(OPT_ffunction_sections,
526 Opts.DataSections = Args.hasFlag(OPT_fdata_sections,
528 Opts.UniqueSectionNames = Args.hasFlag(OPT_funique_section_names,
531 Opts.MergeFunctions = Args.hasArg(OPT_fmerge_functions);
533 Opts.PrepareForLTO = Args.hasArg(OPT_flto, OPT_flto_EQ);
534 const Arg *A = Args.getLastArg(OPT_flto, OPT_flto_EQ);
536 if (Arg *A = Args.getLastArg(OPT_fthinlto_index_EQ)) {
539 << A->getAsString(Args) << "-x ir";
540 Opts.ThinLTOIndexFile = Args.getLastArgValue(OPT_fthinlto_index_EQ);
543 Opts.MSVolatile = Args.hasArg(OPT_fms_volatile);
545 Opts.VectorizeBB = Args.hasArg(OPT_vectorize_slp_aggressive);
546 Opts.VectorizeLoop = Args.hasArg(OPT_vectorize_loops);
547 Opts.VectorizeSLP = Args.hasArg(OPT_vectorize_slp);
549 Opts.MainFileName = Args.getLastArgValue(OPT_main_file_name);
550 Opts.VerifyModule = !Args.hasArg(OPT_disable_llvm_verifier);
552 Opts.DisableGCov = Args.hasArg(OPT_test_coverage);
553 Opts.EmitGcovArcs = Args.hasArg(OPT_femit_coverage_data);
554 Opts.EmitGcovNotes = Args.hasArg(OPT_femit_coverage_notes);
556 Opts.CoverageFile = Args.getLastArgValue(OPT_coverage_file);
557 Opts.CoverageExtraChecksum = Args.hasArg(OPT_coverage_cfg_checksum);
559 Args.hasArg(OPT_coverage_no_function_names_in_data);
561 Args.hasArg(OPT_coverage_exit_block_before_body);
562 if (Args.hasArg(OPT_coverage_version_EQ)) {
563 StringRef CoverageVersion = Args.getLastArgValue(OPT_coverage_version_EQ);
566 << Args.getLastArg(OPT_coverage_version_EQ)->getAsString(Args)
574 Opts.InstrumentFunctions = Args.hasArg(OPT_finstrument_functions);
575 Opts.InstrumentForProfiling = Args.hasArg(OPT_pg);
576 Opts.EmitOpenCLArgMetadata = Args.hasArg(OPT_cl_kernel_arg_info);
577 Opts.CompressDebugSections = Args.hasArg(OPT_compress_debug_sections);
578 Opts.DebugCompilationDir = Args.getLastArgValue(OPT_fdebug_compilation_dir);
579 for (auto A : Args.filtered(OPT_mlink_bitcode_file, OPT_mlink_cuda_bitcode)) {
587 getLastArgIntValue(Args, OPT_fsanitize_coverage_type, 0, Diags);
589 Args.hasArg(OPT_fsanitize_coverage_indirect_calls);
590 Opts.SanitizeCoverageTraceBB = Args.hasArg(OPT_fsanitize_coverage_trace_bb);
591 Opts.SanitizeCoverageTraceCmp = Args.hasArg(OPT_fsanitize_coverage_trace_cmp);
593 Args.hasArg(OPT_fsanitize_coverage_8bit_counters);
595 getLastArgIntValue(Args, OPT_fsanitize_memory_track_origins_EQ, 0, Diags);
597 Args.hasArg(OPT_fsanitize_memory_use_after_dtor);
598 Opts.SanitizeCfiCrossDso = Args.hasArg(OPT_fsanitize_cfi_cross_dso);
600 getLastArgIntValue(Args, OPT_stack_protector_buffer_size, 8, Diags);
601 Opts.StackRealignment = Args.hasArg(OPT_mstackrealign);
602 if (Arg *A = Args.getLastArg(OPT_mstack_alignment)) {
609 if (Arg *A = Args.getLastArg(OPT_mstack_probe_size)) {
616 if (Arg *A = Args.getLastArg(OPT_fobjc_dispatch_method_EQ)) {
624 Diags.Report(diag::err_drv_invalid_value) << A->getAsString(Args) << Name;
633 Args.hasFlag(OPT_femulated_tls, OPT_fno_emulated_tls, false);
635 if (Arg *A = Args.getLastArg(OPT_ftlsmodel_EQ)) {
644 Diags.Report(diag::err_drv_invalid_value) << A->getAsString(Args) << Name;
651 if (Arg *A = Args.getLastArg(OPT_ffp_contract)) {
660 Diags.Report(diag::err_drv_invalid_value) << A->getAsString(Args) << Val;
663 if (Arg *A = Args.getLastArg(OPT_fpcc_struct_return, OPT_freg_struct_return)) {
672 Opts.DependentLibraries = Args.getAllArgValues(OPT_dependent_lib);
675 if (Arg *A = Args.getLastArg(OPT_Rpass_EQ)) {
677 GenerateOptimizationRemarkRegex(Diags, Args, A);
681 if (Arg *A = Args.getLastArg(OPT_Rpass_missed_EQ)) {
683 GenerateOptimizationRemarkRegex(Diags, Args, A);
687 if (Arg *A = Args.getLastArg(OPT_Rpass_analysis_EQ)) {
689 GenerateOptimizationRemarkRegex(Diags, Args, A);
704 Opts.RewriteMapFiles = Args.getAllArgValues(OPT_frewrite_map_file);
709 Args.getAllArgValues(OPT_fsanitize_recover_EQ), Diags,
712 Args.getAllArgValues(OPT_fsanitize_trap_EQ), Diags,
716 Args.getAllArgValues(OPT_fcuda_include_gpubinary);
722 ArgList &Args) {
724 Opts.OutputFile = Args.getLastArgValue(OPT_dependency_file);
725 Opts.Targets = Args.getAllArgValues(OPT_MT);
726 Opts.IncludeSystemHeaders = Args.hasArg(OPT_sys_header_deps);
727 Opts.IncludeModuleFiles = Args.hasArg(OPT_module_file_deps);
728 Opts.UsePhonyTargets = Args.hasArg(OPT_MP);
729 Opts.ShowHeaderIncludes = Args.hasArg(OPT_H);
730 Opts.HeaderIncludeOutputFile = Args.getLastArgValue(OPT_header_include_file);
731 Opts.AddMissingHeaderDeps = Args.hasArg(OPT_MG);
732 Opts.PrintShowIncludes = Args.hasArg(OPT_show_includes);
733 Opts.DOTOutputFile = Args.getLastArgValue(OPT_dependency_dot);
735 Args.getLastArgValue(OPT_module_dependency_dir);
736 if (Args.hasArg(OPT_MV))
741 Opts.ExtraDeps = Args.getAllArgValues(OPT_fdepfile_entry);
742 auto ModuleFiles = Args.getAllArgValues(OPT_fmodule_file);
747 bool clang::ParseDiagnosticArgs(DiagnosticOptions &Opts, ArgList &Args,
752 Opts.DiagnosticLogFile = Args.getLastArgValue(OPT_diagnostic_log_file);
754 Args.getLastArg(OPT_diagnostic_serialized_file, OPT__serialize_diags))
756 Opts.IgnoreWarnings = Args.hasArg(OPT_w);
757 Opts.NoRewriteMacros = Args.hasArg(OPT_Wno_rewrite_macros);
758 Opts.Pedantic = Args.hasArg(OPT_pedantic);
759 Opts.PedanticErrors = Args.hasArg(OPT_pedantic_errors);
760 Opts.ShowCarets = !Args.hasArg(OPT_fno_caret_diagnostics);
761 Opts.ShowColors = Args.hasArg(OPT_fcolor_diagnostics);
762 Opts.ShowColumn = Args.hasFlag(OPT_fshow_column,
765 Opts.ShowFixits = !Args.hasArg(OPT_fno_diagnostics_fixit_info);
766 Opts.ShowLocation = !Args.hasArg(OPT_fno_show_source_location);
767 Opts.ShowOptionNames = Args.hasArg(OPT_fdiagnostics_show_option);
769 llvm::sys::Process::UseANSIEscapeCodes(Args.hasArg(OPT_fansi_escape_codes));
773 if (Arg *A = Args.getLastArg(OPT_fdiagnostics_show_note_include_stack,
779 Args.getLastArgValue(OPT_fshow_overloads_EQ, "all");
788 << Args.getLastArg(OPT_fshow_overloads_EQ)->getAsString(Args)
793 Args.getLastArgValue(OPT_fdiagnostics_show_category, "none");
804 << Args.getLastArg(OPT_fdiagnostics_show_category)->getAsString(Args)
809 Args.getLastArgValue(OPT_fdiagnostics_format, "clang");
823 << Args.getLastArg(OPT_fdiagnostics_format)->getAsString(Args)
827 Opts.ShowSourceRanges = Args.hasArg(OPT_fdiagnostics_print_source_range_info);
828 Opts.ShowParseableFixits = Args.hasArg(OPT_fdiagnostics_parseable_fixits);
829 Opts.ShowPresumedLoc = !Args.hasArg(OPT_fno_diagnostics_use_presumed_location);
830 Opts.VerifyDiagnostics = Args.hasArg(OPT_verify);
833 Args.getAllArgValues(OPT_verify_ignore_unexpected_EQ),
835 if (Args.hasArg(OPT_verify_ignore_unexpected))
838 Opts.ElideType = !Args.hasArg(OPT_fno_elide_type);
839 Opts.ShowTemplateTree = Args.hasArg(OPT_fdiagnostics_show_template_tree);
840 Opts.ErrorLimit = getLastArgIntValue(Args, OPT_ferror_limit, 0, Diags);
842 getLastArgIntValue(Args, OPT_fmacro_backtrace_limit,
845 Args, OPT_ftemplate_backtrace_limit,
848 Args, OPT_fconstexpr_backtrace_limit,
851 Args, OPT_fspell_checking_limit,
853 Opts.TabStop = getLastArgIntValue(Args, OPT_ftabstop,
861 Opts.MessageLength = getLastArgIntValue(Args, OPT_fmessage_length, 0, Diags);
862 addDiagnosticArgs(Args, OPT_W_Group, OPT_W_value_Group, Opts.Warnings);
863 addDiagnosticArgs(Args, OPT_R_Group, OPT_R_value_Group, Opts.Remarks);
868 static void ParseFileSystemArgs(FileSystemOptions &Opts, ArgList &Args) {
869 Opts.WorkingDir = Args.getLastArgValue(OPT_working_directory);
882 SmallVector<StringRef, 5> Args;
883 Arg.split(Args, ':', 5);
884 if (Args.size() < 5)
887 BlockName = Args[0];
888 if (Args[1].getAsInteger(10, MajorVersion)) return true;
889 if (Args[2].getAsInteger(10, MinorVersion)) return true;
890 if (Args[3].getAsInteger(2, Hashed)) return true;
891 if (Args.size() > 4)
892 UserInfo = Args[4];
896 static InputKind ParseFrontendArgs(FrontendOptions &Opts, ArgList &Args,
900 if (const Arg *A = Args.getLastArg(OPT_Action_Group)) {
971 if (const Arg* A = Args.getLastArg(OPT_plugin)) {
976 for (const Arg *AA : Args.filtered(OPT_plugin_arg))
981 Opts.AddPluginActions = Args.getAllArgValues(OPT_add_plugin);
984 for (const Arg *A : Args.filtered(OPT_plugin_arg))
989 Args.getAllArgValues(OPT_ftest_module_file_extension_EQ)) {
1008 if (const Arg *A = Args.getLastArg(OPT_code_completion_at)) {
1013 << A->getAsString(Args) << A->getValue();
1015 Opts.DisableFree = Args.hasArg(OPT_disable_free);
1017 Opts.OutputFile = Args.getLastArgValue(OPT_o);
1018 Opts.Plugins = Args.getAllArgValues(OPT_load);
1019 Opts.RelocatablePCH = Args.hasArg(OPT_relocatable_pch);
1020 Opts.ShowHelp = Args.hasArg(OPT_help);
1021 Opts.ShowStats = Args.hasArg(OPT_print_stats);
1022 Opts.ShowTimers = Args.hasArg(OPT_ftime_report);
1023 Opts.ShowVersion = Args.hasArg(OPT_version);
1024 Opts.ASTMergeFiles = Args.getAllArgValues(OPT_ast_merge);
1025 Opts.LLVMArgs = Args.getAllArgValues(OPT_mllvm);
1026 Opts.FixWhatYouCan = Args.hasArg(OPT_fix_what_you_can);
1027 Opts.FixOnlyWarnings = Args.hasArg(OPT_fix_only_warnings);
1028 Opts.FixAndRecompile = Args.hasArg(OPT_fixit_recompile);
1029 Opts.FixToTemporaries = Args.hasArg(OPT_fixit_to_temp);
1030 Opts.ASTDumpDecls = Args.hasArg(OPT_ast_dump);
1031 Opts.ASTDumpFilter = Args.getLastArgValue(OPT_ast_dump_filter);
1032 Opts.ASTDumpLookups = Args.hasArg(OPT_ast_dump_lookups);
1033 Opts.UseGlobalModuleIndex = !Args.hasArg(OPT_fno_modules_global_index);
1035 Opts.ModuleMapFiles = Args.getAllArgValues(OPT_fmodule_map_file);
1036 Opts.ModuleFiles = Args.getAllArgValues(OPT_fmodule_file);
1037 Opts.ModulesEmbedFiles = Args.getAllArgValues(OPT_fmodules_embed_file_EQ);
1038 Opts.ModulesEmbedAllFiles = Args.hasArg(OPT_fmodules_embed_all_files);
1041 = Args.hasArg(OPT_code_completion_macros);
1043 = Args.hasArg(OPT_code_completion_patterns);
1045 = !Args.hasArg(OPT_no_code_completion_globals);
1047 = Args.hasArg(OPT_code_completion_brief_comments);
1050 = Args.getLastArgValue(OPT_foverride_record_layout_EQ);
1052 llvm::Triple::normalize(Args.getLastArgValue(OPT_aux_triple));
1054 if (const Arg *A = Args.getLastArg(OPT_arcmt_check,
1071 Opts.MTMigrateDir = Args.getLastArgValue(OPT_mt_migrate_directory);
1073 = Args.getLastArgValue(OPT_arcmt_migrate_report_output);
1075 = Args.hasArg(OPT_arcmt_migrate_emit_arc_errors);
1077 if (Args.hasArg(OPT_objcmt_migrate_literals))
1079 if (Args.hasArg(OPT_objcmt_migrate_subscripting))
1081 if (Args.hasArg(OPT_objcmt_migrate_property_dot_syntax))
1083 if (Args.hasArg(OPT_objcmt_migrate_property))
1085 if (Args.hasArg(OPT_objcmt_migrate_readonly_property))
1087 if (Args.hasArg(OPT_objcmt_migrate_readwrite_property))
1089 if (Args.hasArg(OPT_objcmt_migrate_annotation))
1091 if (Args.hasArg(OPT_objcmt_returns_innerpointer_property))
1093 if (Args.hasArg(OPT_objcmt_migrate_instancetype))
1095 if (Args.hasArg(OPT_objcmt_migrate_nsmacros))
1097 if (Args.hasArg(OPT_objcmt_migrate_protocol_conformance))
1099 if (Args.hasArg(OPT_objcmt_atomic_property))
1101 if (Args.hasArg(OPT_objcmt_ns_nonatomic_iosonly))
1103 if (Args.hasArg(OPT_objcmt_migrate_designated_init))
1105 if (Args.hasArg(OPT_objcmt_migrate_all))
1108 Opts.ObjCMTWhiteListPath = Args.getLastArgValue(OPT_objcmt_whitelist_dir_path);
1117 if (const Arg *A = Args.getLastArg(OPT_x)) {
1143 << A->getAsString(Args) << A->getValue();
1147 std::vector<std::string> Inputs = Args.getAllArgValues(OPT_INPUT);
1184 static void ParseHeaderSearchArgs(HeaderSearchOptions &Opts, ArgList &Args) {
1186 Opts.Sysroot = Args.getLastArgValue(OPT_isysroot, "/");
1187 Opts.Verbose = Args.hasArg(OPT_v);
1188 Opts.UseBuiltinIncludes = !Args.hasArg(OPT_nobuiltininc);
1189 Opts.UseStandardSystemIncludes = !Args.hasArg(OPT_nostdsysteminc);
1190 Opts.UseStandardCXXIncludes = !Args.hasArg(OPT_nostdincxx);
1191 if (const Arg *A = Args.getLastArg(OPT_stdlib_EQ))
1193 Opts.ResourceDir = Args.getLastArgValue(OPT_resource_dir);
1194 Opts.ModuleCachePath = Args.getLastArgValue(OPT_fmodules_cache_path);
1195 Opts.ModuleUserBuildPath = Args.getLastArgValue(OPT_fmodules_user_build_path);
1196 Opts.DisableModuleHash = Args.hasArg(OPT_fdisable_module_hash);
1197 Opts.ImplicitModuleMaps = Args.hasArg(OPT_fimplicit_module_maps);
1198 Opts.ModuleMapFileHomeIsCwd = Args.hasArg(OPT_fmodule_map_file_home_is_cwd);
1200 getLastArgIntValue(Args, OPT_fmodules_prune_interval, 7 * 24 * 60 * 60);
1202 getLastArgIntValue(Args, OPT_fmodules_prune_after, 31 * 24 * 60 * 60);
1204 Args.hasArg(OPT_fmodules_validate_once_per_build_session);
1206 getLastArgUInt64Value(Args, OPT_fbuild_session_timestamp, 0);
1208 Args.hasArg(OPT_fmodules_validate_system_headers);
1209 if (const Arg *A = Args.getLastArg(OPT_fmodule_format_EQ))
1212 for (const Arg *A : Args.filtered(OPT_fmodules_ignore_macro)) {
1219 for (const Arg *A : Args.filtered(OPT_I, OPT_F, OPT_index_header_map)) {
1237 Args.filtered(OPT_iprefix, OPT_iwithprefix, OPT_iwithprefixbefore)) {
1246 for (const Arg *A : Args.filtered(OPT_idirafter))
1248 for (const Arg *A : Args.filtered(OPT_iquote))
1250 for (const Arg *A : Args.filtered(OPT_isystem, OPT_iwithsysroot))
1253 for (const Arg *A : Args.filtered(OPT_iframework))
1257 for (const Arg *A : Args.filtered(OPT_c_isystem))
1259 for (const Arg *A : Args.filtered(OPT_cxx_isystem))
1261 for (const Arg *A : Args.filtered(OPT_objc_isystem))
1263 for (const Arg *A : Args.filtered(OPT_objcxx_isystem))
1268 Args.filtered(OPT_internal_isystem, OPT_internal_externc_isystem)) {
1277 Args.filtered(OPT_system_header_prefix, OPT_no_system_header_prefix))
1281 for (const Arg *A : Args.filtered(OPT_ivfsoverlay))
1383 static Visibility parseVisibility(Arg *arg, ArgList &args,
1396 << arg->getAsString(args) << value;
1400 static void ParseLangArgs(LangOptions &Opts, ArgList &Args, InputKind IK,
1404 if (const Arg *A = Args.getLastArg(OPT_std_EQ)) {
1412 << A->getAsString(Args) << A->getValue();
1424 << A->getAsString(Args) << "C/ObjC";
1432 << A->getAsString(Args) << "C++/ObjC++";
1437 << A->getAsString(Args) << "OpenCL";
1443 << A->getAsString(Args) << "CUDA";
1453 if (const Arg *A = Args.getLastArg(OPT_cl_std_EQ)) {
1464 << A->getAsString(Args) << A->getValue();
1477 Opts.GNUKeywords = Args.hasFlag(OPT_fgnu_keywords, OPT_fno_gnu_keywords,
1480 if (Args.hasArg(OPT_fno_operator_names))
1483 if (Args.hasArg(OPT_fcuda_is_device))
1486 if (Args.hasArg(OPT_fcuda_allow_host_calls_from_host_device))
1489 if (Args.hasArg(OPT_fcuda_disable_target_call_checks))
1492 if (Args.hasArg(OPT_fcuda_target_overloads))
1496 if (Arg *arg = Args.getLastArg(OPT_fobjc_runtime_EQ)) {
1502 if (Args.hasArg(OPT_fobjc_gc_only))
1504 else if (Args.hasArg(OPT_fobjc_gc))
1506 else if (Args.hasArg(OPT_fobjc_arc)) {
1516 if (Args.hasArg(OPT_fobjc_runtime_has_weak))
1523 if (auto weakArg = Args.getLastArg(OPT_fobjc_weak, OPT_fno_objc_weak)) {
1537 if (Args.hasArg(OPT_fno_objc_infer_related_result_type))
1540 if (Args.hasArg(OPT_fobjc_subscripting_legacy_runtime))
1545 if (Args.hasArg(OPT_fgnu89_inline)) {
1553 if (Args.hasArg(OPT_fapple_kext)) {
1560 if (Args.hasArg(OPT_print_ivar_layout))
1562 if (Args.hasArg(OPT_fno_constant_cfstrings))
1565 if (Args.hasArg(OPT_faltivec))
1568 if (Args.hasArg(OPT_fzvector))
1571 if (Args.hasArg(OPT_pthread))
1575 if (Arg *visOpt = Args.getLastArg(OPT_fvisibility)) {
1576 Opts.setValueVisibilityMode(parseVisibility(visOpt, Args, Diags));
1582 if (Arg *typeVisOpt = Args.getLastArg(OPT_ftype_visibility)) {
1583 Opts.setTypeVisibilityMode(parseVisibility(typeVisOpt, Args, Diags));
1588 if (Args.hasArg(OPT_fvisibility_inlines_hidden))
1591 if (Args.hasArg(OPT_ftrapv)) {
1595 Args.getLastArgValue(OPT_ftrapv_handler);
1597 else if (Args.hasArg(OPT_fwrapv))
1600 Opts.MSVCCompat = Args.hasArg(OPT_fms_compatibility);
1601 Opts.MicrosoftExt = Opts.MSVCCompat || Args.hasArg(OPT_fms_extensions);
1602 Opts.AsmBlocks = Args.hasArg(OPT_fasm_blocks) || Opts.MicrosoftExt;
1604 if (const Arg *A = Args.getLastArg(OPT_fms_compatibility_version)) {
1607 Diags.Report(diag::err_drv_invalid_value) << A->getAsString(Args)
1619 Args.hasFlag(OPT_ftrigraphs, OPT_fno_trigraphs, Opts.Trigraphs);
1621 Opts.DollarIdents = Args.hasFlag(OPT_fdollars_in_identifiers,
1624 Opts.PascalStrings = Args.hasArg(OPT_fpascal_strings);
1625 Opts.VtorDispMode = getLastArgIntValue(Args, OPT_vtordisp_mode_EQ, 1, Diags);
1626 Opts.Borland = Args.hasArg(OPT_fborland_extensions);
1627 Opts.WritableStrings = Args.hasArg(OPT_fwritable_strings);
1628 Opts.ConstStrings = Args.hasFlag(OPT_fconst_strings, OPT_fno_const_strings,
1630 if (Args.hasArg(OPT_fno_lax_vector_conversions))
1632 if (Args.hasArg(OPT_fno_threadsafe_statics))
1634 Opts.Exceptions = Args.hasArg(OPT_fexceptions);
1635 Opts.ObjCExceptions = Args.hasArg(OPT_fobjc_exceptions);
1636 Opts.CXXExceptions = Args.hasArg(OPT_fcxx_exceptions);
1637 Opts.SjLjExceptions = Args.hasArg(OPT_fsjlj_exceptions);
1638 Opts.TraditionalCPP = Args.hasArg(OPT_traditional_cpp);
1640 Opts.RTTI = !Args.hasArg(OPT_fno_rtti);
1641 Opts.RTTIData = Opts.RTTI && !Args.hasArg(OPT_fno_rtti_data);
1642 Opts.Blocks = Args.hasArg(OPT_fblocks);
1643 Opts.BlocksRuntimeOptional = Args.hasArg(OPT_fblocks_runtime_optional);
1644 Opts.Coroutines = Args.hasArg(OPT_fcoroutines);
1645 Opts.Modules = Args.hasArg(OPT_fmodules);
1646 Opts.ModulesStrictDeclUse = Args.hasArg(OPT_fmodules_strict_decluse);
1648 Args.hasArg(OPT_fmodules_decluse) || Opts.ModulesStrictDeclUse;
1650 Args.hasArg(OPT_fmodules_local_submodule_visibility);
1652 !Args.hasArg(OPT_fno_modules_search_all) &&
1653 Args.hasArg(OPT_fmodules_search_all);
1654 Opts.ModulesErrorRecovery = !Args.hasArg(OPT_fno_modules_error_recovery);
1655 Opts.ImplicitModules = !Args.hasArg(OPT_fno_implicit_modules);
1656 Opts.CharIsSigned = Opts.OpenCL || !Args.hasArg(OPT_fno_signed_char);
1657 Opts.WChar = Opts.CPlusPlus && !Args.hasArg(OPT_fno_wchar);
1658 Opts.ShortWChar = Args.hasFlag(OPT_fshort_wchar, OPT_fno_short_wchar, false);
1659 Opts.ShortEnums = Args.hasArg(OPT_fshort_enums);
1660 Opts.Freestanding = Args.hasArg(OPT_ffreestanding);
1661 Opts.NoBuiltin = Args.hasArg(OPT_fno_builtin) || Opts.Freestanding;
1662 Opts.NoMathBuiltin = Args.hasArg(OPT_fno_math_builtin);
1663 Opts.AssumeSaneOperatorNew = !Args.hasArg(OPT_fno_assume_sane_operator_new);
1664 Opts.SizedDeallocation = Args.hasArg(OPT_fsized_deallocation);
1665 Opts.ConceptsTS = Args.hasArg(OPT_fconcepts_ts);
1666 Opts.HeinousExtensions = Args.hasArg(OPT_fheinous_gnu_extensions);
1667 Opts.AccessControl = !Args.hasArg(OPT_fno_access_control);
1668 Opts.ElideConstructors = !Args.hasArg(OPT_fno_elide_constructors);
1669 Opts.MathErrno = !Opts.OpenCL && Args.hasArg(OPT_fmath_errno);
1671 getLastArgIntValue(Args, OPT_ftemplate_depth, 256, Diags);
1673 getLastArgIntValue(Args, OPT_foperator_arrow_depth, 256, Diags);
1675 getLastArgIntValue(Args, OPT_fconstexpr_depth, 512, Diags);
1677 getLastArgIntValue(Args, OPT_fconstexpr_steps, 1048576, Diags);
1678 Opts.BracketDepth = getLastArgIntValue(Args, OPT_fbracket_depth, 256, Diags);
1679 Opts.DelayedTemplateParsing = Args.hasArg(OPT_fdelayed_template_parsing);
1681 getLastArgIntValue(Args, OPT_Wlarge_by_value_copy_EQ, 0, Diags);
1682 Opts.MSBitfields = Args.hasArg(OPT_mms_bitfields);
1684 Args.getLastArgValue(OPT_fconstant_string_class);
1686 !Args.hasArg(OPT_disable_objc_default_synthesize_properties);
1688 Args.hasArg(OPT_fencode_extended_block_signature);
1689 Opts.EmitAllDecls = Args.hasArg(OPT_femit_all_decls);
1690 Opts.PackStruct = getLastArgIntValue(Args, OPT_fpack_struct_EQ, 0, Diags);
1691 Opts.MaxTypeAlign = getLastArgIntValue(Args, OPT_fmax_type_align_EQ, 0, Diags);
1692 Opts.PICLevel = getLastArgIntValue(Args, OPT_pic_level, 0, Diags);
1693 Opts.PIELevel = getLastArgIntValue(Args, OPT_pie_level, 0, Diags);
1694 Opts.Static = Args.hasArg(OPT_static_define);
1695 Opts.DumpRecordLayoutsSimple = Args.hasArg(OPT_fdump_record_layouts_simple);
1697 || Args.hasArg(OPT_fdump_record_layouts);
1698 Opts.DumpVTableLayouts = Args.hasArg(OPT_fdump_vtable_layouts);
1699 Opts.SpellChecking = !Args.hasArg(OPT_fno_spell_checking);
1700 Opts.NoBitFieldTypeAlign = Args.hasArg(OPT_fno_bitfield_type_align);
1701 Opts.SinglePrecisionConstants = Args.hasArg(OPT_cl_single_precision_constant);
1702 Opts.FastRelaxedMath = Args.hasArg(OPT_cl_fast_relaxed_math);
1703 Opts.MRTD = Args.hasArg(OPT_mrtd);
1704 Opts.HexagonQdsp6Compat = Args.hasArg(OPT_mqdsp6_compat);
1705 Opts.FakeAddressSpaceMap = Args.hasArg(OPT_ffake_address_space_map);
1706 Opts.ParseUnknownAnytype = Args.hasArg(OPT_funknown_anytype);
1707 Opts.DebuggerSupport = Args.hasArg(OPT_fdebugger_support);
1708 Opts.DebuggerCastResultToId = Args.hasArg(OPT_fdebugger_cast_result_to_id);
1709 Opts.DebuggerObjCLiteral = Args.hasArg(OPT_fdebugger_objc_literal);
1710 Opts.ApplePragmaPack = Args.hasArg(OPT_fapple_pragma_pack);
1711 Opts.CurrentModule = Args.getLastArgValue(OPT_fmodule_name);
1712 Opts.AppExt = Args.hasArg(OPT_fapplication_extension);
1714 Args.getLastArgValue(OPT_fmodule_implementation_of);
1715 Opts.ModuleFeatures = Args.getAllArgValues(OPT_fmodule_feature);
1717 Opts.NativeHalfType |= Args.hasArg(OPT_fnative_half_type);
1718 Opts.HalfArgsAndReturns = Args.hasArg(OPT_fallow_half_arguments_and_returns);
1719 Opts.GNUAsm = !Args.hasArg(OPT_fno_gnu_inline_asm);
1729 Args.hasFlag(OPT_fdeclspec, OPT_fno_declspec,
1744 if (Arg *A = Args.getLastArg(OPT_faddress_space_map_mangling_EQ)) {
1766 if (Arg *A = Args.getLastArg(OPT_fms_memptr_rep_EQ)) {
1785 Opts.OpenMP = Args.hasArg(options::OPT_fopenmp);
1787 Opts.OpenMP && !Args.hasArg(options::OPT_fnoopenmp_use_tls);
1790 Opts.Deprecated = Args.hasFlag(OPT_fdeprecated_macro,
1795 unsigned Opt = getOptimizationLevel(Args, IK, Diags),
1796 OptSize = getOptimizationLevelSize(Args);
1803 Opts.NoInlineDefine = !Opt || Args.hasArg(OPT_fno_inline);
1805 Opts.FastMath = Args.hasArg(OPT_ffast_math) ||
1806 Args.hasArg(OPT_cl_fast_relaxed_math);
1807 Opts.FiniteMathOnly = Args.hasArg(OPT_ffinite_math_only) ||
1808 Args.hasArg(OPT_cl_finite_math_only) ||
1809 Args.hasArg(OPT_cl_fast_relaxed_math);
1810 Opts.UnsafeFPMath = Args.hasArg(OPT_menable_unsafe_fp_math) ||
1811 Args.hasArg(OPT_cl_unsafe_math_optimizations) ||
1812 Args.hasArg(OPT_cl_fast_relaxed_math);
1815 Args.hasArg(OPT_fretain_comments_from_system_headers);
1817 unsigned SSP = getLastArgIntValue(Args, OPT_stack_protector, 0, Diags);
1821 << Args.getLastArg(OPT_stack_protector)->getAsString(Args) << SSP;
1830 parseSanitizerKinds("-fsanitize=", Args.getAllArgValues(OPT_fsanitize_EQ),
1834 getLastArgIntValue(Args, OPT_fsanitize_address_field_padding, 0, Diags);
1835 Opts.SanitizerBlacklistFiles = Args.getAllArgValues(OPT_fsanitize_blacklist);
1838 static void ParsePreprocessorArgs(PreprocessorOptions &Opts, ArgList &Args,
1842 Opts.ImplicitPCHInclude = Args.getLastArgValue(OPT_include_pch);
1843 Opts.ImplicitPTHInclude = Args.getLastArgValue(OPT_include_pth);
1844 if (const Arg *A = Args.getLastArg(OPT_token_cache))
1848 Opts.UsePredefines = !Args.hasArg(OPT_undef);
1849 Opts.DetailedRecord = Args.hasArg(OPT_detailed_preprocessing_record);
1850 Opts.DisablePCHValidation = Args.hasArg(OPT_fno_validate_pch);
1852 Opts.DumpDeserializedPCHDecls = Args.hasArg(OPT_dump_deserialized_pch_decls);
1853 for (const Arg *A : Args.filtered(OPT_error_on_deserialized_pch_decl))
1856 if (const Arg *A = Args.getLastArg(OPT_preamble_bytes_EQ)) {
1873 for (const Arg *A : Args.filtered(OPT_D, OPT_U)) {
1880 Opts.MacroIncludes = Args.getAllArgValues(OPT_imacros);
1883 for (const Arg *A : Args.filtered(OPT_include))
1886 for (const Arg *A : Args.filtered(OPT_chain_include))
1890 if (Args.hasArg(OPT_faltivec))
1893 for (const Arg *A : Args.filtered(OPT_remap_file)) {
1897 Diags.Report(diag::err_drv_invalid_remap_file) << A->getAsString(Args);
1904 if (Arg *A = Args.getLastArg(OPT_fobjc_arc_cxxlib_EQ)) {
1912 Diags.Report(diag::err_drv_invalid_value) << A->getAsString(Args) << Name;
1919 ArgList &Args,
1958 Opts.ShowCPP = !Args.hasArg(OPT_dM);
1962 Opts.ShowComments = Args.hasArg(OPT_C);
1963 Opts.ShowLineMarkers = !Args.hasArg(OPT_P);
1964 Opts.ShowMacroComments = Args.hasArg(OPT_CC);
1965 Opts.ShowMacros = Args.hasArg(OPT_dM) || Args.hasArg(OPT_dD);
1966 Opts.RewriteIncludes = Args.hasArg(OPT_frewrite_includes);
1967 Opts.UseLineDirectives = Args.hasArg(OPT_fuse_line_directives);
1970 static void ParseTargetArgs(TargetOptions &Opts, ArgList &Args) {
1972 Opts.ABI = Args.getLastArgValue(OPT_target_abi);
1973 Opts.CPU = Args.getLastArgValue(OPT_target_cpu);
1974 Opts.FPMath = Args.getLastArgValue(OPT_mfpmath);
1975 Opts.FeaturesAsWritten = Args.getAllArgValues(OPT_target_feature);
1976 Opts.LinkerVersion = Args.getLastArgValue(OPT_target_linker_version);
1977 Opts.Triple = llvm::Triple::normalize(Args.getLastArgValue(OPT_triple));
1978 Opts.Reciprocals = Args.getAllArgValues(OPT_mrecip_EQ);
1994 InputArgList Args =
2001 << Args.getArgString(MissingArgIndex) << MissingArgCount;
2006 for (const Arg *A : Args.filtered(OPT_UNKNOWN)) {
2007 Diags.Report(diag::err_drv_unknown_argument) << A->getAsString(Args);
2011 Success &= ParseAnalyzerArgs(*Res.getAnalyzerOpts(), Args, Diags);
2012 Success &= ParseMigratorArgs(Res.getMigratorOpts(), Args);
2013 ParseDependencyOutputArgs(Res.getDependencyOutputOpts(), Args);
2014 Success &= ParseDiagnosticArgs(Res.getDiagnosticOpts(), Args, &Diags);
2015 ParseCommentArgs(Res.getLangOpts()->CommentOpts, Args);
2016 ParseFileSystemArgs(Res.getFileSystemOpts(), Args);
2018 InputKind DashX = ParseFrontendArgs(Res.getFrontendOpts(), Args, Diags);
2019 ParseTargetArgs(Res.getTargetOpts(), Args);
2020 Success &= ParseCodeGenArgs(Res.getCodeGenOpts(), Args, DashX, Diags,
2022 ParseHeaderSearchArgs(Res.getHeaderSearchOpts(), Args);
2027 if (Args.hasArg(OPT_fobjc_arc))
2029 parseSanitizerKinds("-fsanitize=", Args.getAllArgValues(OPT_fsanitize_EQ),
2033 ParseLangArgs(*Res.getLangOpts(), Args, DashX, Diags);
2042 ParsePreprocessorArgs(Res.getPreprocessorOpts(), Args, FileMgr, Diags);
2043 ParsePreprocessorOutputArgs(Res.getPreprocessorOutputOpts(), Args,
2197 static IntTy getLastArgIntValueImpl(const ArgList &Args, OptSpecifier Id,
2201 if (Arg *A = Args.getLastArg(Id)) {
2204 Diags->Report(diag::err_drv_invalid_int_value) << A->getAsString(Args)
2213 int getLastArgIntValue(const ArgList &Args, OptSpecifier Id, int Default,
2215 return getLastArgIntValueImpl<int>(Args, Id, Default, Diags);
2218 uint64_t getLastArgUInt64Value(const ArgList &Args, OptSpecifier Id,
2221 return getLastArgIntValueImpl<uint64_t>(Args, Id, Default, Diags);