Home | History | Annotate | Download | only in Frontend

Lines Matching refs:Args

64 // Deserialization (from args)
73 static unsigned getOptimizationLevel(ArgList &Args, InputKind IK,
76 if (IK == IK_OpenCL && !Args.hasArg(OPT_cl_opt_disable))
79 if (Arg *A = Args.getLastArg(options::OPT_O_Group)) {
92 return getLastArgIntValue(Args, OPT_O, DefaultOpt, Diags);
98 static unsigned getOptimizationLevelSize(ArgList &Args) {
99 if (Arg *A = Args.getLastArg(options::OPT_O_Group)) {
114 static void addWarningArgs(ArgList &Args, std::vector<std::string> &Warnings) {
115 for (arg_iterator I = Args.filtered_begin(OPT_W_Group),
116 E = Args.filtered_end(); I != E; ++I) {
137 static bool ParseAnalyzerArgs(AnalyzerOptions &Opts, ArgList &Args,
141 if (Arg *A = Args.getLastArg(OPT_analyzer_store)) {
150 << A->getAsString(Args) << Name;
157 if (Arg *A = Args.getLastArg(OPT_analyzer_constraints)) {
166 << A->getAsString(Args) << Name;
173 if (Arg *A = Args.getLastArg(OPT_analyzer_output)) {
182 << A->getAsString(Args) << Name;
189 if (Arg *A = Args.getLastArg(OPT_analyzer_purge)) {
198 << A->getAsString(Args) << Name;
205 if (Arg *A = Args.getLastArg(OPT_analyzer_inlining_mode)) {
214 << A->getAsString(Args) << Name;
221 Opts.ShowCheckerHelp = Args.hasArg(OPT_analyzer_checker_help);
223 Args.hasArg(OPT_analyzer_viz_egraph_graphviz);
225 Args.hasArg(OPT_analyzer_viz_egraph_ubigraph);
226 Opts.NoRetryExhausted = Args.hasArg(OPT_analyzer_disable_retry_exhausted);
227 Opts.AnalyzeAll = Args.hasArg(OPT_analyzer_opt_analyze_headers);
228 Opts.AnalyzerDisplayProgress = Args.hasArg(OPT_analyzer_display_progress);
230 Args.hasArg(OPT_analyzer_opt_analyze_nested_blocks);
231 Opts.eagerlyAssumeBinOpBifurcation = Args.hasArg(OPT_analyzer_eagerly_assume);
232 Opts.AnalyzeSpecificFunction = Args.getLastArgValue(OPT_analyze_function);
233 Opts.UnoptimizedCFG = Args.hasArg(OPT_analysis_UnoptimizedCFG);
234 Opts.TrimGraph = Args.hasArg(OPT_trim_egraph);
236 getLastArgIntValue(Args, OPT_analyzer_max_loop, 4, Diags);
237 Opts.PrintStats = Args.hasArg(OPT_analyzer_stats);
239 getLastArgIntValue(Args, OPT_analyzer_inline_max_stack_depth,
243 for (arg_iterator it = Args.filtered_begin(OPT_analyzer_checker,
245 ie = Args.filtered_end(); it != ie; ++it) {
259 for (arg_iterator it = Args.filtered_begin(OPT_analyzer_config),
260 ie = Args.filtered_end(); it != ie; ++it) {
291 static bool ParseMigratorArgs(MigratorOptions &Opts, ArgList &Args) {
292 Opts.NoNSAllocReallocError = Args.hasArg(OPT_migrator_no_nsalloc_error);
293 Opts.NoFinalizeRemoval = Args.hasArg(OPT_migrator_no_finalize_removal);
297 static void ParseCommentArgs(CommentOptions &Opts, ArgList &Args) {
298 Opts.BlockCommandNames = Args.getAllArgValues(OPT_fcomment_block_commands);
299 Opts.ParseAllComments = Args.hasArg(OPT_fparse_all_comments);
302 static StringRef getCodeModel(ArgList &Args, DiagnosticsEngine &Diags) {
303 if (Arg *A = Args.getLastArg(OPT_mcode_model)) {
308 Diags.Report(diag::err_drv_invalid_value) << A->getAsString(Args) << Value;
316 GenerateOptimizationRemarkRegex(DiagnosticsEngine &Diags, ArgList &Args,
323 << RegexError << RpassArg->getAsString(Args);
329 static bool ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, InputKind IK,
335 Opts.OptimizationLevel = getOptimizationLevel(Args, IK, Diags);
341 << Args.getLastArg(OPT_O)->getAsString(Args) << "-O" << MaxOptLevel;
350 Opts.NoInline = Args.hasArg(OPT_fno_inline);
351 Opts.setInlining(Args.hasArg(OPT_fno_inline_functions) ?
354 if (Args.hasArg(OPT_gline_tables_only)) {
356 } else if (Args.hasArg(OPT_g_Flag) || Args.hasArg(OPT_gdwarf_2) ||
357 Args.hasArg(OPT_gdwarf_3) || Args.hasArg(OPT_gdwarf_4)) {
365 if (Args.hasFlag(OPT_fstandalone_debug, OPT_fno_standalone_debug, Default))
370 Opts.DebugColumnInfo = Args.hasArg(OPT_dwarf_column_info);
371 Opts.SplitDwarfFile = Args.getLastArgValue(OPT_split_dwarf_file);
372 if (Args.hasArg(OPT_gdwarf_2))
374 else if (Args.hasArg(OPT_gdwarf_3))
376 else if (Args.hasArg(OPT_gdwarf_4))
382 Opts.DisableLLVMOpts = Args.hasArg(OPT_disable_llvm_optzns);
383 Opts.DisableRedZone = Args.hasArg(OPT_disable_red_zone);
384 Opts.ForbidGuardVariables = Args.hasArg(OPT_fforbid_guard_variables);
385 Opts.UseRegisterSizedBitfieldAccess = Args.hasArg(
387 Opts.RelaxedAliasing = Args.hasArg(OPT_relaxed_aliasing);
388 Opts.StructPathTBAA = !Args.hasArg(OPT_no_struct_path_tbaa);
389 Opts.DwarfDebugFlags = Args.getLastArgValue(OPT_dwarf_debug_flags);
390 Opts.MergeAllConstants = !Args.hasArg(OPT_fno_merge_all_constants);
391 Opts.NoCommon = Args.hasArg(OPT_fno_common);
392 Opts.NoImplicitFloat = Args.hasArg(OPT_no_implicit_float);
393 Opts.OptimizeSize = getOptimizationLevelSize(Args);
394 Opts.SimplifyLibCalls = !(Args.hasArg(OPT_fno_builtin) ||
395 Args.hasArg(OPT_ffreestanding));
397 Args.hasFlag(OPT_funroll_loops, OPT_fno_unroll_loops,
399 Opts.RerollLoops = Args.hasArg(OPT_freroll_loops);
401 Opts.DisableIntegratedAS = Args.hasArg(OPT_fno_integrated_as);
402 Opts.Autolink = !Args.hasArg(OPT_fno_autolink);
403 Opts.SampleProfileFile = Args.getLastArgValue(OPT_fprofile_sample_use_EQ);
404 Opts.ProfileInstrGenerate = Args.hasArg(OPT_fprofile_instr_generate);
405 Opts.InstrProfileInput = Args.getLastArgValue(OPT_fprofile_instr_use_EQ);
406 Opts.AsmVerbose = Args.hasArg(OPT_masm_verbose);
407 Opts.ObjCAutoRefCountExceptions = Args.hasArg(OPT_fobjc_arc_exceptions);
408 Opts.CUDAIsDevice = Args.hasArg(OPT_fcuda_is_device);
409 Opts.CXAAtExit = !Args.hasArg(OPT_fno_use_cxa_atexit);
410 Opts.CXXCtorDtorAliases = Args.hasArg(OPT_mconstructor_aliases);
411 Opts.CodeModel = getCodeModel(Args, Diags);
412 Opts.DebugPass = Args.getLastArgValue(OPT_mdebug_pass);
413 Opts.DisableFPElim = Args.hasArg(OPT_mdisable_fp_elim);
414 Opts.DisableFree = Args.hasArg(OPT_disable_free);
415 Opts.DisableTailCalls = Args.hasArg(OPT_mdisable_tail_calls);
416 Opts.FloatABI = Args.getLastArgValue(OPT_mfloat_abi);
417 Opts.LessPreciseFPMAD = Args.hasArg(OPT_cl_mad_enable);
418 Opts.LimitFloatPrecision = Args
419 Opts.NoInfsFPMath = (Args.hasArg(OPT_menable_no_infinities) ||
420 Args.hasArg(OPT_cl_finite_math_only)||
421 Args.hasArg(OPT_cl_fast_relaxed_math));
422 Opts.NoNaNsFPMath = (Args.hasArg(OPT_menable_no_nans) ||
423 Args.hasArg(OPT_cl_finite_math_only)||
424 Args.hasArg(OPT_cl_fast_relaxed_math));
425 Opts.NoZeroInitializedInBSS = Args.hasArg(OPT_mno_zero_initialized_in_bss);
426 Opts.BackendOptions = Args.getAllArgValues(OPT_backend_option);
427 Opts.NumRegisterParameters = getLastArgIntValue(Args, OPT_mregparm, 0, Diags);
428 Opts.NoGlobalMerge = Args.hasArg(OPT_mno_global_merge);
429 Opts.NoExecStack = Args.hasArg(OPT_mno_exec_stack);
430 Opts.EnableSegmentedStacks = Args.hasArg(OPT_split_stacks);
431 Opts.RelaxAll = Args.hasArg(OPT_mrelax_all);
432 Opts.OmitLeafFramePointer = Args.hasArg(OPT_momit_leaf_frame_pointer);
433 Opts.SaveTempLabels = Args.hasArg(OPT_msave_temp_labels);
434 Opts.NoDwarfDirectoryAsm = Args.hasArg(OPT_fno_dwarf_directory_asm);
435 Opts.SoftFloat = Args.hasArg(OPT_msoft_float);
436 Opts.StrictEnums = Args.hasArg(OPT_fstrict_enums);
437 Opts.UnsafeFPMath = Args.hasArg(OPT_menable_unsafe_fp_math) ||
438 Args.hasArg(OPT_cl_unsafe_math_optimizations) ||
439 Args.hasArg(OPT_cl_fast_relaxed_math);
440 Opts.UnwindTables = Args.hasArg(OPT_munwind_tables);
441 Opts.RelocationModel = Args.getLastArgValue(OPT_mrelocation_model, "pic");
442 Opts.TrapFuncName = Args.getLastArgValue(OPT_ftrap_function_EQ);
443 Opts.UseInitArray = Args.hasArg(OPT_fuse_init_array);
445 Opts.FunctionSections = Args.hasFlag(OPT_ffunction_sections,
447 Opts.DataSections = Args.hasFlag(OPT_fdata_sections,
450 Opts.VectorizeBB = Args.hasArg(OPT_vectorize_slp_aggressive);
451 Opts.VectorizeLoop = Args.hasArg(OPT_vectorize_loops);
452 Opts.VectorizeSLP = Args.hasArg(OPT_vectorize_slp);
454 Opts.MainFileName = Args.getLastArgValue(OPT_main_file_name);
455 Opts.VerifyModule = !Args.hasArg(OPT_disable_llvm_verifier);
456 Opts.SanitizeRecover = !Args.hasArg(OPT_fno_sanitize_recover);
458 Opts.DisableGCov = Args.hasArg(OPT_test_coverage);
459 Opts.EmitGcovArcs = Args.hasArg(OPT_femit_coverage_data);
460 Opts.EmitGcovNotes = Args.hasArg(OPT_femit_coverage_notes);
462 Opts.CoverageFile = Args.getLastArgValue(OPT_coverage_file);
463 Opts.CoverageExtraChecksum = Args.hasArg(OPT_coverage_cfg_checksum);
465 Args.hasArg(OPT_coverage_no_function_names_in_data);
466 if (Args.hasArg(OPT_coverage_version_EQ)) {
467 StringRef CoverageVersion = Args.getLastArgValue(OPT_coverage_version_EQ);
470 << Args.getLastArg(OPT_coverage_version_EQ)->getAsString(Args)
478 Opts.InstrumentFunctions = Args.hasArg(OPT_finstrument_functions);
479 Opts.InstrumentForProfiling = Args.hasArg(OPT_pg);
480 Opts.EmitOpenCLArgMetadata = Args.hasArg(OPT_cl_kernel_arg_info);
481 Opts.CompressDebugSections = Args.hasArg(OPT_compress_debug_sections);
482 Opts.DebugCompilationDir = Args.getLastArgValue(OPT_fdebug_compilation_dir);
483 Opts.LinkBitcodeFile = Args.getLastArgValue(OPT_mlink_bitcode_file);
484 Opts.SanitizerBlacklistFile = Args.getLastArgValue(OPT_fsanitize_blacklist);
486 getLastArgIntValue(Args, OPT_fsanitize_memory_track_origins_EQ, 0, Diags);
488 Args.hasArg(OPT_fsanitize_undefined_trap_on_error);
490 getLastArgIntValue(Args, OPT_stack_protector_buffer_size, 8, Diags);
491 Opts.StackRealignment = Args.hasArg(OPT_mstackrealign);
492 if (Arg *A = Args.getLastArg(OPT_mstack_alignment)) {
499 if (Arg *A = Args.getLastArg(OPT_fobjc_dispatch_method_EQ)) {
507 Diags.Report(diag::err_drv_invalid_value) << A->getAsString(Args) << Name;
515 if (Arg *A = Args.getLastArg(OPT_ftlsmodel_EQ)) {
524 Diags.Report(diag::err_drv_invalid_value) << A->getAsString(Args) << Name;
531 if (Arg *A = Args.getLastArg(OPT_ffp_contract)) {
540 Diags.Report(diag::err_drv_invalid_value) << A->getAsString(Args) << Val;
543 if (Arg *A = Args.getLastArg(OPT_fpcc_struct_return, OPT_freg_struct_return)) {
552 Opts.DependentLibraries = Args.getAllArgValues(OPT_dependent_lib);
555 if (Arg *A = Args.getLastArg(OPT_Rpass_EQ)) {
557 GenerateOptimizationRemarkRegex(Diags, Args, A);
561 if (Arg *A = Args.getLastArg(OPT_Rpass_missed_EQ)) {
563 GenerateOptimizationRemarkRegex(Diags, Args, A);
567 if (Arg *A = Args.getLastArg(OPT_Rpass_analysis_EQ)) {
569 GenerateOptimizationRemarkRegex(Diags, Args, A);
582 ArgList &Args) {
584 Opts.OutputFile = Args.getLastArgValue(OPT_dependency_file);
585 Opts.Targets = Args.getAllArgValues(OPT_MT);
586 Opts.IncludeSystemHeaders = Args.hasArg(OPT_sys_header_deps);
587 Opts.IncludeModuleFiles = Args.hasArg(OPT_module_file_deps);
588 Opts.UsePhonyTargets = Args.hasArg(OPT_MP);
589 Opts.ShowHeaderIncludes = Args.hasArg(OPT_H);
590 Opts.HeaderIncludeOutputFile = Args.getLastArgValue(OPT_header_include_file);
591 Opts.AddMissingHeaderDeps = Args.hasArg(OPT_MG);
592 Opts.PrintShowIncludes = Args.hasArg(OPT_show_includes);
593 Opts.DOTOutputFile = Args.getLastArgValue(OPT_dependency_dot);
595 Args.getLastArgValue(OPT_module_dependency_dir);
598 bool clang::ParseDiagnosticArgs(DiagnosticOptions &Opts, ArgList &Args,
603 Opts.DiagnosticLogFile = Args.getLastArgValue(OPT_diagnostic_log_file);
605 Args.getLastArgValue(OPT_diagnostic_serialized_file);
606 Opts.IgnoreWarnings = Args.hasArg(OPT_w);
607 Opts.NoRewriteMacros = Args.hasArg(OPT_Wno_rewrite_macros);
608 Opts.Pedantic = Args.hasArg(OPT_pedantic);
609 Opts.PedanticErrors = Args.hasArg(OPT_pedantic_errors);
610 Opts.ShowCarets = !Args.hasArg(OPT_fno_caret_diagnostics);
611 Opts.ShowColors = Args.hasArg(OPT_fcolor_diagnostics);
612 Opts.ShowColumn = Args.hasFlag(OPT_fshow_column,
615 Opts.ShowFixits = !Args.hasArg(OPT_fno_diagnostics_fixit_info);
616 Opts.ShowLocation = !Args.hasArg(OPT_fno_show_source_location);
617 Opts.ShowOptionNames = Args.hasArg(OPT_fdiagnostics_show_option);
619 llvm::sys::Process::UseANSIEscapeCodes(Args.hasArg(OPT_fansi_escape_codes));
623 if (Arg *A = Args.getLastArg(OPT_fdiagnostics_show_note_include_stack,
629 Args.getLastArgValue(OPT_fshow_overloads_EQ, "all");
638 << Args.getLastArg(OPT_fshow_overloads_EQ)->getAsString(Args)
643 Args.getLastArgValue(OPT_fdiagnostics_show_category, "none");
654 << Args.getLastArg(OPT_fdiagnostics_show_category)->getAsString(Args)
659 Args.getLastArgValue(OPT_fdiagnostics_format, "clang");
673 << Args.getLastArg(OPT_fdiagnostics_format)->getAsString(Args)
677 Opts.ShowSourceRanges = Args.hasArg(OPT_fdiagnostics_print_source_range_info);
678 Opts.ShowParseableFixits = Args.hasArg(OPT_fdiagnostics_parseable_fixits);
679 Opts.ShowPresumedLoc = !Args.hasArg(OPT_fno_diagnostics_use_presumed_location);
680 Opts.VerifyDiagnostics = Args.hasArg(OPT_verify);
681 Opts.ElideType = !Args.hasArg(OPT_fno_elide_type);
682 Opts.ShowTemplateTree = Args.hasArg(OPT_fdiagnostics_show_template_tree);
683 Opts.ErrorLimit = getLastArgIntValue(Args, OPT_ferror_limit, 0, Diags);
685 getLastArgIntValue(Args, OPT_fmacro_backtrace_limit,
688 Args, OPT_ftemplate_backtrace_limit,
691 Args, OPT_fconstexpr_backtrace_limit,
693 Opts.TabStop = getLastArgIntValue(Args, OPT_ftabstop,
701 Opts.MessageLength = getLastArgIntValue(Args, OPT_fmessage_length, 0, Diags);
702 addWarningArgs(Args, Opts.Warnings);
707 static void ParseFileSystemArgs(FileSystemOptions &Opts, ArgList &Args) {
708 Opts.WorkingDir = Args.getLastArgValue(OPT_working_directory);
711 static InputKind ParseFrontendArgs(FrontendOptions &Opts, ArgList &Args,
715 if (const Arg *A = Args.getLastArg(OPT_Action_Group)) {
785 if (const Arg* A = Args.getLastArg(OPT_plugin)) {
790 for (arg_iterator it = Args.filtered_begin(OPT_plugin_arg),
791 end = Args.filtered_end(); it != end; ++it) {
797 Opts.AddPluginActions = Args.getAllArgValues(OPT_add_plugin);
800 for (arg_iterator it = Args.filtered_begin(OPT_plugin_arg),
801 end = Args.filtered_end(); it != end; ++it) {
807 if (const Arg *A = Args.getLastArg(OPT_code_completion_at)) {
812 << A->getAsString(Args) << A->getValue();
814 Opts.DisableFree = Args.hasArg(OPT_disable_free);
816 Opts.OutputFile = Args.getLastArgValue(OPT_o);
817 Opts.Plugins = Args.getAllArgValues(OPT_load);
818 Opts.RelocatablePCH = Args.hasArg(OPT_relocatable_pch);
819 Opts.ShowHelp = Args.hasArg(OPT_help);
820 Opts.ShowStats = Args.hasArg(OPT_print_stats);
821 Opts.ShowTimers = Args.hasArg(OPT_ftime_report);
822 Opts.ShowVersion = Args.hasArg(OPT_version);
823 Opts.ASTMergeFiles = Args.getAllArgValues(OPT_ast_merge);
824 Opts.LLVMArgs = Args.getAllArgValues(OPT_mllvm);
825 Opts.FixWhatYouCan = Args.hasArg(OPT_fix_what_you_can);
826 Opts.FixOnlyWarnings = Args.hasArg(OPT_fix_only_warnings);
827 Opts.FixAndRecompile = Args.hasArg(OPT_fixit_recompile);
828 Opts.FixToTemporaries = Args.hasArg(OPT_fixit_to_temp);
829 Opts.ASTDumpFilter = Args.getLastArgValue(OPT_ast_dump_filter);
830 Opts.ASTDumpLookups = Args.hasArg(OPT_ast_dump_lookups);
831 Opts.UseGlobalModuleIndex = !Args.hasArg(OPT_fno_modules_global_index);
835 = Args.hasArg(OPT_code_completion_macros);
837 = Args.hasArg(OPT_code_completion_patterns);
839 = !Args.hasArg(OPT_no_code_completion_globals);
841 = Args.hasArg(OPT_code_completion_brief_comments);
844 = Args.getLastArgValue(OPT_foverride_record_layout_EQ);
845 if (const Arg *A = Args.getLastArg(OPT_arcmt_check,
862 Opts.MTMigrateDir = Args.getLastArgValue(OPT_mt_migrate_directory);
864 = Args.getLastArgValue(OPT_arcmt_migrate_report_output);
866 = Args.hasArg(OPT_arcmt_migrate_emit_arc_errors);
868 if (Args.hasArg(OPT_objcmt_migrate_literals))
870 if (Args.hasArg(OPT_objcmt_migrate_subscripting))
872 if (Args.hasArg(OPT_objcmt_migrate_property))
874 if (Args.hasArg(OPT_objcmt_migrate_readonly_property))
876 if (Args.hasArg(OPT_objcmt_migrate_readwrite_property))
878 if (Args.hasArg(OPT_objcmt_migrate_annotation))
880 if (Args.hasArg(OPT_objcmt_returns_innerpointer_property))
882 if (Args.hasArg(OPT_objcmt_migrate_instancetype))
884 if (Args.hasArg(OPT_objcmt_migrate_nsmacros))
886 if (Args.hasArg(OPT_objcmt_migrate_protocol_conformance))
888 if (Args.hasArg(OPT_objcmt_atomic_property))
890 if (Args.hasArg(OPT_objcmt_ns_nonatomic_iosonly))
892 if (Args.hasArg(OPT_objcmt_migrate_designated_init))
894 if (Args.hasArg(OPT_objcmt_migrate_all))
897 Opts.ObjCMTWhiteListPath = Args.getLastArgValue(OPT_objcmt_whitelist_dir_path);
906 if (const Arg *A = Args.getLastArg(OPT_x)) {
931 << A->getAsString(Args) << A->getValue();
935 std::vector<std::string> Inputs = Args.getAllArgValues(OPT_INPUT);
969 static void ParseHeaderSearchArgs(HeaderSearchOptions &Opts, ArgList &Args) {
971 Opts.Sysroot = Args.getLastArgValue(OPT_isysroot, "/");
972 Opts.Verbose = Args.hasArg(OPT_v);
973 Opts.UseBuiltinIncludes = !Args.hasArg(OPT_nobuiltininc);
974 Opts.UseStandardSystemIncludes = !Args.hasArg(OPT_nostdsysteminc);
975 Opts.UseStandardCXXIncludes = !Args.hasArg(OPT_nostdincxx);
976 if (const Arg *A = Args.getLastArg(OPT_stdlib_EQ))
978 Opts.ResourceDir = Args.getLastArgValue(OPT_resource_dir);
979 Opts.ModuleCachePath = Args.getLastArgValue(OPT_fmodules_cache_path);
980 Opts.ModuleUserBuildPath = Args.getLastArgValue(OPT_fmodules_user_build_path);
981 Opts.DisableModuleHash = Args.hasArg(OPT_fdisable_module_hash);
983 Opts.ModuleMaps = Args.hasArg(OPT_fmodule_maps) || Args.hasArg(OPT_fmodules);
985 getLastArgIntValue(Args, OPT_fmodules_prune_interval, 7 * 24 * 60 * 60);
987 getLastArgIntValue(Args, OPT_fmodules_prune_after, 31 * 24 * 60 * 60);
989 Args.hasArg(OPT_fmodules_validate_once_per_build_session);
991 getLastArgUInt64Value(Args, OPT_fbuild_session_timestamp, 0);
993 Args.hasArg(OPT_fmodules_validate_system_headers);
995 for (arg_iterator it = Args.filtered_begin(OPT_fmodules_ignore_macro),
996 ie = Args.filtered_end();
1002 Args.getAllArgValues(OPT_fmodule_map_file);
1007 for (arg_iterator it = Args.filtered_begin(OPT_I, OPT_F,
1009 ie = Args.filtered_end(); it != ie; ++it) {
1026 for (arg_iterator it = Args.filtered_begin(OPT_iprefix, OPT_iwithprefix,
1028 ie = Args.filtered_end(); it != ie; ++it) {
1040 for (arg_iterator it = Args.filtered_begin(OPT_idirafter),
1041 ie = Args.filtered_end(); it != ie; ++it)
1043 for (arg_iterator it = Args.filtered_begin(OPT_iquote),
1044 ie = Args.filtered_end(); it != ie; ++it)
1046 for (arg_iterator it = Args.filtered_begin(OPT_isystem,
1047 OPT_iwithsysroot), ie = Args.filtered_end(); it != ie; ++it)
1050 for (arg_iterator it = Args.filtered_begin(OPT_iframework),
1051 ie = Args.filtered_end(); it != ie; ++it)
1055 for (arg_iterator it = Args.filtered_begin(OPT_c_isystem),
1056 ie = Args.filtered_end(); it != ie; ++it)
1058 for (arg_iterator it = Args.filtered_begin(OPT_cxx_isystem),
1059 ie = Args.filtered_end(); it != ie; ++it)
1061 for (arg_iterator it = Args.filtered_begin(OPT_objc_isystem),
1062 ie = Args.filtered_end(); it != ie; ++it)
1064 for (arg_iterator it = Args.filtered_begin(OPT_objcxx_isystem),
1065 ie = Args.filtered_end(); it != ie; ++it)
1069 for (arg_iterator I = Args.filtered_begin(OPT_internal_isystem,
1071 E = Args.filtered_end();
1080 for (arg_iterator I = Args.filtered_begin(OPT_system_header_prefix,
1082 E = Args.filtered_end();
1087 for (arg_iterator I = Args.filtered_begin(OPT_ivfsoverlay),
1088 E = Args.filtered_end(); I != E; ++I)
1193 static Visibility parseVisibility(Arg *arg, ArgList &args,
1206 args) << value;
1210 static unsigned parseMSCVersion(ArgList &Args, DiagnosticsEngine &Diags) {
1211 auto Arg = Args.getLastArg(OPT_fmsc_version);
1235 << Arg->getAsString(Args) << Value;
1255 << Arg->getAsString(Args) << Value;
1264 static void ParseLangArgs(LangOptions &Opts, ArgList &Args, InputKind IK,
1268 if (const Arg *A = Args.getLastArg(OPT_std_EQ)) {
1276 << A->getAsString(Args) << A->getValue();
1288 << A->getAsString(Args) << "C/ObjC";
1296 << A->getAsString(Args) << "C++/ObjC++";
1301 << A->getAsString(Args) << "OpenCL";
1306 << A->getAsString(Args) << "CUDA";
1316 if (const Arg *A = Args.getLastArg(OPT_cl_std_EQ)) {
1326 << A->getAsString(Args) << A->getValue();
1339 Opts.GNUKeywords = Args.hasFlag(OPT_fgnu_keywords, OPT_fno_gnu_keywords,
1342 if (Args.hasArg(OPT_fno_operator_names))
1346 if (Arg *arg = Args.getLastArg(OPT_fobjc_runtime_EQ)) {
1352 if (Args.hasArg(OPT_fobjc_gc_only))
1354 else if (Args.hasArg(OPT_fobjc_gc))
1356 else if (Args.hasArg(OPT_fobjc_arc)) {
1362 if (Args.hasArg(OPT_fobjc_runtime_has_weak))
1368 if (Args.hasArg(OPT_fno_objc_infer_related_result_type))
1371 if (Args.hasArg(OPT_fobjc_subscripting_legacy_runtime))
1376 if (Args.hasArg(OPT_fgnu89_inline))
1379 if (Args.hasArg(OPT_fapple_kext)) {
1386 if (Args.hasArg(OPT_print_ivar_layout))
1388 if (Args.hasArg(OPT_fno_constant_cfstrings))
1391 if (Args.hasArg(OPT_faltivec))
1394 if (Args.hasArg(OPT_pthread))
1398 if (Arg *visOpt = Args.getLastArg(OPT_fvisibility)) {
1399 Opts.setValueVisibilityMode(parseVisibility(visOpt, Args, Diags));
1405 if (Arg *typeVisOpt = Args.getLastArg(OPT_ftype_visibility)) {
1406 Opts.setTypeVisibilityMode(parseVisibility(typeVisOpt, Args, Diags));
1411 if (Args.hasArg(OPT_fvisibility_inlines_hidden))
1414 if (Args.hasArg(OPT_ftrapv)) {
1418 Args.getLastArgValue(OPT_ftrapv_handler);
1420 else if (Args.hasArg(OPT_fwrapv))
1423 if (Args.hasArg(OPT_trigraphs))
1426 Opts.DollarIdents = Args.hasFlag(OPT_fdollars_in_identifiers,
1429 Opts.PascalStrings = Args.hasArg(OPT_fpascal_strings);
1430 Opts.MSVCCompat = Args.hasArg(OPT_fms_compatibility);
1431 Opts.MicrosoftExt = Opts.MSVCCompat || Args.hasArg(OPT_fms_extensions);
1432 Opts.AsmBlocks = Args.hasArg(OPT_fasm_blocks) || Opts.MicrosoftExt;
1433 Opts.MSCVersion = parseMSCVersion(Args, Diags);
1434 Opts.VtorDispMode = getLastArgIntValue(Args, OPT_vtordisp_mode_EQ, 1, Diags);
1435 Opts.Borland = Args.hasArg(OPT_fborland_extensions);
1436 Opts.WritableStrings = Args.hasArg(OPT_fwritable_strings);
1437 Opts.ConstStrings = Args.hasFlag(OPT_fconst_strings, OPT_fno_const_strings,
1439 if (Args.hasArg(OPT_fno_lax_vector_conversions))
1441 if (Args.hasArg(OPT_fno_threadsafe_statics))
1443 Opts.Exceptions = Args.hasArg(OPT_fexceptions);
1444 Opts.ObjCExceptions = Args.hasArg(OPT_fobjc_exceptions);
1445 Opts.CXXExceptions = Args.hasArg(OPT_fcxx_exceptions);
1446 Opts.SjLjExceptions = Args.hasArg(OPT_fsjlj_exceptions);
1447 Opts.TraditionalCPP = Args.hasArg(OPT_traditional_cpp);
1449 Opts.RTTI = !Args.hasArg(OPT_fno_rtti);
1450 Opts.RTTIData = Opts.RTTI && !Args.hasArg(OPT_fno_rtti_data);
1451 Opts.Blocks = Args.hasArg(OPT_fblocks);
1452 Opts.BlocksRuntimeOptional = Args.hasArg(OPT_fblocks_runtime_optional);
1453 Opts.Modules = Args.hasArg(OPT_fmodules);
1454 Opts.ModulesStrictDeclUse = Args.hasArg(OPT_fmodules_strict_decluse);
1456 Args.hasArg(OPT_fmodules_decluse) || Opts.ModulesStrictDeclUse;
1458 !Args.hasArg(OPT_fno_modules_search_all) &&
1459 Args.hasArg(OPT_fmodules_search_all);
1460 Opts.ModulesErrorRecovery = !Args.hasArg(OPT_fno_modules_error_recovery);
1461 Opts.CharIsSigned = Opts.OpenCL || !Args.hasArg(OPT_fno_signed_char);
1462 Opts.WChar = Opts.CPlusPlus && !Args.hasArg(OPT_fno_wchar);
1463 Opts.ShortWChar = Args.hasFlag(OPT_fshort_wchar, OPT_fno_short_wchar, false);
1464 Opts.ShortEnums = Args.hasArg(OPT_fshort_enums);
1465 Opts.Freestanding = Args.hasArg(OPT_ffreestanding);
1466 Opts.NoBuiltin = Args.hasArg(OPT_fno_builtin) || Opts.Freestanding;
1467 Opts.NoMathBuiltin = Args.hasArg(OPT_fno_math_builtin);
1468 Opts.AssumeSaneOperatorNew = !Args.hasArg(OPT_fno_assume_sane_operator_new);
1469 Opts.SizedDeallocation |= Args.hasArg(OPT_fsized_deallocation);
1470 Opts.HeinousExtensions = Args.hasArg(OPT_fheinous_gnu_extensions);
1471 Opts.AccessControl = !Args.hasArg(OPT_fno_access_control);
1472 Opts.ElideConstructors = !Args.hasArg(OPT_fno_elide_constructors);
1473 Opts.MathErrno = !Opts.OpenCL && Args.hasArg(OPT_fmath_errno);
1475 getLastArgIntValue(Args, OPT_ftemplate_depth, 256, Diags);
1477 getLastArgIntValue(Args, OPT_foperator_arrow_depth, 256, Diags);
1479 getLastArgIntValue(Args, OPT_fconstexpr_depth, 512, Diags);
1481 getLastArgIntValue(Args, OPT_fconstexpr_steps, 1048576, Diags);
1482 Opts.BracketDepth = getLastArgIntValue(Args, OPT_fbracket_depth, 256, Diags);
1483 Opts.DelayedTemplateParsing = Args.hasArg(OPT_fdelayed_template_parsing);
1485 getLastArgIntValue(Args, OPT_Wlarge_by_value_copy_EQ, 0, Diags);
1486 Opts.MSBitfields = Args.hasArg(OPT_mms_bitfields);
1488 Args.getLastArgValue(OPT_fconstant_string_class);
1490 !Args.hasArg(OPT_disable_objc_default_synthesize_properties);
1492 Args.hasArg(OPT_fencode_extended_block_signature);
1493 Opts.EmitAllDecls = Args.hasArg(OPT_femit_all_decls);
1494 Opts.PackStruct = getLastArgIntValue(Args, OPT_fpack_struct_EQ, 0, Diags);
1495 Opts.PICLevel = getLastArgIntValue(Args, OPT_pic_level, 0, Diags);
1496 Opts.PIELevel = getLastArgIntValue(Args, OPT_pie_level, 0, Diags);
1497 Opts.Static = Args.hasArg(OPT_static_define);
1498 Opts.DumpRecordLayoutsSimple = Args.hasArg(OPT_fdump_record_layouts_simple);
1500 || Args.hasArg(OPT_fdump_record_layouts);
1501 Opts.DumpVTableLayouts = Args.hasArg(OPT_fdump_vtable_layouts);
1502 Opts.SpellChecking = !Args.hasArg(OPT_fno_spell_checking);
1503 Opts.NoBitFieldTypeAlign = Args.hasArg(OPT_fno_bitfield_type_align);
1504 Opts.SinglePrecisionConstants = Args.hasArg(OPT_cl_single_precision_constant);
1505 Opts.FastRelaxedMath = Args.hasArg(OPT_cl_fast_relaxed_math);
1506 Opts.MRTD = Args.hasArg(OPT_mrtd);
1507 Opts.HexagonQdsp6Compat = Args.hasArg(OPT_mqdsp6_compat);
1508 Opts.FakeAddressSpaceMap = Args.hasArg(OPT_ffake_address_space_map);
1509 Opts.ParseUnknownAnytype = Args.hasArg(OPT_funknown_anytype);
1510 Opts.DebuggerSupport = Args.hasArg(OPT_fdebugger_support);
1511 Opts.DebuggerCastResultToId = Args.hasArg(OPT_fdebugger_cast_result_to_id);
1512 Opts.DebuggerObjCLiteral = Args.hasArg(OPT_fdebugger_objc_literal);
1513 Opts.ApplePragmaPack = Args.hasArg(OPT_fapple_pragma_pack);
1514 Opts.CurrentModule = Args.getLastArgValue(OPT_fmodule_name);
1516 if (Arg *A = Args.getLastArg(OPT_faddress_space_map_mangling_EQ)) {
1538 if (Arg *A = Args.getLastArg(OPT_fms_memptr_rep_EQ)) {
1557 if (const Arg *A = Args.getLastArg(options::OPT_fopenmp_EQ)) {
1564 Opts.Deprecated = Args.hasFlag(OPT_fdeprecated_macro,
1569 unsigned Opt = getOptimizationLevel(Args, IK, Diags),
1570 OptSize = getOptimizationLevelSize(Args);
1577 Opts.NoInlineDefine = !Opt || Args.hasArg(OPT_fno_inline);
1579 Opts.FastMath = Args.hasArg(OPT_ffast_math);
1580 Opts.FiniteMathOnly = Args.hasArg(OPT_ffinite_math_only);
1583 Args.hasArg(OPT_fretain_comments_from_system_headers);
1585 unsigned SSP = getLastArgIntValue(Args, OPT_stack_protector, 0, Diags);
1589 << Args.getLastArg(OPT_stack_protector)->getAsString(Args) << SSP;
1598 std::vector<std::string> Sanitizers = Args.getAllArgValues(OPT_fsanitize_EQ);
1629 static void ParsePreprocessorArgs(PreprocessorOptions &Opts, ArgList &Args,
1633 Opts.ImplicitPCHInclude = Args.getLastArgValue(OPT_include_pch);
1634 Opts.ImplicitPTHInclude = Args.getLastArgValue(OPT_include_pth);
1635 if (const Arg *A = Args.getLastArg(OPT_token_cache))
1639 Opts.UsePredefines = !Args.hasArg(OPT_undef);
1640 Opts.DetailedRecord = Args.hasArg(OPT_detailed_preprocessing_record);
1641 Opts.DisablePCHValidation = Args.hasArg(OPT_fno_validate_pch);
1643 Opts.DumpDeserializedPCHDecls = Args.hasArg(OPT_dump_deserialized_pch_decls);
1644 for (arg_iterator it = Args.filtered_begin(OPT_error_on_deserialized_pch_decl),
1645 ie = Args.filtered_end(); it != ie; ++it) {
1650 if (const Arg *A = Args.getLastArg(OPT_preamble_bytes_EQ)) {
1667 for (arg_iterator it = Args.filtered_begin(OPT_D, OPT_U),
1668 ie = Args.filtered_end(); it != ie; ++it) {
1675 Opts.MacroIncludes = Args.getAllArgValues(OPT_imacros);
1678 for (arg_iterator it = Args.filtered_begin(OPT_include),
1679 ie = Args.filtered_end(); it != ie; ++it) {
1684 for (arg_iterator it = Args.filtered_begin(OPT_chain_include),
1685 ie = Args.filtered_end(); it != ie; ++it) {
1691 if (Args.hasArg(OPT_faltivec))
1694 for (arg_iterator it = Args.filtered_begin(OPT_remap_file),
1695 ie = Args.filtered_end(); it != ie; ++it) {
1701 Diags.Report(diag::err_drv_invalid_remap_file) << A->getAsString(Args);
1708 if (Arg *A = Args.getLastArg(OPT_fobjc_arc_cxxlib_EQ)) {
1716 Diags.Report(diag::err_drv_invalid_value) << A->getAsString(Args) << Name;
1723 ArgList &Args,
1762 Opts.ShowCPP = !Args.hasArg(OPT_dM);
1766 Opts.ShowComments = Args.hasArg(OPT_C);
1767 Opts.ShowLineMarkers = !Args.hasArg(OPT_P);
1768 Opts.ShowMacroComments = Args.hasArg(OPT_CC);
1769 Opts.ShowMacros = Args.hasArg(OPT_dM) || Args.hasArg(OPT_dD);
1770 Opts.RewriteIncludes = Args.hasArg(OPT_frewrite_includes);
1773 static void ParseTargetArgs(TargetOptions &Opts, ArgList &Args) {
1775 Opts.ABI = Args.getLastArgValue(OPT_target_abi);
1776 Opts.CPU = Args.getLastArgValue(OPT_target_cpu);
1777 Opts.FPMath = Args.getLastArgValue(OPT_mfpmath);
1778 Opts.FeaturesAsWritten = Args.getAllArgValues(OPT_target_feature);
1779 Opts.LinkerVersion = Args.getLastArgValue(OPT_target_linker_version);
1780 Opts.Triple = llvm::Triple::normalize(Args.getLastArgValue(OPT_triple));
1797 std::unique_ptr<InputArgList> Args(
1804 << Args->getArgString(MissingArgIndex) << MissingArgCount;
1809 for (arg_iterator it = Args->filtered_begin(OPT_UNKNOWN),
1810 ie = Args->filtered_end(); it != ie; ++it) {
1811 Diags.Report(diag::err_drv_unknown_argument) << (*it)->getAsString(*Args);
1815 Success = ParseAnalyzerArgs(*Res.getAnalyzerOpts(), *Args, Diags) && Success;
1816 Success = ParseMigratorArgs(Res.getMigratorOpts(), *Args) && Success;
1817 ParseDependencyOutputArgs(Res.getDependencyOutputOpts(), *Args);
1818 Success = ParseDiagnosticArgs(Res.getDiagnosticOpts(), *Args, &Diags)
1820 ParseCommentArgs(Res.getLangOpts()->CommentOpts, *Args);
1821 ParseFileSystemArgs(Res.getFileSystemOpts(), *Args);
1823 InputKind DashX = ParseFrontendArgs(Res.getFrontendOpts(), *Args, Diags);
1824 ParseTargetArgs(Res.getTargetOpts(), *Args);
1825 Success = ParseCodeGenArgs(Res.getCodeGenOpts(), *Args, DashX, Diags,
1827 ParseHeaderSearchArgs(Res.getHeaderSearchOpts(), *Args);
1829 ParseLangArgs(*Res.getLangOpts(), *Args, DashX, Diags);
1838 ParsePreprocessorArgs(Res.getPreprocessorOpts(), *Args, FileMgr, Diags);
1839 ParsePreprocessorOutputArgs(Res.getPreprocessorOutputOpts(), *Args,
1984 static IntTy getLastArgIntValueImpl(const ArgList &Args, OptSpecifier Id,
1988 if (Arg *A = Args.getLastArg(Id)) {
1991 Diags->Report(diag::err_drv_invalid_int_value) << A->getAsString(Args)
2000 int getLastArgIntValue(const ArgList &Args, OptSpecifier Id, int Default,
2002 return getLastArgIntValueImpl<int>(Args, Id, Default, Diags);
2005 uint64_t getLastArgUInt64Value(const ArgList &Args, OptSpecifier Id,
2008 return getLastArgIntValueImpl<uint64_t>(Args, Id, Default, Diags);