Lines Matching refs:Opts
138 static bool ParseAnalyzerArgs(AnalyzerOptions &Opts, ArgList &Args,
154 Opts.AnalysisStoreOpt = Value;
170 Opts.AnalysisConstraintsOpt = Value;
186 Opts.AnalysisDiagOpt = Value;
202 Opts.AnalysisPurgeOpt = Value;
218 Opts.InliningMode = Value;
222 Opts.ShowCheckerHelp = Args.hasArg(OPT_analyzer_checker_help);
223 Opts.DisableAllChecks = Args.hasArg(OPT_analyzer_disable_all_checks);
225 Opts.visualizeExplodedGraphWithGraphViz =
227 Opts.visualizeExplodedGraphWithUbiGraph =
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);
232 Opts.AnalyzeNestedBlocks =
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);
238 Opts.maxBlockVisitOnPath =
240 Opts.PrintStats = Args.hasArg(OPT_analyzer_stats);
241 Opts.InlineMaxStackDepth =
243 Opts.InlineMaxStackDepth, Diags);
245 Opts.CheckersControlList.clear();
256 Opts.CheckersControlList.emplace_back(checker, enable);
283 Opts.Config[key] = val;
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);
363 static bool ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, InputKind IK,
380 Opts.OptimizationLevel = OptimizationLevel;
383 Opts.setInlining(
384 (Opts.OptimizationLevel > 1) ? CodeGenOptions::NormalInlining
387 Opts.NoInline = Args.hasArg(OPT_fno_inline);
388 Opts.setInlining(Args.hasArg(OPT_fno_inline_functions) ?
389 CodeGenOptions::OnlyAlwaysInlining : Opts.getInlining());
394 Opts.setVecLib(CodeGenOptions::Accelerate);
396 Opts.setVecLib(CodeGenOptions::NoLibrary);
402 Opts.setDebugInfo(
409 Opts.setDebuggerTuning(
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);
421 Opts.DebugExplicitImport = true;
424 Opts.DebugPrefixMap.insert(StringRef(Arg).split('='));
428 Opts.EmitLLVMUseLists = A->getOption().getID() == OPT_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 Opts.ForbidGuardVariables = 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) ||
445 Opts.UnrollLoops =
447 (Opts.OptimizationLevel > 1 && !Opts.OptimizeSize));
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) ||
455 Opts.InstrProfileOutput = Args.getLastArgValue(OPT_fprofile_instr_generate_EQ);
456 Opts.InstrProfileInput = Args.getLastArgValue(OPT_fprofile_instr_use_EQ);
457 Opts.CoverageMapping =
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);
466 Opts.DisableFPElim =
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);
483 Opts.EABIVersion = Value;
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) ||
490 Opts.NoNaNsFPMath = (Args.hasArg(OPT_menable_no_nans) ||
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);
503 Opts.IncrementalLinkerCompatible =
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) ||
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");
517 if (Opts.ThreadModel != "posix" && Opts.ThreadModel != "single")
520 << Opts.ThreadModel;
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);
535 Opts.EmitFunctionSummary = A && A->containsValue("thin");
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);
555 if (Opts.EmitGcovArcs || Opts.EmitGcovNotes) {
556 Opts.CoverageFile = Args.getLastArgValue(OPT_coverage_file);
557 Opts.CoverageExtraChecksum = Args.hasArg(OPT_coverage_cfg_checksum);
558 Opts.CoverageNoFunctionNamesInData =
560 Opts.CoverageExitBlockBeforeBody =
569 memcpy(Opts.CoverageVersion, CoverageVersion.data(), 4);
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);
584 Opts.LinkBitcodeFiles.push_back(std::make_pair(LinkFlags, A->getValue()));
586 Opts.SanitizeCoverageType =
588 Opts.SanitizeCoverageIndirectCalls =
590 Opts.SanitizeCoverageTraceBB = Args.hasArg(OPT_fsanitize_coverage_trace_bb);
591 Opts.SanitizeCoverageTraceCmp = Args.hasArg(OPT_fsanitize_coverage_trace_cmp);
592 Opts.SanitizeCoverage8bitCounters =
594 Opts.SanitizeMemoryTrackOrigins =
596 Opts.SanitizeMemoryUseAfterDtor =
598 Opts.SanitizeCfiCrossDso = Args.hasArg(OPT_fsanitize_cfi_cross_dso);
599 Opts.SSPBufferSize =
601 Opts.StackRealignment = Args.hasArg(OPT_mstackrealign);
604 unsigned StackAlignment = Opts.StackAlignment;
606 Opts.StackAlignment = StackAlignment;
611 unsigned StackProbeSize = Opts.StackProbeSize;
613 Opts.StackProbeSize = StackProbeSize;
627 Opts.setObjCDispatchMethod(
632 Opts.EmulatedTLS =
647 Opts.setDefaultTLSModel(static_cast<CodeGenOptions::TLSModel>(Model));
654 Opts.setFPContractMode(CodeGenOptions::FPC_Fast);
656 Opts.setFPContractMode(CodeGenOptions::FPC_On);
658 Opts.setFPContractMode(CodeGenOptions::FPC_Off);
665 Opts.setStructReturnConvention(CodeGenOptions::SRCK_OnStack);
668 Opts.setStructReturnConvention(CodeGenOptions::SRCK_InRegs);
672 Opts.DependentLibraries = Args.getAllArgValues(OPT_dependent_lib);
676 Opts.OptimizationRemarkPattern =
682 Opts.OptimizationRemarkMissedPattern =
688 Opts.OptimizationRemarkAnalysisPattern =
696 if (!Opts.SampleProfileFile.empty())
701 if (NeedLocTracking && Opts.getDebugInfo() == CodeGenOptions::NoDebugInfo)
702 Opts.setDebugInfo(CodeGenOptions::LocTrackingOnly);
704 Opts.RewriteMapFiles = Args.getAllArgValues(OPT_frewrite_map_file);
710 Opts.SanitizeRecover);
713 Opts.SanitizeTrap);
715 Opts.CudaGpuBinaryFileNames =
721 static void ParseDependencyOutputArgs(DependencyOutputOptions &Opts,
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);
734 Opts.ModuleDependencyOutputDir =
737 Opts.OutputFormat = DependencyOutputFormat::NMake;
741 Opts.ExtraDeps = Args.getAllArgValues(OPT_fdepfile_entry);
743 Opts.ExtraDeps.insert(Opts.ExtraDeps.end(), ModuleFiles.begin(),
747 bool clang::ParseDiagnosticArgs(DiagnosticOptions &Opts, ArgList &Args,
752 Opts.DiagnosticLogFile = Args.getLastArgValue(OPT_diagnostic_log_file);
755 Opts.DiagnosticSerializationFile = A->getValue();
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);
772 Opts.ShowNoteIncludeStack = false;
776 Opts.ShowNoteIncludeStack = true;
781 Opts.setShowOverloads(Ovl_Best);
783 Opts.setShowOverloads(Ovl_All);
795 Opts.ShowCategories = 0;
797 Opts.ShowCategories = 1;
799 Opts.ShowCategories = 2;
811 Opts.setFormat(DiagnosticOptions::Clang);
813 Opts.setFormat(DiagnosticOptions::MSVC);
815 Opts.setFormat(DiagnosticOptions::MSVC);
816 Opts.CLFallbackMode = true;
818 Opts.setFormat(DiagnosticOptions::Vi);
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);
837 Opts.setVerifyIgnoreUnexpected(DiagMask);
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);
841 Opts.MacroBacktraceLimit =
844 Opts.TemplateBacktraceLimit = getLastArgIntValue(
847 Opts.ConstexprBacktraceLimit = getLastArgIntValue(
850 Opts.SpellCheckingLimit = getLastArgIntValue(
853 Opts.TabStop = getLastArgIntValue(Args, OPT_ftabstop,
855 if (Opts.TabStop == 0 || Opts.TabStop > DiagnosticOptions::MaxTabStop) {
856 Opts.TabStop = DiagnosticOptions::DefaultTabStop;
859 << Opts.TabStop << DiagnosticOptions::DefaultTabStop;
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);
896 static InputKind ParseFrontendArgs(FrontendOptions &Opts, ArgList &Args,
899 Opts.ProgramAction = frontend::ParseSyntaxOnly;
905 Opts.ProgramAction = frontend::ASTDeclList; break;
908 Opts.ProgramAction = frontend::ASTDump; break;
910 Opts.ProgramAction = frontend::ASTPrint; break;
912 Opts.ProgramAction = frontend::ASTView; break;
914 Opts.ProgramAction = frontend::DumpRawTokens; break;
916 Opts.ProgramAction = frontend::DumpTokens; break;
918 Opts.ProgramAction = frontend::EmitAssembly; break;
920 Opts.ProgramAction = frontend::EmitBC; break;
922 Opts.ProgramAction = frontend::EmitHTML; break;
924 Opts.ProgramAction = frontend::EmitLLVM; break;
926 Opts.ProgramAction = frontend::EmitLLVMOnly; break;
928 Opts.ProgramAction = frontend::EmitCodeGenOnly; break;
930 Opts.ProgramAction = frontend::EmitObj; break;
932 Opts.FixItSuffix = A->getValue();
935 Opts.ProgramAction = frontend::FixIt; break;
937 Opts.ProgramAction = frontend::GenerateModule; break;
939 Opts.ProgramAction = frontend::GeneratePCH; break;
941 Opts.ProgramAction = frontend::GeneratePTH; break;
943 Opts.ProgramAction = frontend::InitOnly; break;
945 Opts.ProgramAction = frontend::ParseSyntaxOnly; break;
947 Opts.ProgramAction = frontend::ModuleFileInfo; break;
949 Opts.ProgramAction = frontend::VerifyPCH; break;
951 Opts.ProgramAction = frontend::PrintDeclContext; break;
953 Opts.ProgramAction = frontend::PrintPreamble; break;
955 Opts.ProgramAction = frontend::PrintPreprocessedInput; break;
957 Opts.ProgramAction = frontend::RewriteMacros; break;
959 Opts.ProgramAction = frontend::RewriteObjC; break;
961 Opts.ProgramAction = frontend::RewriteTest; break;
963 Opts.ProgramAction = frontend::RunAnalysis; break;
965 Opts.ProgramAction = frontend::MigrateSource; break;
967 Opts.ProgramAction = frontend::RunPreprocessorOnly; break;
972 Opts.Plugins.emplace_back(A->getValue(0));
973 Opts.ProgramAction = frontend::PluginAction;
974 Opts.ActionName = A->getValue();
977 if (AA->getValue(0) == Opts.ActionName)
978 Opts.PluginArgs.emplace_back(AA->getValue(1));
981 Opts.AddPluginActions = Args.getAllArgValues(OPT_add_plugin);
982 Opts.AddPluginArgs.resize(Opts.AddPluginActions.size());
983 for (int i = 0, e = Opts.AddPluginActions.size(); i != e; ++i)
985 if (A->getValue(0) == Opts.AddPluginActions[i])
986 Opts.AddPluginArgs[i].emplace_back(A->getValue(1));
1003 Opts.ModuleFileExtensions.push_back(
1009 Opts.CodeCompletionAt =
1011 if (Opts.CodeCompletionAt.FileName.empty())
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);
1034 Opts.GenerateGlobalModuleIndex = Opts.UseGlobalModuleIndex;
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);
1040 Opts.CodeCompleteOpts.IncludeMacros
1042 Opts.CodeCompleteOpts.IncludeCodePatterns
1044 Opts.CodeCompleteOpts.IncludeGlobals
1046 Opts.CodeCompleteOpts.IncludeBriefComments
1049 Opts.OverrideRecordLayoutsFile
1051 Opts.AuxTriple =
1061 Opts.ARCMTAction = FrontendOptions::ARCMT_Check;
1064 Opts.ARCMTAction = FrontendOptions::ARCMT_Modify;
1067 Opts.ARCMTAction = FrontendOptions::ARCMT_Migrate;
1071 Opts.MTMigrateDir = Args.getLastArgValue(OPT_mt_migrate_directory);
1072 Opts.ARCMTMigrateReportOut
1074 Opts.ARCMTMigrateEmitARCErrors
1078 Opts.ObjCMTAction |= FrontendOptions::ObjCMT_Literals;
1080 Opts.ObjCMTAction |= FrontendOptions::ObjCMT_Subscripting;
1082 Opts.ObjCMTAction |= FrontendOptions::ObjCMT_PropertyDotSyntax;
1084 Opts.ObjCMTAction |= FrontendOptions::ObjCMT_Property;
1086 Opts.ObjCMTAction |= FrontendOptions::ObjCMT_ReadonlyProperty;
1088 Opts.ObjCMTAction |= FrontendOptions::ObjCMT_ReadwriteProperty;
1090 Opts.ObjCMTAction |= FrontendOptions::ObjCMT_Annotation;
1092 Opts.ObjCMTAction |= FrontendOptions::ObjCMT_ReturnsInnerPointerProperty;
1094 Opts.ObjCMTAction |= FrontendOptions::ObjCMT_Instancetype;
1096 Opts.ObjCMTAction |= FrontendOptions::ObjCMT_NsMacros;
1098 Opts.ObjCMTAction |= FrontendOptions::ObjCMT_ProtocolConformance;
1100 Opts.ObjCMTAction |= FrontendOptions::ObjCMT_AtomicProperty;
1102 Opts.ObjCMTAction |= FrontendOptions::ObjCMT_NsAtomicIOSOnlyProperty;
1104 Opts.ObjCMTAction |= FrontendOptions::ObjCMT_DesignatedInitializer;
1106 Opts.ObjCMTAction |= FrontendOptions::ObjCMT_MigrateDecls;
1108 Opts.ObjCMTWhiteListPath = Args.getLastArgValue(OPT_objcmt_whitelist_dir_path);
1110 if (Opts.ARCMTAction != FrontendOptions::ARCMT_None &&
1111 Opts.ObjCMTAction != FrontendOptions::ObjCMT_None) {
1148 Opts.Inputs.clear();
1160 Opts.Inputs.emplace_back(std::move(Inputs[i]), IK);
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);
1192 Opts.UseLibcxx = (strcmp(A->getValue(), "libc++") == 0);
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);
1199 Opts.ModuleCachePruneInterval =
1201 Opts.ModuleCachePruneAfter =
1203 Opts.ModulesValidateOncePerBuildSession =
1205 Opts.BuildSessionTimestamp =
1207 Opts.ModulesValidateSystemHeaders =
1210 Opts.ModuleFormat = A->getValue();
1214 Opts.ModulesIgnoreMacros.insert(MacroDef.split('=').first);
1229 Opts.AddPath(A->getValue(), Group,
1241 Opts.AddPath(Prefix.str() + A->getValue(), frontend::After, false, true);
1243 Opts.AddPath(Prefix.str() + A->getValue(), frontend::Angled, false, true);
1247 Opts.AddPath(A->getValue(), frontend::After, false, true);
1249 Opts.AddPath(A->getValue(), frontend::Quoted, false, true);
1251 Opts.AddPath(A->getValue(), frontend::System, false,
1254 Opts.AddPath(A->getValue(), frontend::System, true, true);
1258 Opts.AddPath(A->getValue(), frontend::CSystem, false, true);
1260 Opts.AddPath(A->getValue(), frontend::CXXSystem, false, true);
1262 Opts.AddPath(A->getValue(), frontend::ObjCSystem, false,true);
1264 Opts.AddPath(A->getValue(), frontend::ObjCXXSystem, false, true);
1272 Opts.AddPath(A->getValue(), Group, false, true);
1278 Opts.AddSystemHeaderPrefix(
1282 Opts.AddVFSOverlayFile(A->getValue());
1285 void CompilerInvocation::setLangDefaults(LangOptions &Opts, InputKind IK,
1291 Opts.AsmPreprocessor = 1;
1296 Opts.ObjC1 = Opts.ObjC2 = 1;
1330 Opts.LineComment = Std.hasLineComments();
1331 Opts.C99 = Std.isC99();
1332 Opts.C11 = Std.isC11();
1333 Opts.CPlusPlus = Std.isCPlusPlus();
1334 Opts.CPlusPlus11 = Std.isCPlusPlus11();
1335 Opts.CPlusPlus14 = Std.isCPlusPlus14();
1336 Opts.CPlusPlus1z = Std.isCPlusPlus1z();
1337 Opts.Digraphs = Std.hasDigraphs();
1338 Opts.GNUMode = Std.isGNUMode();
1339 Opts.GNUInline = Std.isC89();
1340 Opts.HexFloats = Std.hasHexFloats();
1341 Opts.ImplicitInt = Std.hasImplicitInt();
1344 Opts.OpenCL = LangStd == LangStandard::lang_opencl || IK == IK_OpenCL;
1346 Opts.OpenCLVersion = 100;
1348 Opts.OpenCLVersion = 110;
1350 Opts.OpenCLVersion = 120;
1352 Opts.OpenCLVersion = 200;
1355 if (Opts.OpenCL) {
1356 Opts.AltiVec = 0;
1357 Opts.ZVector = 0;
1358 Opts.CXXOperatorNames = 1;
1359 Opts.LaxVectorConversions = 0;
1360 Opts.DefaultFPContract = 1;
1361 Opts.NativeHalfType = 1;
1364 Opts.CUDA = IK == IK_CUDA || IK == IK_PreprocessedCuda ||
1368 Opts.Bool = Opts.OpenCL || Opts.CPlusPlus;
1371 Opts.Half = Opts.OpenCL;
1374 Opts.WChar = Opts.CPlusPlus;
1376 Opts.GNUKeywords = Opts.GNUMode;
1377 Opts.CXXOperatorNames = Opts.CPlusPlus;
1379 Opts.DollarIdents = !Opts.AsmPreprocessor;
1400 static void ParseLangArgs(LangOptions &Opts, ArgList &Args, InputKind IK,
1470 CompilerInvocation::setLangDefaults(Opts, IK, LangStd);
1477 Opts.GNUKeywords = Args.hasFlag(OPT_fgnu_keywords, OPT_fno_gnu_keywords,
1478 Opts.GNUKeywords);
1481 Opts.CXXOperatorNames = 0;
1484 Opts.CUDAIsDevice = 1;
1487 Opts.CUDAAllowHostCallsFromHostDevice = 1;
1490 Opts.CUDADisableTargetCallChecks = 1;
1493 Opts.CUDATargetOverloads = 1;
1495 if (Opts.ObjC1) {
1498 if (Opts.ObjCRuntime.tryParse(value))
1503 Opts.setGC(LangOptions::GCOnly);
1505 Opts.setGC(LangOptions::HybridGC);
1507 Opts.ObjCAutoRefCount = 1;
1508 if (!Opts.ObjCRuntime.allowsARC())
1517 Opts.ObjCWeakRuntime = 1;
1519 Opts.ObjCWeakRuntime = Opts.ObjCRuntime.allowsWeak();
1525 assert(!Opts.ObjCWeak);
1526 } else if (Opts.getGC() != LangOptions::NonGC) {
1528 } else if (!Opts.ObjCWeakRuntime) {
1531 Opts.ObjCWeak = 1;
1533 } else if (Opts.ObjCAutoRefCount) {
1534 Opts.ObjCWeak = Opts.ObjCWeakRuntime;
1538 Opts.ObjCInferRelatedResultType = 0;
1541 Opts.ObjCSubscriptingLegacyRuntime =
1542 (Opts.ObjCRuntime.getKind() == ObjCRuntime::FragileMacOSX);
1546 if (Opts.CPlusPlus)
1550 Opts.GNUInline = 1;
1554 if (!Opts.CPlusPlus)
1557 Opts.AppleKext = 1;
1561 Opts.ObjCGCBitmapPrint = 1;
1563 Opts.NoConstantCFStrings = 1;
1566 Opts.AltiVec = 1;
1569 Opts.ZVector = 1;
1572 Opts.POSIXThreads = 1;
1576 Opts.setValueVisibilityMode(parseVisibility(visOpt, Args, Diags));
1578 Opts.setValueVisibilityMode(DefaultVisibility);
1583 Opts.setTypeVisibilityMode(parseVisibility(typeVisOpt, Args, Diags));
1585 Opts.setTypeVisibilityMode(Opts.getValueVisibilityMode());
1589 Opts.InlineVisibilityHidden = 1;
1592 Opts.setSignedOverflowBehavior(LangOptions::SOB_Trapping);
1594 Opts.OverflowHandler =
1598 Opts.setSignedOverflowBehavior(LangOptions::SOB_Defined);
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;
1603 Opts.MSCompatibilityVersion = 0;
1609 Opts.MSCompatibilityVersion = VT.getMajor() * 10000000 +
1617 OptsOpts.GNUMode && !Opts.MSVCCompat && !Opts.CPlusPlus1z;
1618 Opts.Trigraphs =
1619 Args.hasFlag(OPT_ftrigraphs, OPT_fno_trigraphs, Opts.Trigraphs);
1621 Opts.DollarIdents = Args.hasFlag(OPT_fdollars_in_identifiers,
1623 Opts.DollarIdents);
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,
1629 Opts.ConstStrings);
1631 Opts.LaxVectorConversions = 0;
1633 Opts.ThreadsafeStatics = 0;
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);
1647 Opts.ModulesDeclUse =
1648 Args.hasArg(OPT_fmodules_decluse) || Opts.ModulesStrictDeclUse;
1649 Opts.ModulesLocalVisibility =
1651 Opts.ModulesSearchAll = Opts.Modules &&
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);
1670 Opts.InstantiationDepth =
1672 Opts.ArrowDepth =
1674 Opts.ConstexprCallDepth =
1676 Opts.ConstexprStepLimit =
1678 Opts.BracketDepth = getLastArgIntValue(Args, OPT_fbracket_depth, 256, Diags);
1679 Opts.DelayedTemplateParsing = Args.hasArg(OPT_fdelayed_template_parsing);
1680 Opts.NumLargeByValueCopy =
1682 Opts.MSBitfields = Args.hasArg(OPT_mms_bitfields);
1683 Opts.ObjCConstantStringClass =
1685 Opts.ObjCDefaultSynthProperties =
1687 Opts.EncodeExtendedBlockSig =
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);
1696 Opts.DumpRecordLayouts = Opts.DumpRecordLayoutsSimple
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);
1713 Opts.ImplementationOfModule =
1715 Opts.ModuleFeatures = Args.getAllArgValues(OPT_fmodule_feature);
1716 std::sort(Opts.ModuleFeatures.begin(), Opts.ModuleFeatures.end());
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);
1727 // something more generic, remove the Opts.CUDA term here.
1728 Opts.DeclSpecKeyword =
1730 (Opts.MicrosoftExt || Opts.Borland || Opts.CUDA));
1732 if (!Opts.CurrentModule.empty() && !Opts.ImplementationOfModule.empty() &&
1733 Opts.CurrentModule != Opts.ImplementationOfModule) {
1735 << Opts.CurrentModule << Opts.ImplementationOfModule;
1740 if (Opts.ModulesLocalVisibility && !Opts.CPlusPlus)
1755 Opts.setAddressSpaceMapMangling(LangOptions::ASMM_Target);
1758 Opts.setAddressSpaceMapMangling(LangOptions::ASMM_On);
1761 Opts.setAddressSpaceMapMangling(LangOptions::ASMM_Off);
1781 Opts.setMSPointerToMemberRepresentationMethod(InheritanceModel);
1785 Opts.OpenMP = Args.hasArg(options::OPT_fopenmp);
1786 Opts.OpenMPUseTLS =
1787 Opts.OpenMP && !Args.hasArg(options::OPT_fnoopenmp_use_tls);
1790 Opts.Deprecated = Args.hasFlag(OPT_fdeprecated_macro,
1792 Opts.Deprecated);
1797 Opts.Optimize = Opt != 0;
1798 Opts.OptimizeSize = OptSize != 0;
1803 Opts.NoInlineDefine = !Opt || Args.hasArg(OPT_fno_inline);
1805 Opts.FastMath = Args.hasArg(OPT_ffast_math) ||
1807 Opts.FiniteMathOnly = Args.hasArg(OPT_ffinite_math_only) ||
1810 Opts.UnsafeFPMath = Args.hasArg(OPT_menable_unsafe_fp_math) ||
1814 Opts.RetainCommentsFromSystemHeaders =
1823 case 0: Opts.setStackProtector(LangOptions::SSPOff); break;
1824 case 1: Opts.setStackProtector(LangOptions::SSPOn); break;
1825 case 2: Opts.setStackProtector(LangOptions::SSPStrong); break;
1826 case 3: Opts.setStackProtector(LangOptions::SSPReq); break;
1831 Diags, Opts.Sanitize);
1833 Opts.SanitizeAddressFieldPadding =
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);
1845 Opts.TokenCache = A->getValue();
1847 Opts.TokenCache = Opts.ImplicitPTHInclude;
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);
1854 Opts.DeserializedPCHDeclsToErrorOn.insert(A->getValue());
1867 Opts.PrecompiledPreambleBytes.first = Bytes;
1868 Opts.PrecompiledPreambleBytes.second = (EndOfLine != 0);
1875 Opts.addMacroDef(A->getValue());
1877 Opts.addMacroUndef(A->getValue());
1880 Opts.MacroIncludes = Args.getAllArgValues(OPT_imacros);
1884 Opts.Includes.emplace_back(A->getValue());
1887 Opts.ChainedIncludes.emplace_back(A->getValue());
1891 Opts.Includes.emplace_back("altivec.h");
1901 Opts.addRemappedFile(Split.first, Split.second);
1914 Opts.ObjCXXARCStandardLibrary = (ObjCXXARCStandardLibraryKind)Library;
1918 static void ParsePreprocessorOutputArgs(PreprocessorOutputOptions &Opts,
1948 Opts.ShowCPP = 0;
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);
1980 if (Opts.Triple.empty())
1981 Opts.Triple = llvm::sys::getDefaultTargetTriple();
1991 std::unique_ptr<OptTable> Opts(createDriverOptTable());
1995 Opts->ParseArgs(llvm::makeArrayRef(ArgBegin, ArgEnd), MissingArgIndex,