29 #include "clang/Config/config.h" 46 #include "llvm/ADT/APInt.h" 47 #include "llvm/ADT/ArrayRef.h" 48 #include "llvm/ADT/CachedHashString.h" 49 #include "llvm/ADT/Hashing.h" 50 #include "llvm/ADT/None.h" 51 #include "llvm/ADT/Optional.h" 52 #include "llvm/ADT/SmallString.h" 53 #include "llvm/ADT/SmallVector.h" 54 #include "llvm/ADT/StringRef.h" 55 #include "llvm/ADT/StringSwitch.h" 56 #include "llvm/ADT/Triple.h" 57 #include "llvm/ADT/Twine.h" 58 #include "llvm/Linker/Linker.h" 59 #include "llvm/MC/MCTargetOptions.h" 60 #include "llvm/Option/Arg.h" 61 #include "llvm/Option/ArgList.h" 62 #include "llvm/Option/OptSpecifier.h" 63 #include "llvm/Option/OptTable.h" 64 #include "llvm/Option/Option.h" 65 #include "llvm/ProfileData/InstrProfReader.h" 66 #include "llvm/Support/CodeGen.h" 67 #include "llvm/Support/Compiler.h" 68 #include "llvm/Support/Error.h" 69 #include "llvm/Support/ErrorHandling.h" 70 #include "llvm/Support/ErrorOr.h" 71 #include "llvm/Support/FileSystem.h" 72 #include "llvm/Support/Host.h" 73 #include "llvm/Support/MathExtras.h" 74 #include "llvm/Support/MemoryBuffer.h" 75 #include "llvm/Support/Path.h" 76 #include "llvm/Support/Process.h" 77 #include "llvm/Support/Regex.h" 78 #include "llvm/Support/VersionTuple.h" 79 #include "llvm/Support/raw_ostream.h" 80 #include "llvm/Target/TargetOptions.h" 92 using namespace clang;
93 using namespace driver;
94 using namespace options;
122 unsigned DefaultOpt = 0;
126 if (Arg *A = Args.getLastArg(options::OPT_O_Group)) {
127 if (A->getOption().matches(options::OPT_O0))
130 if (A->getOption().matches(options::OPT_Ofast))
133 assert(A->getOption().matches(options::OPT_O));
135 StringRef S(A->getValue());
136 if (S ==
"s" || S ==
"z" || S.empty())
149 if (Arg *A = Args.getLastArg(options::OPT_O_Group)) {
150 if (A->getOption().matches(options::OPT_O)) {
151 switch (A->getValue()[0]) {
165 OptSpecifier GroupWithValue,
166 std::vector<std::string> &Diagnostics) {
167 for (
auto *A : Args.filtered(Group)) {
168 if (A->getOption().getKind() == Option::FlagClass) {
171 Diagnostics.push_back(A->getOption().getName().drop_front(1));
172 }
else if (A->getOption().matches(GroupWithValue)) {
174 Diagnostics.push_back(A->getOption().getName().drop_front(1).rtrim(
"=-"));
177 for (
const auto *Arg : A->getValues())
178 Diagnostics.emplace_back(Arg);
184 std::vector<std::string> &Funcs) {
186 for (
const auto &Arg : Args) {
187 const Option &O = Arg->getOption();
188 if (O.matches(options::OPT_fno_builtin_)) {
189 const char *FuncName = Arg->getValue();
191 Values.push_back(FuncName);
194 Funcs.insert(Funcs.end(), Values.begin(), Values.end());
200 if (Arg *A = Args.getLastArg(OPT_analyzer_store)) {
201 StringRef Name = A->getValue();
204 .Case(CMDFLAG, NAME##Model)
205 #include "clang/StaticAnalyzer/Core/Analyses.def" 208 Diags.
Report(diag::err_drv_invalid_value)
209 << A->getAsString(Args) << Name;
216 if (Arg *A = Args.getLastArg(OPT_analyzer_constraints)) {
217 StringRef Name = A->getValue();
220 .Case(CMDFLAG, NAME##Model)
221 #include "clang/StaticAnalyzer/Core/Analyses.def" 224 Diags.
Report(diag::err_drv_invalid_value)
225 << A->getAsString(Args) << Name;
232 if (Arg *A = Args.getLastArg(OPT_analyzer_output)) {
233 StringRef Name = A->getValue();
236 .Case(CMDFLAG, PD_##NAME)
237 #include "clang/StaticAnalyzer/Core/Analyses.def" 240 Diags.
Report(diag::err_drv_invalid_value)
241 << A->getAsString(Args) << Name;
248 if (Arg *A = Args.getLastArg(OPT_analyzer_purge)) {
249 StringRef Name = A->getValue();
253 #include "clang/StaticAnalyzer/Core/Analyses.def" 256 Diags.
Report(diag::err_drv_invalid_value)
257 << A->getAsString(Args) << Name;
264 if (Arg *A = Args.getLastArg(OPT_analyzer_inlining_mode)) {
265 StringRef Name = A->getValue();
269 #include "clang/StaticAnalyzer/Core/Analyses.def" 272 Diags.
Report(diag::err_drv_invalid_value)
273 << A->getAsString(Args) << Name;
285 Args.hasArg(OPT_analyzer_viz_egraph_graphviz);
287 Args.hasArg(OPT_analyzer_viz_egraph_ubigraph);
289 Opts.
AnalyzeAll = Args.hasArg(OPT_analyzer_opt_analyze_headers);
292 Args.hasArg(OPT_analyzer_opt_analyze_nested_blocks);
296 Opts.
TrimGraph = Args.hasArg(OPT_trim_egraph);
299 Opts.
PrintStats = Args.hasArg(OPT_analyzer_stats);
306 Args.filtered(OPT_analyzer_checker, OPT_analyzer_disable_checker)) {
308 bool enable = (A->getOption().getID() == OPT_analyzer_checker);
311 StringRef checkerList = A->getValue();
313 checkerList.split(checkers,
",");
314 for (
auto checker : checkers)
319 for (
const auto *A : Args.filtered(OPT_analyzer_config)) {
323 StringRef configList = A->getValue();
325 configList.split(configVals,
",");
326 for (
const auto &configVal : configVals) {
328 std::tie(key, val) = configVal.split(
"=");
331 diag::err_analyzer_config_no_value) << configVal;
335 if (val.find(
'=') != StringRef::npos) {
337 diag::err_analyzer_config_multiple_values)
347 for (
unsigned i = 0; i < Args.getNumInputArgStrings(); ++i) {
350 os << Args.getArgString(i);
369 if (Arg *A = Args.getLastArg(OPT_mcode_model)) {
370 StringRef
Value = A->getValue();
371 if (Value ==
"small" || Value ==
"kernel" || Value ==
"medium" ||
374 Diags.
Report(diag::err_drv_invalid_value) << A->getAsString(Args) <<
Value;
381 if (Arg *A = Args.getLastArg(OPT_mrelocation_model)) {
382 StringRef
Value = A->getValue();
383 auto RM = llvm::StringSwitch<llvm::Optional<llvm::Reloc::Model>>(
Value)
384 .Case(
"static", llvm::Reloc::Static)
385 .Case(
"pic", llvm::Reloc::PIC_)
386 .Case(
"ropi", llvm::Reloc::ROPI)
387 .Case(
"rwpi", llvm::Reloc::RWPI)
388 .Case(
"ropi-rwpi", llvm::Reloc::ROPI_RWPI)
389 .Case(
"dynamic-no-pic", llvm::Reloc::DynamicNoPIC)
393 Diags.
Report(diag::err_drv_invalid_value) << A->getAsString(Args) <<
Value;
395 return llvm::Reloc::PIC_;
400 static std::shared_ptr<llvm::Regex>
403 StringRef Val = RpassArg->getValue();
404 std::string RegexError;
405 std::shared_ptr<llvm::Regex> Pattern = std::make_shared<llvm::Regex>(Val);
406 if (!Pattern->isValid(RegexError)) {
407 Diags.
Report(diag::err_drv_optimization_remark_pattern)
408 << RegexError << RpassArg->getAsString(Args);
415 const std::vector<std::string> &Levels,
419 for (
const auto &
Level : Levels) {
421 llvm::StringSwitch<DiagnosticLevelMask>(
Level)
430 Diags->
Report(diag::err_drv_invalid_value) << FlagName <<
Level;
438 const std::vector<std::string> &Sanitizers,
440 for (
const auto &Sanitizer : Sanitizers) {
443 Diags.
Report(diag::err_drv_invalid_value) << FlagName << Sanitizer;
453 llvm::SplitString(Bundle, BundleParts,
",");
454 for (
const auto B : BundleParts) {
458 D.
Report(diag::err_drv_invalid_value) << FlagName << Bundle;
471 Arg *A = Args.getLastArg(OPT_fprofile_instrument_EQ);
474 StringRef S = A->getValue();
475 unsigned I = llvm::StringSwitch<unsigned>(S)
481 Diags.
Report(diag::err_drv_invalid_pgo_instrumentor) << A->getAsString(Args)
486 Opts.setProfileInstr(Instrumentor);
491 const Twine &ProfileName) {
494 if (
auto E = ReaderOrErr.takeError()) {
495 llvm::consumeError(std::move(E));
499 std::unique_ptr<llvm::IndexedInstrProfReader> PGOReader =
500 std::move(ReaderOrErr.get());
501 if (PGOReader->isIRLevelProfile())
512 llvm::Triple Triple = llvm::Triple(TargetOpts.
Triple);
516 unsigned MaxOptLevel = 3;
517 if (OptimizationLevel > MaxOptLevel) {
520 Diags.
Report(diag::warn_drv_optimization_value)
521 << Args.getLastArg(OPT_O)->getAsString(Args) <<
"-O" << MaxOptLevel;
522 OptimizationLevel = MaxOptLevel;
524 Opts.OptimizationLevel = OptimizationLevel;
528 Opts.setInlining((Opts.OptimizationLevel == 0)
533 if (Arg *InlineArg = Args.getLastArg(
534 options::OPT_finline_functions, options::OPT_finline_hint_functions,
535 options::OPT_fno_inline_functions, options::OPT_fno_inline)) {
536 if (Opts.OptimizationLevel > 0) {
537 const Option &InlineOpt = InlineArg->getOption();
538 if (InlineOpt.matches(options::OPT_finline_functions))
539 Opts.setInlining(CodeGenOptions::NormalInlining);
540 else if (InlineOpt.matches(options::OPT_finline_hint_functions))
547 Opts.ExperimentalNewPassManager = Args.hasFlag(
548 OPT_fexperimental_new_pass_manager, OPT_fno_experimental_new_pass_manager,
549 ENABLE_EXPERIMENTAL_NEW_PASS_MANAGER);
551 Opts.DebugPassManager =
552 Args.hasFlag(OPT_fdebug_pass_manager, OPT_fno_debug_pass_manager,
555 if (Arg *A = Args.getLastArg(OPT_fveclib)) {
556 StringRef Name = A->getValue();
557 if (Name ==
"Accelerate")
559 else if (Name ==
"SVML")
561 else if (Name ==
"none")
564 Diags.
Report(diag::err_drv_invalid_value) << A->getAsString(Args) << Name;
567 if (Arg *A = Args.getLastArg(OPT_debug_info_kind_EQ)) {
569 llvm::StringSwitch<unsigned>(A->getValue())
575 Diags.
Report(diag::err_drv_invalid_value) << A->getAsString(Args)
578 Opts.setDebugInfo(static_cast<codegenoptions::DebugInfoKind>(Val));
580 if (Arg *A = Args.getLastArg(OPT_debugger_tuning_EQ)) {
581 unsigned Val = llvm::StringSwitch<unsigned>(A->getValue())
582 .Case(
"gdb",
unsigned(llvm::DebuggerKind::GDB))
583 .Case(
"lldb",
unsigned(llvm::DebuggerKind::LLDB))
584 .Case(
"sce",
unsigned(llvm::DebuggerKind::SCE))
587 Diags.
Report(diag::err_drv_invalid_value) << A->getAsString(Args)
590 Opts.setDebuggerTuning(static_cast<llvm::DebuggerKind>(Val));
593 Opts.DebugColumnInfo = Args.hasArg(OPT_dwarf_column_info);
594 Opts.EmitCodeView = Args.hasArg(OPT_gcodeview);
595 Opts.MacroDebugInfo = Args.hasArg(OPT_debug_info_macro);
596 Opts.WholeProgramVTables = Args.hasArg(OPT_fwhole_program_vtables);
597 Opts.LTOVisibilityPublicStd = Args.hasArg(OPT_flto_visibility_public_std);
598 Opts.EnableSplitDwarf = Args.hasArg(OPT_enable_split_dwarf);
600 Opts.SplitDwarfInlining = !Args.hasArg(OPT_fno_split_dwarf_inlining);
601 Opts.DebugTypeExtRefs = Args.hasArg(OPT_dwarf_ext_refs);
602 Opts.DebugExplicitImport = Args.hasArg(OPT_dwarf_explicit_import);
603 Opts.DebugFwdTemplateParams = Args.hasArg(OPT_debug_forward_template_params);
604 Opts.EmbedSource = Args.hasArg(OPT_gembed_source);
606 for (
const auto &Arg : Args.getAllArgValues(OPT_fdebug_prefix_map_EQ))
610 Args.getLastArg(OPT_emit_llvm_uselists, OPT_no_emit_llvm_uselists))
611 Opts.EmitLLVMUseLists = A->getOption().getID() == OPT_emit_llvm_uselists;
613 Opts.DisableLLVMPasses = Args.hasArg(OPT_disable_llvm_passes);
614 Opts.DisableLifetimeMarkers = Args.hasArg(OPT_disable_lifetimemarkers);
615 Opts.DisableO0ImplyOptNone = Args.hasArg(OPT_disable_O0_optnone);
616 Opts.DisableRedZone = Args.hasArg(OPT_disable_red_zone);
617 Opts.ForbidGuardVariables = Args.hasArg(OPT_fforbid_guard_variables);
618 Opts.UseRegisterSizedBitfieldAccess = Args.hasArg(
619 OPT_fuse_register_sized_bitfield_access);
620 Opts.RelaxedAliasing = Args.hasArg(OPT_relaxed_aliasing);
621 Opts.StructPathTBAA = !Args.hasArg(OPT_no_struct_path_tbaa);
622 Opts.NewStructPathTBAA = !Args.hasArg(OPT_no_struct_path_tbaa) &&
623 Args.hasArg(OPT_new_struct_path_tbaa);
624 Opts.FineGrainedBitfieldAccesses =
625 Args.hasFlag(OPT_ffine_grained_bitfield_accesses,
626 OPT_fno_fine_grained_bitfield_accesses,
false);
628 Opts.MergeAllConstants = Args.hasArg(OPT_fmerge_all_constants);
629 Opts.NoCommon = Args.hasArg(OPT_fno_common);
630 Opts.NoImplicitFloat = Args.hasArg(OPT_no_implicit_float);
632 Opts.SimplifyLibCalls = !(Args.hasArg(OPT_fno_builtin) ||
633 Args.hasArg(OPT_ffreestanding));
634 if (Opts.SimplifyLibCalls)
637 Args.hasFlag(OPT_funroll_loops, OPT_fno_unroll_loops,
638 (Opts.OptimizationLevel > 1));
639 Opts.RerollLoops = Args.hasArg(OPT_freroll_loops);
641 Opts.DisableIntegratedAS = Args.hasArg(OPT_fno_integrated_as);
642 Opts.Autolink = !Args.hasArg(OPT_fno_autolink);
644 Opts.DebugInfoForProfiling = Args.hasFlag(
645 OPT_fdebug_info_for_profiling, OPT_fno_debug_info_for_profiling,
false);
646 Opts.GnuPubnames = Args.hasArg(OPT_ggnu_pubnames);
650 Args.getLastArgValue(OPT_fprofile_instrument_path_EQ);
652 Args.getLastArgValue(OPT_fprofile_instrument_use_path_EQ);
656 Opts.CoverageMapping =
657 Args.hasFlag(OPT_fcoverage_mapping, OPT_fno_coverage_mapping,
false);
658 Opts.DumpCoverageMapping = Args.hasArg(OPT_dump_coverage_mapping);
659 Opts.AsmVerbose = Args.hasArg(OPT_masm_verbose);
660 Opts.PreserveAsmComments = !Args.hasArg(OPT_fno_preserve_as_comments);
661 Opts.AssumeSaneOperatorNew = !Args.hasArg(OPT_fno_assume_sane_operator_new);
662 Opts.ObjCAutoRefCountExceptions = Args.hasArg(OPT_fobjc_arc_exceptions);
663 Opts.CXAAtExit = !Args.hasArg(OPT_fno_use_cxa_atexit);
664 Opts.RegisterGlobalDtorsWithAtExit =
665 Args.hasArg(OPT_fregister_global_dtors_with_atexit);
666 Opts.CXXCtorDtorAliases = Args.hasArg(OPT_mconstructor_aliases);
668 Opts.
DebugPass = Args.getLastArgValue(OPT_mdebug_pass);
670 (Args.hasArg(OPT_mdisable_fp_elim) || Args.hasArg(OPT_pg));
671 Opts.DisableFree = Args.hasArg(OPT_disable_free);
672 Opts.DiscardValueNames = Args.hasArg(OPT_discard_value_names);
673 Opts.DisableTailCalls = Args.hasArg(OPT_mdisable_tail_calls);
674 Opts.NoEscapingBlockTailCalls =
675 Args.hasArg(OPT_fno_escaping_block_tail_calls);
676 Opts.
FloatABI = Args.getLastArgValue(OPT_mfloat_abi);
677 Opts.LessPreciseFPMAD = Args.hasArg(OPT_cl_mad_enable) ||
678 Args.hasArg(OPT_cl_unsafe_math_optimizations) ||
679 Args.hasArg(OPT_cl_fast_relaxed_math);
681 Opts.NoInfsFPMath = (Args.hasArg(OPT_menable_no_infinities) ||
682 Args.hasArg(OPT_cl_finite_math_only) ||
683 Args.hasArg(OPT_cl_fast_relaxed_math));
684 Opts.NoNaNsFPMath = (Args.hasArg(OPT_menable_no_nans) ||
685 Args.hasArg(OPT_cl_unsafe_math_optimizations) ||
686 Args.hasArg(OPT_cl_finite_math_only) ||
687 Args.hasArg(OPT_cl_fast_relaxed_math));
688 Opts.NoSignedZeros = (Args.hasArg(OPT_fno_signed_zeros) ||
689 Args.hasArg(OPT_cl_no_signed_zeros) ||
690 Args.hasArg(OPT_cl_unsafe_math_optimizations) ||
691 Args.hasArg(OPT_cl_fast_relaxed_math));
692 Opts.Reassociate = Args.hasArg(OPT_mreassociate);
693 Opts.FlushDenorm = Args.hasArg(OPT_cl_denorms_are_zero) ||
694 (Args.hasArg(OPT_fcuda_is_device) &&
695 Args.hasArg(OPT_fcuda_flush_denormals_to_zero));
696 Opts.CorrectlyRoundedDivSqrt =
697 Args.hasArg(OPT_cl_fp32_correctly_rounded_divide_sqrt);
699 Args.hasArg(OPT_cl_uniform_work_group_size);
700 Opts.
Reciprocals = Args.getAllArgValues(OPT_mrecip_EQ);
701 Opts.ReciprocalMath = Args.hasArg(OPT_freciprocal_math);
702 Opts.NoTrappingMath = Args.hasArg(OPT_fno_trapping_math);
703 Opts.StrictFloatCastOverflow =
704 !Args.hasArg(OPT_fno_strict_float_cast_overflow);
706 Opts.NoZeroInitializedInBSS = Args.hasArg(OPT_mno_zero_initialized_in_bss);
708 Opts.NoExecStack = Args.hasArg(OPT_mno_exec_stack);
709 Opts.FatalWarnings = Args.hasArg(OPT_massembler_fatal_warnings);
710 Opts.EnableSegmentedStacks = Args.hasArg(OPT_split_stacks);
711 Opts.RelaxAll = Args.hasArg(OPT_mrelax_all);
712 Opts.IncrementalLinkerCompatible =
713 Args.hasArg(OPT_mincremental_linker_compatible);
714 Opts.PIECopyRelocations =
715 Args.hasArg(OPT_mpie_copy_relocations);
716 Opts.NoPLT = Args.hasArg(OPT_fno_plt);
717 Opts.OmitLeafFramePointer = Args.hasArg(OPT_momit_leaf_frame_pointer);
718 Opts.SaveTempLabels = Args.hasArg(OPT_msave_temp_labels);
719 Opts.NoDwarfDirectoryAsm = Args.hasArg(OPT_fno_dwarf_directory_asm);
720 Opts.SoftFloat = Args.hasArg(OPT_msoft_float);
721 Opts.StrictEnums = Args.hasArg(OPT_fstrict_enums);
722 Opts.StrictReturn = !Args.hasArg(OPT_fno_strict_return);
723 Opts.StrictVTablePointers = Args.hasArg(OPT_fstrict_vtable_pointers);
724 Opts.ForceEmitVTables = Args.hasArg(OPT_fforce_emit_vtables);
725 Opts.UnsafeFPMath = Args.hasArg(OPT_menable_unsafe_fp_math) ||
726 Args.hasArg(OPT_cl_unsafe_math_optimizations) ||
727 Args.hasArg(OPT_cl_fast_relaxed_math);
728 Opts.UnwindTables = Args.hasArg(OPT_munwind_tables);
730 Opts.
ThreadModel = Args.getLastArgValue(OPT_mthread_model,
"posix");
732 Diags.
Report(diag::err_drv_invalid_value)
733 << Args.getLastArg(OPT_mthread_model)->getAsString(Args)
735 Opts.
TrapFuncName = Args.getLastArgValue(OPT_ftrap_function_EQ);
736 Opts.UseInitArray = Args.hasArg(OPT_fuse_init_array);
738 Opts.FunctionSections = Args.hasFlag(OPT_ffunction_sections,
739 OPT_fno_function_sections,
false);
740 Opts.DataSections = Args.hasFlag(OPT_fdata_sections,
741 OPT_fno_data_sections,
false);
742 Opts.StackSizeSection =
743 Args.hasFlag(OPT_fstack_size_section, OPT_fno_stack_size_section,
false);
744 Opts.UniqueSectionNames = Args.hasFlag(OPT_funique_section_names,
745 OPT_fno_unique_section_names,
true);
747 Opts.MergeFunctions = Args.hasArg(OPT_fmerge_functions);
749 Opts.NoUseJumpTables = Args.hasArg(OPT_fno_jump_tables);
751 Opts.NullPointerIsValid = Args.hasArg(OPT_fno_delete_null_pointer_checks);
753 Opts.ProfileSampleAccurate = Args.hasArg(OPT_fprofile_sample_accurate);
755 Opts.PrepareForLTO = Args.hasArg(OPT_flto, OPT_flto_EQ);
756 Opts.PrepareForThinLTO =
false;
757 if (Arg *A = Args.getLastArg(OPT_flto_EQ)) {
758 StringRef S = A->getValue();
760 Opts.PrepareForThinLTO =
true;
761 else if (S !=
"full")
762 Diags.
Report(diag::err_drv_invalid_value) << A->getAsString(Args) << S;
764 Opts.LTOUnit = Args.hasFlag(OPT_flto_unit, OPT_fno_lto_unit,
false);
765 if (Arg *A = Args.getLastArg(OPT_fthinlto_index_EQ)) {
767 Diags.
Report(diag::err_drv_argument_only_allowed_with)
768 << A->getAsString(Args) <<
"-x ir";
771 if (Arg *A = Args.getLastArg(OPT_save_temps_EQ))
773 llvm::StringSwitch<std::string>(A->getValue())
775 .Default(llvm::sys::path::filename(FrontendOpts.
OutputFile).str());
779 Opts.MSVolatile = Args.hasArg(OPT_fms_volatile);
781 Opts.VectorizeLoop = Args.hasArg(OPT_vectorize_loops);
782 Opts.VectorizeSLP = Args.hasArg(OPT_vectorize_slp);
786 Opts.
MainFileName = Args.getLastArgValue(OPT_main_file_name);
787 Opts.VerifyModule = !Args.hasArg(OPT_disable_llvm_verifier);
789 Opts.ControlFlowGuard = Args.hasArg(OPT_cfguard);
791 Opts.DisableGCov = Args.hasArg(OPT_test_coverage);
792 Opts.EmitGcovArcs = Args.hasArg(OPT_femit_coverage_data);
793 Opts.EmitGcovNotes = Args.hasArg(OPT_femit_coverage_notes);
794 if (Opts.EmitGcovArcs || Opts.EmitGcovNotes) {
797 Opts.CoverageExtraChecksum = Args.hasArg(OPT_coverage_cfg_checksum);
798 Opts.CoverageNoFunctionNamesInData =
799 Args.hasArg(OPT_coverage_no_function_names_in_data);
800 Opts.CoverageExitBlockBeforeBody =
801 Args.hasArg(OPT_coverage_exit_block_before_body);
802 if (Args.hasArg(OPT_coverage_version_EQ)) {
803 StringRef CoverageVersion = Args.getLastArgValue(OPT_coverage_version_EQ);
804 if (CoverageVersion.size() != 4) {
805 Diags.
Report(diag::err_drv_invalid_value)
806 << Args.getLastArg(OPT_coverage_version_EQ)->getAsString(Args)
814 if (Arg *A = Args.getLastArg(OPT_fembed_bitcode_EQ)) {
815 StringRef Name = A->getValue();
816 unsigned Model = llvm::StringSwitch<unsigned>(Name)
823 Diags.
Report(diag::err_drv_invalid_value) << A->getAsString(Args) << Name;
826 Opts.setEmbedBitcode(
827 static_cast<CodeGenOptions::EmbedBitcodeKind>(Model));
833 for (
const auto &A : Args) {
835 if (A->getOption().getID() == options::OPT_o ||
836 A->getOption().getID() == options::OPT_INPUT ||
837 A->getOption().getID() == options::OPT_x ||
838 A->getOption().getID() == options::OPT_fembed_bitcode ||
839 (A->getOption().getGroup().isValid() &&
840 A->getOption().getGroup().getID() == options::OPT_W_Group))
843 A->render(Args, ASL);
844 for (
const auto &arg : ASL) {
845 StringRef ArgStr(arg);
846 Opts.
CmdArgs.insert(Opts.
CmdArgs.end(), ArgStr.begin(), ArgStr.end());
853 Opts.PreserveVec3Type = Args.hasArg(OPT_fpreserve_vec3_type);
854 Opts.InstrumentFunctions = Args.hasArg(OPT_finstrument_functions);
855 Opts.InstrumentFunctionsAfterInlining =
856 Args.hasArg(OPT_finstrument_functions_after_inlining);
857 Opts.InstrumentFunctionEntryBare =
858 Args.hasArg(OPT_finstrument_function_entry_bare);
860 Opts.XRayInstrumentFunctions =
861 Args.hasArg(OPT_fxray_instrument);
862 Opts.XRayAlwaysEmitCustomEvents =
863 Args.hasArg(OPT_fxray_always_emit_customevents);
864 Opts.XRayAlwaysEmitTypedEvents =
865 Args.hasArg(OPT_fxray_always_emit_typedevents);
866 Opts.XRayInstructionThreshold =
869 auto XRayInstrBundles =
870 Args.getAllArgValues(OPT_fxray_instrumentation_bundle);
871 if (XRayInstrBundles.empty())
874 for (
const auto &A : XRayInstrBundles)
878 Opts.InstrumentForProfiling = Args.hasArg(OPT_pg);
879 Opts.CallFEntry = Args.hasArg(OPT_mfentry);
880 Opts.EmitOpenCLArgMetadata = Args.hasArg(OPT_cl_kernel_arg_info);
882 if (
const Arg *A = Args.getLastArg(OPT_fcf_protection_EQ)) {
883 StringRef Name = A->getValue();
884 if (Name ==
"full") {
885 Opts.CFProtectionReturn = 1;
886 Opts.CFProtectionBranch = 1;
887 }
else if (Name ==
"return")
888 Opts.CFProtectionReturn = 1;
889 else if (Name ==
"branch")
890 Opts.CFProtectionBranch = 1;
891 else if (Name !=
"none") {
892 Diags.
Report(diag::err_drv_invalid_value) << A->getAsString(Args) << Name;
897 if (
const Arg *A = Args.getLastArg(OPT_compress_debug_sections,
898 OPT_compress_debug_sections_EQ)) {
899 if (A->getOption().getID() == OPT_compress_debug_sections) {
901 Opts.setCompressDebugSections(llvm::DebugCompressionType::GNU);
903 auto DCT = llvm::StringSwitch<llvm::DebugCompressionType>(A->getValue())
904 .Case(
"none", llvm::DebugCompressionType::None)
905 .Case(
"zlib", llvm::DebugCompressionType::Z)
906 .Case(
"zlib-gnu", llvm::DebugCompressionType::GNU)
907 .Default(llvm::DebugCompressionType::None);
908 Opts.setCompressDebugSections(DCT);
912 Opts.RelaxELFRelocations = Args.hasArg(OPT_mrelax_relocations);
915 Args.filtered(OPT_mlink_bitcode_file, OPT_mlink_cuda_bitcode)) {
918 if (A->getOption().matches(OPT_mlink_cuda_bitcode)) {
919 F.
LinkFlags = llvm::Linker::Flags::LinkOnlyNeeded;
927 Opts.SanitizeCoverageType =
929 Opts.SanitizeCoverageIndirectCalls =
930 Args.hasArg(OPT_fsanitize_coverage_indirect_calls);
931 Opts.SanitizeCoverageTraceBB = Args.hasArg(OPT_fsanitize_coverage_trace_bb);
932 Opts.SanitizeCoverageTraceCmp = Args.hasArg(OPT_fsanitize_coverage_trace_cmp);
933 Opts.SanitizeCoverageTraceDiv = Args.hasArg(OPT_fsanitize_coverage_trace_div);
934 Opts.SanitizeCoverageTraceGep = Args.hasArg(OPT_fsanitize_coverage_trace_gep);
935 Opts.SanitizeCoverage8bitCounters =
936 Args.hasArg(OPT_fsanitize_coverage_8bit_counters);
937 Opts.SanitizeCoverageTracePC = Args.hasArg(OPT_fsanitize_coverage_trace_pc);
938 Opts.SanitizeCoverageTracePCGuard =
939 Args.hasArg(OPT_fsanitize_coverage_trace_pc_guard);
940 Opts.SanitizeCoverageNoPrune = Args.hasArg(OPT_fsanitize_coverage_no_prune);
941 Opts.SanitizeCoverageInline8bitCounters =
942 Args.hasArg(OPT_fsanitize_coverage_inline_8bit_counters);
943 Opts.SanitizeCoveragePCTable = Args.hasArg(OPT_fsanitize_coverage_pc_table);
944 Opts.SanitizeCoverageStackDepth =
945 Args.hasArg(OPT_fsanitize_coverage_stack_depth);
946 Opts.SanitizeMemoryTrackOrigins =
948 Opts.SanitizeMemoryUseAfterDtor =
949 Args.hasFlag(OPT_fsanitize_memory_use_after_dtor,
950 OPT_fno_sanitize_memory_use_after_dtor,
952 Opts.SanitizeMinimalRuntime = Args.hasArg(OPT_fsanitize_minimal_runtime);
953 Opts.SanitizeCfiCrossDso = Args.hasArg(OPT_fsanitize_cfi_cross_dso);
954 Opts.SanitizeCfiICallGeneralizePointers =
955 Args.hasArg(OPT_fsanitize_cfi_icall_generalize_pointers);
956 Opts.SanitizeStats = Args.hasArg(OPT_fsanitize_stats);
957 if (Arg *A = Args.getLastArg(
958 OPT_fsanitize_address_poison_class_member_array_new_cookie,
959 OPT_fno_sanitize_address_poison_class_member_array_new_cookie)) {
960 Opts.SanitizeAddressPoisonClassMemberArrayNewCookie =
961 A->getOption().getID() ==
962 OPT_fsanitize_address_poison_class_member_array_new_cookie;
964 if (Arg *A = Args.getLastArg(OPT_fsanitize_address_use_after_scope,
965 OPT_fno_sanitize_address_use_after_scope)) {
966 Opts.SanitizeAddressUseAfterScope =
967 A->getOption().getID() == OPT_fsanitize_address_use_after_scope;
969 Opts.SanitizeAddressGlobalsDeadStripping =
970 Args.hasArg(OPT_fsanitize_address_globals_dead_stripping);
973 Opts.StackRealignment = Args.hasArg(OPT_mstackrealign);
974 if (Arg *A = Args.getLastArg(OPT_mstack_alignment)) {
975 StringRef Val = A->getValue();
976 unsigned StackAlignment = Opts.StackAlignment;
977 Val.getAsInteger(10, StackAlignment);
978 Opts.StackAlignment = StackAlignment;
981 if (Arg *A = Args.getLastArg(OPT_mstack_probe_size)) {
982 StringRef Val = A->getValue();
983 unsigned StackProbeSize = Opts.StackProbeSize;
984 Val.getAsInteger(0, StackProbeSize);
985 Opts.StackProbeSize = StackProbeSize;
988 Opts.NoStackArgProbe = Args.hasArg(OPT_mno_stack_arg_probe);
990 if (Arg *A = Args.getLastArg(OPT_fobjc_dispatch_method_EQ)) {
991 StringRef Name = A->getValue();
992 unsigned Method = llvm::StringSwitch<unsigned>(Name)
998 Diags.
Report(diag::err_drv_invalid_value) << A->getAsString(Args) << Name;
1001 Opts.setObjCDispatchMethod(
1002 static_cast<CodeGenOptions::ObjCDispatchMethodKind>(Method));
1006 if (Args.getLastArg(OPT_femulated_tls) ||
1007 Args.getLastArg(OPT_fno_emulated_tls)) {
1008 Opts.ExplicitEmulatedTLS =
true;
1010 Args.hasFlag(OPT_femulated_tls, OPT_fno_emulated_tls,
false);
1013 if (Arg *A = Args.getLastArg(OPT_ftlsmodel_EQ)) {
1014 StringRef Name = A->getValue();
1015 unsigned Model = llvm::StringSwitch<unsigned>(Name)
1022 Diags.
Report(diag::err_drv_invalid_value) << A->getAsString(Args) << Name;
1025 Opts.setDefaultTLSModel(static_cast<CodeGenOptions::TLSModel>(Model));
1029 if (Arg *A = Args.getLastArg(OPT_fdenormal_fp_math_EQ)) {
1030 StringRef Val = A->getValue();
1033 else if (Val ==
"preserve-sign")
1035 else if (Val ==
"positive-zero")
1038 Diags.
Report(diag::err_drv_invalid_value) << A->getAsString(Args) << Val;
1041 if (Arg *A = Args.getLastArg(OPT_fpcc_struct_return, OPT_freg_struct_return)) {
1042 if (A->getOption().matches(OPT_fpcc_struct_return)) {
1045 assert(A->getOption().matches(OPT_freg_struct_return));
1051 Opts.
LinkerOptions = Args.getAllArgValues(OPT_linker_option);
1052 bool NeedLocTracking =
false;
1054 Opts.
OptRecordFile = Args.getLastArgValue(OPT_opt_record_file);
1056 NeedLocTracking =
true;
1058 if (Arg *A = Args.getLastArg(OPT_Rpass_EQ)) {
1061 NeedLocTracking =
true;
1064 if (Arg *A = Args.getLastArg(OPT_Rpass_missed_EQ)) {
1067 NeedLocTracking =
true;
1070 if (Arg *A = Args.getLastArg(OPT_Rpass_analysis_EQ)) {
1073 NeedLocTracking =
true;
1076 Opts.DiagnosticsWithHotness =
1077 Args.hasArg(options::OPT_fdiagnostics_show_hotness);
1079 bool UsingProfile = UsingSampleProfile ||
1082 if (Opts.DiagnosticsWithHotness && !UsingProfile &&
1085 Diags.
Report(diag::warn_drv_diagnostics_hotness_requires_pgo)
1086 <<
"-fdiagnostics-show-hotness";
1089 Args, options::OPT_fdiagnostics_hotness_threshold_EQ, 0);
1090 if (Opts.DiagnosticsHotnessThreshold > 0 && !UsingProfile)
1091 Diags.
Report(diag::warn_drv_diagnostics_hotness_requires_pgo)
1092 <<
"-fdiagnostics-hotness-threshold=";
1097 if (UsingSampleProfile)
1098 NeedLocTracking =
true;
1110 Args.getAllArgValues(OPT_fsanitize_recover_EQ), Diags,
1113 Args.getAllArgValues(OPT_fsanitize_trap_EQ), Diags,
1117 Args.getLastArgValue(OPT_fcuda_include_gpubinary);
1119 Opts.Backchain = Args.hasArg(OPT_mbackchain);
1122 Args, OPT_fsanitize_undefined_strip_path_components_EQ, 0, Diags);
1124 Opts.EmitVersionIdentMetadata = Args.hasFlag(OPT_Qy, OPT_Qn,
true);
1126 Opts.Addrsig = Args.hasArg(OPT_faddrsig);
1133 Opts.
OutputFile = Args.getLastArgValue(OPT_dependency_file);
1134 Opts.
Targets = Args.getAllArgValues(OPT_MT);
1141 if (Args.hasArg(OPT_show_includes)) {
1145 if (Args.hasArg(options::OPT_E) || Args.hasArg(options::OPT_P))
1152 Opts.
DOTOutputFile = Args.getLastArgValue(OPT_dependency_dot);
1154 Args.getLastArgValue(OPT_module_dependency_dir);
1155 if (Args.hasArg(OPT_MV))
1160 Opts.
ExtraDeps = Args.getAllArgValues(OPT_fdepfile_entry);
1162 for (
const auto *A : Args.filtered(OPT_fmodule_file)) {
1163 StringRef Val = A->getValue();
1164 if (Val.find(
'=') == StringRef::npos)
1178 } ShowColors = DefaultColor ? Colors_Auto : Colors_Off;
1179 for (
auto *A : Args) {
1180 const Option &O = A->getOption();
1181 if (O.matches(options::OPT_fcolor_diagnostics) ||
1182 O.matches(options::OPT_fdiagnostics_color)) {
1183 ShowColors = Colors_On;
1184 }
else if (O.matches(options::OPT_fno_color_diagnostics) ||
1185 O.matches(options::OPT_fno_diagnostics_color)) {
1186 ShowColors = Colors_Off;
1187 }
else if (O.matches(options::OPT_fdiagnostics_color_EQ)) {
1188 StringRef
Value(A->getValue());
1189 if (
Value ==
"always")
1190 ShowColors = Colors_On;
1191 else if (
Value ==
"never")
1192 ShowColors = Colors_Off;
1193 else if (
Value ==
"auto")
1194 ShowColors = Colors_Auto;
1197 return ShowColors == Colors_On ||
1198 (ShowColors == Colors_Auto &&
1199 llvm::sys::Process::StandardErrHasColors());
1204 bool Success =
true;
1205 for (
const auto &Prefix : VerifyPrefixes) {
1208 auto BadChar = std::find_if(Prefix.begin(), Prefix.end(),
1210 &&
C !=
'-' &&
C !=
'_';});
1211 if (BadChar != Prefix.end() || !
isLetter(Prefix[0])) {
1214 Diags->
Report(diag::err_drv_invalid_value) <<
"-verify=" << Prefix;
1215 Diags->
Report(diag::note_drv_verify_prefix_spelling);
1224 bool DefaultDiagColor,
bool DefaultShowOpt) {
1225 bool Success =
true;
1229 Args.getLastArg(OPT_diagnostic_serialized_file, OPT__serialize_diags))
1231 Opts.IgnoreWarnings = Args.hasArg(OPT_w);
1232 Opts.NoRewriteMacros = Args.hasArg(OPT_Wno_rewrite_macros);
1233 Opts.Pedantic = Args.hasArg(OPT_pedantic);
1234 Opts.PedanticErrors = Args.hasArg(OPT_pedantic_errors);
1235 Opts.ShowCarets = !Args.hasArg(OPT_fno_caret_diagnostics);
1237 Opts.ShowColumn = Args.hasFlag(OPT_fshow_column,
1238 OPT_fno_show_column,
1240 Opts.ShowFixits = !Args.hasArg(OPT_fno_diagnostics_fixit_info);
1241 Opts.ShowLocation = !Args.hasArg(OPT_fno_show_source_location);
1242 Opts.AbsolutePath = Args.hasArg(OPT_fdiagnostics_absolute_paths);
1243 Opts.ShowOptionNames =
1244 Args.hasFlag(OPT_fdiagnostics_show_option,
1245 OPT_fno_diagnostics_show_option, DefaultShowOpt);
1247 llvm::sys::Process::UseANSIEscapeCodes(Args.hasArg(OPT_fansi_escape_codes));
1250 Opts.ShowNoteIncludeStack =
false;
1251 if (Arg *A = Args.getLastArg(OPT_fdiagnostics_show_note_include_stack,
1252 OPT_fno_diagnostics_show_note_include_stack))
1253 if (A->getOption().matches(OPT_fdiagnostics_show_note_include_stack))
1254 Opts.ShowNoteIncludeStack =
true;
1256 StringRef ShowOverloads =
1257 Args.getLastArgValue(OPT_fshow_overloads_EQ,
"all");
1258 if (ShowOverloads ==
"best")
1260 else if (ShowOverloads ==
"all")
1261 Opts.setShowOverloads(
Ovl_All);
1265 Diags->
Report(diag::err_drv_invalid_value)
1266 << Args.getLastArg(OPT_fshow_overloads_EQ)->getAsString(Args)
1270 StringRef ShowCategory =
1271 Args.getLastArgValue(OPT_fdiagnostics_show_category,
"none");
1272 if (ShowCategory ==
"none")
1273 Opts.ShowCategories = 0;
1274 else if (ShowCategory ==
"id")
1275 Opts.ShowCategories = 1;
1276 else if (ShowCategory ==
"name")
1277 Opts.ShowCategories = 2;
1281 Diags->
Report(diag::err_drv_invalid_value)
1282 << Args.getLastArg(OPT_fdiagnostics_show_category)->getAsString(Args)
1287 Args.getLastArgValue(OPT_fdiagnostics_format,
"clang");
1288 if (Format ==
"clang")
1290 else if (Format ==
"msvc")
1292 else if (Format ==
"msvc-fallback") {
1294 Opts.CLFallbackMode =
true;
1295 }
else if (Format ==
"vi")
1300 Diags->
Report(diag::err_drv_invalid_value)
1301 << Args.getLastArg(OPT_fdiagnostics_format)->getAsString(Args)
1305 Opts.ShowSourceRanges = Args.hasArg(OPT_fdiagnostics_print_source_range_info);
1306 Opts.ShowParseableFixits = Args.hasArg(OPT_fdiagnostics_parseable_fixits);
1307 Opts.ShowPresumedLoc = !Args.hasArg(OPT_fno_diagnostics_use_presumed_location);
1308 Opts.VerifyDiagnostics = Args.hasArg(OPT_verify) || Args.hasArg(OPT_verify_EQ);
1310 if (Args.hasArg(OPT_verify))
1315 Opts.VerifyDiagnostics =
false;
1322 Args.getAllArgValues(OPT_verify_ignore_unexpected_EQ),
1324 if (Args.hasArg(OPT_verify_ignore_unexpected))
1326 Opts.setVerifyIgnoreUnexpected(DiagMask);
1327 Opts.ElideType = !Args.hasArg(OPT_fno_elide_type);
1328 Opts.ShowTemplateTree = Args.hasArg(OPT_fdiagnostics_show_template_tree);
1330 Opts.MacroBacktraceLimit =
1334 Args, OPT_ftemplate_backtrace_limit,
1337 Args, OPT_fconstexpr_backtrace_limit,
1340 Args, OPT_fspell_checking_limit,
1343 Args, OPT_fcaret_diagnostics_max_lines,
1350 Diags->
Report(diag::warn_ignoring_ftabstop_value)
1361 Opts.
WorkingDir = Args.getLastArgValue(OPT_working_directory);
1369 std::string &BlockName,
1370 unsigned &MajorVersion,
1371 unsigned &MinorVersion,
1373 std::string &UserInfo) {
1375 Arg.split(Args,
':', 5);
1376 if (Args.size() < 5)
1379 BlockName = Args[0];
1380 if (Args[1].getAsInteger(10, MajorVersion))
return true;
1381 if (Args[2].getAsInteger(10, MinorVersion))
return true;
1382 if (Args[3].getAsInteger(2, Hashed))
return true;
1383 if (Args.size() > 4)
1392 if (
const Arg *A = Args.getLastArg(OPT_Action_Group)) {
1393 switch (A->getOption().getID()) {
1395 llvm_unreachable(
"Invalid option in group!");
1399 case OPT_ast_dump_all:
1400 case OPT_ast_dump_lookups:
1406 case OPT_compiler_options_dump:
1408 case OPT_dump_raw_tokens:
1410 case OPT_dump_tokens:
1414 case OPT_emit_llvm_bc:
1420 case OPT_emit_llvm_only:
1422 case OPT_emit_codegen_only:
1431 case OPT_emit_module:
1433 case OPT_emit_module_interface:
1441 case OPT_fsyntax_only:
1443 case OPT_module_file_info:
1445 case OPT_verify_pch:
1447 case OPT_print_decl_contexts:
1449 case OPT_print_preamble:
1453 case OPT_templight_dump:
1455 case OPT_rewrite_macros:
1457 case OPT_rewrite_objc:
1459 case OPT_rewrite_test:
1470 if (
const Arg* A = Args.getLastArg(OPT_plugin)) {
1471 Opts.
Plugins.emplace_back(A->getValue(0));
1476 for (
const auto *AA : Args.filtered(OPT_plugin_arg))
1477 Opts.
PluginArgs[AA->getValue(0)].emplace_back(AA->getValue(1));
1479 for (
const std::string &Arg :
1480 Args.getAllArgValues(OPT_ftest_module_file_extension_EQ)) {
1481 std::string BlockName;
1482 unsigned MajorVersion;
1483 unsigned MinorVersion;
1485 std::string UserInfo;
1487 MinorVersion, Hashed, UserInfo)) {
1488 Diags.
Report(diag::err_test_module_file_extension_format) << Arg;
1495 std::make_shared<TestModuleFileExtension>(
1496 BlockName, MajorVersion, MinorVersion, Hashed, UserInfo));
1499 if (
const Arg *A = Args.getLastArg(OPT_code_completion_at)) {
1503 Diags.
Report(diag::err_drv_invalid_value)
1504 << A->getAsString(Args) << A->getValue();
1508 Opts.
OutputFile = Args.getLastArgValue(OPT_o);
1509 Opts.
Plugins = Args.getAllArgValues(OPT_load);
1511 Opts.
ShowHelp = Args.hasArg(OPT_help);
1512 Opts.
ShowStats = Args.hasArg(OPT_print_stats);
1513 Opts.
ShowTimers = Args.hasArg(OPT_ftime_report);
1516 Opts.
LLVMArgs = Args.getAllArgValues(OPT_mllvm);
1522 Opts.
ASTDumpAll = Args.hasArg(OPT_ast_dump_all);
1523 Opts.
ASTDumpFilter = Args.getLastArgValue(OPT_ast_dump_filter);
1527 Opts.
ModuleMapFiles = Args.getAllArgValues(OPT_fmodule_map_file);
1529 for (
const auto *A : Args.filtered(OPT_fmodule_file)) {
1530 StringRef Val = A->getValue();
1531 if (Val.find(
'=') == StringRef::npos)
1539 = Args.hasArg(OPT_code_completion_macros);
1541 = Args.hasArg(OPT_code_completion_patterns);
1543 = !Args.hasArg(OPT_no_code_completion_globals);
1545 = !Args.hasArg(OPT_no_code_completion_ns_level_decls);
1547 = Args.hasArg(OPT_code_completion_brief_comments);
1549 = Args.hasArg(OPT_code_completion_with_fixits);
1552 = Args.getLastArgValue(OPT_foverride_record_layout_EQ);
1555 Opts.
StatsFile = Args.getLastArgValue(OPT_stats_file);
1557 if (
const Arg *A = Args.getLastArg(OPT_arcmt_check,
1559 OPT_arcmt_migrate)) {
1560 switch (A->getOption().getID()) {
1562 llvm_unreachable(
"missed a case");
1563 case OPT_arcmt_check:
1566 case OPT_arcmt_modify:
1569 case OPT_arcmt_migrate:
1574 Opts.
MTMigrateDir = Args.getLastArgValue(OPT_mt_migrate_directory);
1576 = Args.getLastArgValue(OPT_arcmt_migrate_report_output);
1578 = Args.hasArg(OPT_arcmt_migrate_emit_arc_errors);
1580 if (Args.hasArg(OPT_objcmt_migrate_literals))
1582 if (Args.hasArg(OPT_objcmt_migrate_subscripting))
1584 if (Args.hasArg(OPT_objcmt_migrate_property_dot_syntax))
1586 if (Args.hasArg(OPT_objcmt_migrate_property))
1588 if (Args.hasArg(OPT_objcmt_migrate_readonly_property))
1590 if (Args.hasArg(OPT_objcmt_migrate_readwrite_property))
1592 if (Args.hasArg(OPT_objcmt_migrate_annotation))
1594 if (Args.hasArg(OPT_objcmt_returns_innerpointer_property))
1596 if (Args.hasArg(OPT_objcmt_migrate_instancetype))
1598 if (Args.hasArg(OPT_objcmt_migrate_nsmacros))
1600 if (Args.hasArg(OPT_objcmt_migrate_protocol_conformance))
1602 if (Args.hasArg(OPT_objcmt_atomic_property))
1604 if (Args.hasArg(OPT_objcmt_ns_nonatomic_iosonly))
1606 if (Args.hasArg(OPT_objcmt_migrate_designated_init))
1608 if (Args.hasArg(OPT_objcmt_migrate_all))
1615 Diags.
Report(diag::err_drv_argument_not_allowed_with)
1616 <<
"ARC migration" <<
"ObjC migration";
1620 if (
const Arg *A = Args.getLastArg(OPT_x)) {
1621 StringRef XValue = A->getValue();
1625 bool Preprocessed = XValue.consume_back(
"-cpp-output");
1626 bool ModuleMap = XValue.consume_back(
"-module-map");
1628 !Preprocessed && !ModuleMap && XValue.consume_back(
"-header");
1631 DashX = llvm::StringSwitch<InputKind>(XValue)
1644 if (DashX.
isUnknown() && Preprocessed && !IsHeaderFile && !ModuleMap)
1645 DashX = llvm::StringSwitch<InputKind>(XValue)
1652 DashX = llvm::StringSwitch<InputKind>(XValue)
1655 .Cases(
"ast",
"pcm",
1661 Diags.
Report(diag::err_drv_invalid_value)
1662 << A->getAsString(Args) << A->getValue();
1671 std::vector<std::string> Inputs = Args.getAllArgValues(OPT_INPUT);
1674 Inputs.push_back(
"-");
1675 for (
unsigned i = 0, e = Inputs.size(); i != e; ++i) {
1679 StringRef(Inputs[i]).rsplit(
'.').second);
1693 Opts.
Inputs.emplace_back(std::move(Inputs[i]), IK);
1701 std::string ClangExecutable =
1702 llvm::sys::fs::getMainExecutable(Argv0, MainAddr);
1703 StringRef Dir = llvm::sys::path::parent_path(ClangExecutable);
1706 StringRef ClangResourceDir(CLANG_RESOURCE_DIR);
1708 if (ClangResourceDir !=
"")
1709 llvm::sys::path::append(P, ClangResourceDir);
1711 llvm::sys::path::append(P,
"..", Twine(
"lib") + CLANG_LIBDIR_SUFFIX,
1712 "clang", CLANG_VERSION_STRING);
1718 const std::string &WorkingDir) {
1719 Opts.
Sysroot = Args.getLastArgValue(OPT_isysroot,
"/");
1720 Opts.
Verbose = Args.hasArg(OPT_v);
1724 if (
const Arg *A = Args.getLastArg(OPT_stdlib_EQ))
1725 Opts.
UseLibcxx = (strcmp(A->getValue(),
"libc++") == 0);
1726 Opts.
ResourceDir = Args.getLastArgValue(OPT_resource_dir);
1730 if (!(
P.empty() || llvm::sys::path::is_absolute(
P))) {
1731 if (WorkingDir.empty())
1732 llvm::sys::fs::make_absolute(
P);
1734 llvm::sys::fs::make_absolute(WorkingDir,
P);
1736 llvm::sys::path::remove_dots(
P);
1741 for (
const auto *A : Args.filtered(OPT_fmodule_file)) {
1742 StringRef Val = A->getValue();
1743 if (Val.find(
'=') != StringRef::npos)
1746 for (
const auto *A : Args.filtered(OPT_fprebuilt_module_path))
1751 !Args.hasArg(OPT_fmodules_disable_diagnostic_validation);
1759 Args.hasArg(OPT_fmodules_validate_once_per_build_session);
1763 Args.hasArg(OPT_fmodules_validate_system_headers);
1764 if (
const Arg *A = Args.getLastArg(OPT_fmodule_format_EQ))
1767 for (
const auto *A : Args.filtered(OPT_fmodules_ignore_macro)) {
1768 StringRef MacroDef = A->getValue();
1770 llvm::CachedHashString(MacroDef.split(
'=').first));
1774 bool IsIndexHeaderMap =
false;
1775 bool IsSysrootSpecified =
1776 Args.hasArg(OPT__sysroot_EQ) || Args.hasArg(OPT_isysroot);
1777 for (
const auto *A : Args.filtered(OPT_I, OPT_F, OPT_index_header_map)) {
1778 if (A->getOption().matches(OPT_index_header_map)) {
1780 IsIndexHeaderMap =
true;
1787 bool IsFramework = A->getOption().matches(OPT_F);
1788 std::string Path = A->getValue();
1790 if (IsSysrootSpecified && !IsFramework && A->getValue()[0] ==
'=') {
1792 llvm::sys::path::append(Buffer, Opts.
Sysroot,
1793 llvm::StringRef(A->getValue()).substr(1));
1794 Path = Buffer.str();
1797 Opts.
AddPath(Path, Group, IsFramework,
1799 IsIndexHeaderMap =
false;
1803 StringRef Prefix =
"";
1804 for (
const auto *A :
1805 Args.filtered(OPT_iprefix, OPT_iwithprefix, OPT_iwithprefixbefore)) {
1806 if (A->getOption().matches(OPT_iprefix))
1807 Prefix = A->getValue();
1808 else if (A->getOption().matches(OPT_iwithprefix))
1814 for (
const auto *A : Args.filtered(OPT_idirafter))
1816 for (
const auto *A : Args.filtered(OPT_iquote))
1818 for (
const auto *A : Args.filtered(OPT_isystem, OPT_iwithsysroot))
1820 !A->getOption().matches(OPT_iwithsysroot));
1821 for (
const auto *A : Args.filtered(OPT_iframework))
1823 for (
const auto *A : Args.filtered(OPT_iframeworkwithsysroot))
1828 for (
const auto *A : Args.filtered(OPT_c_isystem))
1830 for (
const auto *A : Args.filtered(OPT_cxx_isystem))
1832 for (
const auto *A : Args.filtered(OPT_objc_isystem))
1834 for (
const auto *A : Args.filtered(OPT_objcxx_isystem))
1838 for (
const auto *A :
1839 Args.filtered(OPT_internal_isystem, OPT_internal_externc_isystem)) {
1841 if (A->getOption().matches(OPT_internal_externc_isystem))
1843 Opts.
AddPath(A->getValue(), Group,
false,
true);
1847 for (
const auto *A :
1848 Args.filtered(OPT_system_header_prefix, OPT_no_system_header_prefix))
1850 A->getValue(), A->getOption().matches(OPT_system_header_prefix));
1852 for (
const auto *A : Args.filtered(OPT_ivfsoverlay))
1857 const llvm::Triple &T,
1868 Opts.AsmPreprocessor = 1;
1870 Opts.ObjC1 = Opts.ObjC2 = 1;
1878 llvm_unreachable(
"Invalid input kind!");
1880 LangStd = LangStandard::lang_opencl10;
1883 LangStd = LangStandard::lang_cuda;
1887 #if defined(CLANG_DEFAULT_STD_C) 1888 LangStd = CLANG_DEFAULT_STD_C;
1892 LangStd = LangStandard::lang_gnu99;
1894 LangStd = LangStandard::lang_gnu11;
1898 #if defined(CLANG_DEFAULT_STD_C) 1899 LangStd = CLANG_DEFAULT_STD_C;
1901 LangStd = LangStandard::lang_gnu11;
1906 #if defined(CLANG_DEFAULT_STD_CXX) 1907 LangStd = CLANG_DEFAULT_STD_CXX;
1909 LangStd = LangStandard::lang_gnucxx14;
1913 LangStd = LangStandard::lang_c99;
1916 LangStd = LangStandard::lang_hip;
1923 Opts.C99 = Std.
isC99();
1924 Opts.C11 = Std.
isC11();
1925 Opts.C17 = Std.
isC17();
1933 Opts.GNUInline = !Opts.C99 && !Opts.CPlusPlus;
1939 if (LangStd == LangStandard::lang_opencl10)
1940 Opts.OpenCLVersion = 100;
1941 else if (LangStd == LangStandard::lang_opencl11)
1942 Opts.OpenCLVersion = 110;
1943 else if (LangStd == LangStandard::lang_opencl12)
1944 Opts.OpenCLVersion = 120;
1945 else if (LangStd == LangStandard::lang_opencl20)
1946 Opts.OpenCLVersion = 200;
1947 else if (LangStd == LangStandard::lang_openclcpp)
1948 Opts.OpenCLCPlusPlusVersion = 100;
1954 Opts.LaxVectorConversions = 0;
1956 Opts.NativeHalfType = 1;
1957 Opts.NativeHalfArgsAndReturns = 1;
1958 Opts.OpenCLCPlusPlus = Opts.CPlusPlus;
1960 if (Opts.IncludeDefaultHeader) {
1961 PPOpts.
Includes.push_back(
"opencl-c.h");
1972 if (Opts.RenderScript) {
1973 Opts.NativeHalfType = 1;
1974 Opts.NativeHalfArgsAndReturns = 1;
1978 Opts.Bool = Opts.OpenCL || Opts.CPlusPlus;
1981 Opts.Half = Opts.OpenCL;
1984 Opts.WChar = Opts.CPlusPlus;
1986 Opts.GNUKeywords = Opts.GNUMode;
1987 Opts.CXXOperatorNames = Opts.CPlusPlus;
1989 Opts.AlignedAllocation = Opts.CPlusPlus17;
1991 Opts.DollarIdents = !Opts.AsmPreprocessor;
1997 StringRef value = arg->getValue();
1998 if (value ==
"default") {
2000 }
else if (value ==
"hidden" || value ==
"internal") {
2002 }
else if (value ==
"protected") {
2007 diags.
Report(diag::err_drv_invalid_value)
2008 << arg->getAsString(args) << value;
2018 llvm_unreachable(
"should not parse language flags for this input");
2048 llvm_unreachable(
"unexpected input language");
2057 return "Objective-C";
2061 return "Objective-C++";
2067 return "RenderScript";
2079 llvm_unreachable(
"unknown input language");
2088 if (
const Arg *A = Args.getLastArg(OPT_std_EQ)) {
2089 LangStd = llvm::StringSwitch<LangStandard::Kind>(A->getValue())
2091 .Case(name, LangStandard::lang_##
id)
2092 #define LANGSTANDARD_ALIAS(id, alias) \ 2093 .Case(alias, LangStandard::lang_##id) 2094 #include "clang/Frontend/LangStandards.def" 2097 Diags.
Report(diag::err_drv_invalid_value)
2098 << A->getAsString(Args) << A->getValue();
2100 for (
unsigned KindValue = 0;
2104 static_cast<LangStandard::Kind>(KindValue));
2106 auto Diag = Diags.
Report(diag::note_drv_use_standard);
2108 unsigned NumAliases = 0;
2109 #define LANGSTANDARD(id, name, lang, desc, features) 2110 #define LANGSTANDARD_ALIAS(id, alias) \ 2111 if (KindValue == LangStandard::lang_##id) ++NumAliases; 2112 #define LANGSTANDARD_ALIAS_DEPR(id, alias) 2113 #include "clang/Frontend/LangStandards.def" 2115 #define LANGSTANDARD(id, name, lang, desc, features) 2116 #define LANGSTANDARD_ALIAS(id, alias) \ 2117 if (KindValue == LangStandard::lang_##id) Diag << alias; 2118 #define LANGSTANDARD_ALIAS_DEPR(id, alias) 2119 #include "clang/Frontend/LangStandards.def" 2127 Diags.
Report(diag::err_drv_argument_not_allowed_with)
2133 if (
const Arg *A = Args.getLastArg(OPT_fcf_protection_EQ)) {
2134 StringRef Name = A->getValue();
2135 if (Name ==
"full" || Name ==
"branch") {
2136 Opts.CFProtectionBranch = 1;
2141 if (
const Arg *A = Args.getLastArg(OPT_cl_std_EQ)) {
2143 = llvm::StringSwitch<LangStandard::Kind>(A->getValue())
2144 .Cases(
"cl",
"CL", LangStandard::lang_opencl10)
2145 .Cases(
"cl1.1",
"CL1.1", LangStandard::lang_opencl11)
2146 .Cases(
"cl1.2",
"CL1.2", LangStandard::lang_opencl12)
2147 .Cases(
"cl2.0",
"CL2.0", LangStandard::lang_opencl20)
2148 .Case(
"c++", LangStandard::lang_openclcpp)
2152 Diags.
Report(diag::err_drv_invalid_value)
2153 << A->getAsString(Args) << A->getValue();
2156 LangStd = OpenCLLangStd;
2159 Opts.IncludeDefaultHeader = Args.hasArg(OPT_finclude_default_header);
2161 llvm::Triple T(TargetOpts.
Triple);
2167 if (Args.getLastArg(OPT_cl_strict_aliasing)
2168 && Opts.OpenCLVersion > 100) {
2169 Diags.
Report(diag::warn_option_invalid_ocl_version)
2171 << Args.getLastArg(OPT_cl_strict_aliasing)->getAsString(Args);
2179 Opts.GNUKeywords = Args.hasFlag(OPT_fgnu_keywords, OPT_fno_gnu_keywords,
2182 Opts.Digraphs = Args.hasFlag(OPT_fdigraphs, OPT_fno_digraphs, Opts.Digraphs);
2184 if (Args.hasArg(OPT_fno_operator_names))
2185 Opts.CXXOperatorNames = 0;
2187 if (Args.hasArg(OPT_fcuda_is_device))
2188 Opts.CUDAIsDevice = 1;
2190 if (Args.hasArg(OPT_fcuda_allow_variadic_functions))
2191 Opts.CUDAAllowVariadicFunctions = 1;
2193 if (Args.hasArg(OPT_fno_cuda_host_device_constexpr))
2194 Opts.CUDAHostDeviceConstexpr = 0;
2196 if (Opts.CUDAIsDevice && Args.hasArg(OPT_fcuda_approx_transcendentals))
2197 Opts.CUDADeviceApproxTranscendentals = 1;
2199 Opts.CUDARelocatableDeviceCode = Args.hasArg(OPT_fcuda_rdc);
2202 if (Arg *arg = Args.getLastArg(OPT_fobjc_runtime_EQ)) {
2203 StringRef value = arg->getValue();
2205 Diags.
Report(diag::err_drv_unknown_objc_runtime) << value;
2208 if (Args.hasArg(OPT_fobjc_gc_only))
2210 else if (Args.hasArg(OPT_fobjc_gc))
2212 else if (Args.hasArg(OPT_fobjc_arc)) {
2213 Opts.ObjCAutoRefCount = 1;
2215 Diags.
Report(diag::err_arc_unsupported_on_runtime);
2222 if (Args.hasArg(OPT_fobjc_runtime_has_weak))
2223 Opts.ObjCWeakRuntime = 1;
2229 if (
auto weakArg = Args.getLastArg(OPT_fobjc_weak, OPT_fno_objc_weak)) {
2230 if (!weakArg->getOption().matches(OPT_fobjc_weak)) {
2231 assert(!Opts.ObjCWeak);
2233 Diags.
Report(diag::err_objc_weak_with_gc);
2234 }
else if (!Opts.ObjCWeakRuntime) {
2235 Diags.
Report(diag::err_objc_weak_unsupported);
2239 }
else if (Opts.ObjCAutoRefCount) {
2240 Opts.ObjCWeak = Opts.ObjCWeakRuntime;
2243 if (Args.hasArg(OPT_fno_objc_infer_related_result_type))
2244 Opts.ObjCInferRelatedResultType = 0;
2246 if (Args.hasArg(OPT_fobjc_subscripting_legacy_runtime))
2247 Opts.ObjCSubscriptingLegacyRuntime =
2251 if (Args.hasArg(OPT_fgnu89_inline)) {
2253 Diags.
Report(diag::err_drv_argument_not_allowed_with)
2259 if (Args.hasArg(OPT_fapple_kext)) {
2260 if (!Opts.CPlusPlus)
2261 Diags.
Report(diag::warn_c_kext);
2266 if (Args.hasArg(OPT_print_ivar_layout))
2267 Opts.ObjCGCBitmapPrint = 1;
2268 if (Args.hasArg(OPT_fno_constant_cfstrings))
2269 Opts.NoConstantCFStrings = 1;
2271 if (Args.hasArg(OPT_fzvector))
2274 if (Args.hasArg(OPT_pthread))
2275 Opts.POSIXThreads = 1;
2278 if (Arg *visOpt = Args.getLastArg(OPT_fvisibility)) {
2285 if (Arg *typeVisOpt = Args.getLastArg(OPT_ftype_visibility)) {
2288 Opts.setTypeVisibilityMode(Opts.getValueVisibilityMode());
2291 if (Args.hasArg(OPT_fvisibility_inlines_hidden))
2292 Opts.InlineVisibilityHidden = 1;
2294 if (Args.hasArg(OPT_ftrapv)) {
2298 Args.getLastArgValue(OPT_ftrapv_handler);
2300 else if (Args.hasArg(OPT_fwrapv))
2303 Opts.MSVCCompat = Args.hasArg(OPT_fms_compatibility);
2304 Opts.MicrosoftExt = Opts.MSVCCompat || Args.hasArg(OPT_fms_extensions);
2305 Opts.AsmBlocks = Args.hasArg(OPT_fasm_blocks) || Opts.MicrosoftExt;
2306 Opts.MSCompatibilityVersion = 0;
2307 if (
const Arg *A = Args.getLastArg(OPT_fms_compatibility_version)) {
2309 if (VT.tryParse(A->getValue()))
2310 Diags.
Report(diag::err_drv_invalid_value) << A->getAsString(Args)
2312 Opts.MSCompatibilityVersion = VT.getMajor() * 10000000 +
2313 VT.getMinor().getValueOr(0) * 100000 +
2314 VT.getSubminor().getValueOr(0);
2320 Opts.Trigraphs = !Opts.GNUMode && !Opts.MSVCCompat && !Opts.CPlusPlus17;
2322 Args.hasFlag(OPT_ftrigraphs, OPT_fno_trigraphs, Opts.Trigraphs);
2324 Opts.DollarIdents = Args.hasFlag(OPT_fdollars_in_identifiers,
2325 OPT_fno_dollars_in_identifiers,
2327 Opts.PascalStrings = Args.hasArg(OPT_fpascal_strings);
2329 Opts.Borland = Args.hasArg(OPT_fborland_extensions);
2330 Opts.WritableStrings = Args.hasArg(OPT_fwritable_strings);
2331 Opts.ConstStrings = Args.hasFlag(OPT_fconst_strings, OPT_fno_const_strings,
2333 if (Args.hasArg(OPT_fno_lax_vector_conversions))
2334 Opts.LaxVectorConversions = 0;
2335 if (Args.hasArg(OPT_fno_threadsafe_statics))
2336 Opts.ThreadsafeStatics = 0;
2337 Opts.Exceptions = Args.hasArg(OPT_fexceptions);
2338 Opts.ObjCExceptions = Args.hasArg(OPT_fobjc_exceptions);
2339 Opts.CXXExceptions = Args.hasArg(OPT_fcxx_exceptions);
2343 Args.hasFlag(OPT_ffixed_point, OPT_fno_fixed_point,
false) &&
2345 Opts.PaddingOnUnsignedFixedPoint =
2346 Args.hasFlag(OPT_fpadding_on_unsigned_fixed_point,
2347 OPT_fno_padding_on_unsigned_fixed_point,
2352 Arg *A = Args.getLastArg(options::OPT_fsjlj_exceptions,
2353 options::OPT_fseh_exceptions,
2354 options::OPT_fdwarf_exceptions);
2356 const Option &Opt = A->getOption();
2357 llvm::Triple T(TargetOpts.
Triple);
2358 if (T.isWindowsMSVCEnvironment())
2359 Diags.
Report(diag::err_fe_invalid_exception_model)
2360 << Opt.getName() << T.str();
2362 Opts.SjLjExceptions = Opt.matches(options::OPT_fsjlj_exceptions);
2363 Opts.SEHExceptions = Opt.matches(options::OPT_fseh_exceptions);
2364 Opts.DWARFExceptions = Opt.matches(options::OPT_fdwarf_exceptions);
2367 Opts.ExternCNoUnwind = Args.hasArg(OPT_fexternc_nounwind);
2368 Opts.TraditionalCPP = Args.hasArg(OPT_traditional_cpp);
2370 Opts.RTTI = Opts.CPlusPlus && !Args.hasArg(OPT_fno_rtti);
2371 Opts.RTTIData = Opts.RTTI && !Args.hasArg(OPT_fno_rtti_data);
2372 Opts.Blocks = Args.hasArg(OPT_fblocks) || (Opts.OpenCL
2373 && Opts.OpenCLVersion == 200);
2374 Opts.BlocksRuntimeOptional = Args.hasArg(OPT_fblocks_runtime_optional);
2375 Opts.CoroutinesTS = Args.hasArg(OPT_fcoroutines_ts);
2378 Opts.DoubleSquareBracketAttributes =
2379 Args.hasFlag(OPT_fdouble_square_bracket_attributes,
2380 OPT_fno_double_square_bracket_attributes, Opts.CPlusPlus11);
2382 Opts.ModulesTS = Args.hasArg(OPT_fmodules_ts);
2383 Opts.Modules = Args.hasArg(OPT_fmodules) || Opts.ModulesTS;
2384 Opts.ModulesStrictDeclUse = Args.hasArg(OPT_fmodules_strict_decluse);
2385 Opts.ModulesDeclUse =
2386 Args.hasArg(OPT_fmodules_decluse) || Opts.ModulesStrictDeclUse;
2387 Opts.ModulesLocalVisibility =
2388 Args.hasArg(OPT_fmodules_local_submodule_visibility) || Opts.ModulesTS;
2389 Opts.ModulesCodegen = Args.hasArg(OPT_fmodules_codegen);
2390 Opts.ModulesDebugInfo = Args.hasArg(OPT_fmodules_debuginfo);
2391 Opts.ModulesSearchAll = Opts.Modules &&
2392 !Args.hasArg(OPT_fno_modules_search_all) &&
2393 Args.hasArg(OPT_fmodules_search_all);
2394 Opts.ModulesErrorRecovery = !Args.hasArg(OPT_fno_modules_error_recovery);
2395 Opts.ImplicitModules = !Args.hasArg(OPT_fno_implicit_modules);
2396 Opts.CharIsSigned = Opts.OpenCL || !Args.hasArg(OPT_fno_signed_char);
2397 Opts.WChar = Opts.CPlusPlus && !Args.hasArg(OPT_fno_wchar);
2398 Opts.Char8 = Args.hasArg(OPT_fchar8__t);
2399 if (
const Arg *A = Args.getLastArg(OPT_fwchar_type_EQ)) {
2400 Opts.WCharSize = llvm::StringSwitch<unsigned>(A->getValue())
2405 if (Opts.WCharSize == 0)
2406 Diags.
Report(diag::err_fe_invalid_wchar_type) << A->getValue();
2408 Opts.WCharIsSigned = Args.hasFlag(OPT_fsigned_wchar, OPT_fno_signed_wchar,
true);
2409 Opts.ShortEnums = Args.hasArg(OPT_fshort_enums);
2410 Opts.Freestanding = Args.hasArg(OPT_ffreestanding);
2411 Opts.NoBuiltin = Args.hasArg(OPT_fno_builtin) || Opts.Freestanding;
2412 if (!Opts.NoBuiltin)
2414 Opts.NoMathBuiltin = Args.hasArg(OPT_fno_math_builtin);
2415 Opts.RelaxedTemplateTemplateArgs =
2416 Args.hasArg(OPT_frelaxed_template_template_args);
2417 Opts.SizedDeallocation = Args.hasArg(OPT_fsized_deallocation);
2418 Opts.AlignedAllocation =
2419 Args.hasFlag(OPT_faligned_allocation, OPT_fno_aligned_allocation,
2420 Opts.AlignedAllocation);
2421 Opts.AlignedAllocationUnavailable =
2422 Opts.AlignedAllocation && Args.hasArg(OPT_aligned_alloc_unavailable);
2423 Opts.NewAlignOverride =
2425 if (Opts.NewAlignOverride && !llvm::isPowerOf2_32(Opts.NewAlignOverride)) {
2426 Arg *A = Args.getLastArg(OPT_fnew_alignment_EQ);
2427 Diags.
Report(diag::err_fe_invalid_alignment) << A->getAsString(Args)
2429 Opts.NewAlignOverride = 0;
2431 Opts.ConceptsTS = Args.hasArg(OPT_fconcepts_ts);
2432 Opts.HeinousExtensions = Args.hasArg(OPT_fheinous_gnu_extensions);
2433 Opts.AccessControl = !Args.hasArg(OPT_fno_access_control);
2434 Opts.ElideConstructors = !Args.hasArg(OPT_fno_elide_constructors);
2435 Opts.MathErrno = !Opts.OpenCL && Args.hasArg(OPT_fmath_errno);
2436 Opts.InstantiationDepth =
2440 Opts.ConstexprCallDepth =
2442 Opts.ConstexprStepLimit =
2445 Opts.DelayedTemplateParsing = Args.hasArg(OPT_fdelayed_template_parsing);
2446 Opts.NumLargeByValueCopy =
2448 Opts.MSBitfields = Args.hasArg(OPT_mms_bitfields);
2450 Args.getLastArgValue(OPT_fconstant_string_class);
2451 Opts.ObjCDefaultSynthProperties =
2452 !Args.hasArg(OPT_disable_objc_default_synthesize_properties);
2453 Opts.EncodeExtendedBlockSig =
2454 Args.hasArg(OPT_fencode_extended_block_signature);
2455 Opts.EmitAllDecls = Args.hasArg(OPT_femit_all_decls);
2458 Opts.AlignDouble = Args.hasArg(OPT_malign_double);
2460 Opts.PIE = Args.hasArg(OPT_pic_is_pie);
2461 Opts.Static = Args.hasArg(OPT_static_define);
2462 Opts.DumpRecordLayoutsSimple = Args.hasArg(OPT_fdump_record_layouts_simple);
2463 Opts.DumpRecordLayouts = Opts.DumpRecordLayoutsSimple
2464 || Args.hasArg(OPT_fdump_record_layouts);
2465 Opts.DumpVTableLayouts = Args.hasArg(OPT_fdump_vtable_layouts);
2466 Opts.SpellChecking = !Args.hasArg(OPT_fno_spell_checking);
2467 Opts.NoBitFieldTypeAlign = Args.hasArg(OPT_fno_bitfield_type_align);
2468 Opts.SinglePrecisionConstants = Args.hasArg(OPT_cl_single_precision_constant);
2469 Opts.FastRelaxedMath = Args.hasArg(OPT_cl_fast_relaxed_math);
2470 Opts.HexagonQdsp6Compat = Args.hasArg(OPT_mqdsp6_compat);
2471 Opts.FakeAddressSpaceMap = Args.hasArg(OPT_ffake_address_space_map);
2472 Opts.ParseUnknownAnytype = Args.hasArg(OPT_funknown_anytype);
2473 Opts.DebuggerSupport = Args.hasArg(OPT_fdebugger_support);
2474 Opts.DebuggerCastResultToId = Args.hasArg(OPT_fdebugger_cast_result_to_id);
2475 Opts.DebuggerObjCLiteral = Args.hasArg(OPT_fdebugger_objc_literal);
2476 Opts.ApplePragmaPack = Args.hasArg(OPT_fapple_pragma_pack);
2477 Opts.
ModuleName = Args.getLastArgValue(OPT_fmodule_name_EQ);
2479 Opts.AppExt = Args.hasArg(OPT_fapplication_extension);
2482 Opts.NativeHalfType |= Args.hasArg(OPT_fnative_half_type);
2483 Opts.NativeHalfArgsAndReturns |= Args.hasArg(OPT_fnative_half_arguments_and_returns);
2486 Opts.HalfArgsAndReturns = Args.hasArg(OPT_fallow_half_arguments_and_returns)
2487 | Opts.NativeHalfArgsAndReturns;
2488 Opts.GNUAsm = !Args.hasArg(OPT_fno_gnu_inline_asm);
2498 Opts.DeclSpecKeyword =
2499 Args.hasFlag(OPT_fdeclspec, OPT_fno_declspec,
2500 (Opts.MicrosoftExt || Opts.Borland || Opts.CUDA));
2502 if (Arg *A = Args.getLastArg(OPT_faddress_space_map_mangling_EQ)) {
2503 switch (llvm::StringSwitch<unsigned>(A->getValue())
2509 Diags.
Report(diag::err_drv_invalid_value)
2510 <<
"-faddress-space-map-mangling=" << A->getValue();
2524 if (Arg *A = Args.getLastArg(OPT_fms_memptr_rep_EQ)) {
2526 llvm::StringSwitch<LangOptions::PragmaMSPointersToMembersKind>(
2536 Diags.
Report(diag::err_drv_invalid_value)
2537 <<
"-fms-memptr-rep=" << A->getValue();
2539 Opts.setMSPointerToMemberRepresentationMethod(InheritanceModel);
2543 if (Arg *A = Args.getLastArg(OPT_fdefault_calling_conv_EQ)) {
2545 llvm::StringSwitch<LangOptions::DefaultCallingConvention>(A->getValue())
2553 Diags.
Report(diag::err_drv_invalid_value)
2554 <<
"-fdefault-calling-conv=" << A->getValue();
2556 llvm::Triple T(TargetOpts.
Triple);
2557 llvm::Triple::ArchType Arch = T.getArch();
2560 Arch != llvm::Triple::x86;
2563 !(Arch == llvm::Triple::x86 || Arch == llvm::Triple::x86_64);
2565 Diags.
Report(diag::err_drv_argument_not_allowed_with)
2566 << A->getSpelling() << T.getTriple();
2568 Opts.setDefaultCallingConv(DefaultCC);
2572 if (Arg *A = Args.getLastArg(OPT_mrtd)) {
2574 Diags.
Report(diag::err_drv_argument_not_allowed_with)
2575 << A->getSpelling() <<
"-fdefault-calling-conv";
2577 llvm::Triple T(TargetOpts.
Triple);
2578 if (T.getArch() != llvm::Triple::x86)
2579 Diags.
Report(diag::err_drv_argument_not_allowed_with)
2580 << A->getSpelling() << T.getTriple();
2587 Opts.OpenMP = Args.hasArg(options::OPT_fopenmp) ? 1 : 0;
2589 bool IsSimdSpecified =
2590 Args.hasFlag(options::OPT_fopenmp_simd, options::OPT_fno_openmp_simd,
2592 Opts.OpenMPSimd = !Opts.OpenMP && IsSimdSpecified;
2594 Opts.OpenMP && !Args.hasArg(options::OPT_fnoopenmp_use_tls);
2595 Opts.OpenMPIsDevice =
2596 Opts.OpenMP && Args.hasArg(options::OPT_fopenmp_is_device);
2597 bool IsTargetSpecified =
2598 Opts.OpenMPIsDevice || Args.hasArg(options::OPT_fopenmp_targets_EQ);
2600 if (Opts.OpenMP || Opts.OpenMPSimd) {
2602 Args, OPT_fopenmp_version_EQ,
2603 (IsSimdSpecified || IsTargetSpecified) ? 45 : Opts.OpenMP, Diags))
2604 Opts.OpenMP = Version;
2605 else if (IsSimdSpecified || IsTargetSpecified)
2609 if (!Opts.OpenMPIsDevice) {
2610 switch (T.getArch()) {
2614 case llvm::Triple::nvptx:
2615 case llvm::Triple::nvptx64:
2616 Diags.
Report(diag::err_drv_omp_host_target_not_supported)
2625 Opts.OpenMPHostCXXExceptions = Opts.Exceptions && Opts.CXXExceptions;
2626 if ((Opts.OpenMPIsDevice && T.isNVPTX()) || Opts.OpenCLCPlusPlus) {
2627 Opts.Exceptions = 0;
2628 Opts.CXXExceptions = 0;
2632 if (Arg *A = Args.getLastArg(options::OPT_fopenmp_targets_EQ)) {
2634 for (
unsigned i = 0; i < A->getNumValues(); ++i) {
2635 llvm::Triple TT(A->getValue(i));
2637 if (TT.getArch() == llvm::Triple::UnknownArch ||
2638 !(TT.getArch() == llvm::Triple::ppc ||
2639 TT.getArch() == llvm::Triple::ppc64 ||
2640 TT.getArch() == llvm::Triple::ppc64le ||
2641 TT.getArch() == llvm::Triple::nvptx ||
2642 TT.getArch() == llvm::Triple::nvptx64 ||
2643 TT.getArch() == llvm::Triple::x86 ||
2644 TT.getArch() == llvm::Triple::x86_64))
2645 Diags.
Report(diag::err_drv_invalid_omp_target) << A->getValue(i);
2653 if (Arg *A = Args.getLastArg(options::OPT_fopenmp_host_ir_file_path)) {
2656 Diags.
Report(diag::err_drv_omp_host_ir_file_not_found)
2661 Opts.OpenMPCUDAMode = Opts.OpenMPIsDevice && T.isNVPTX() &&
2662 Args.hasArg(options::OPT_fopenmp_cuda_mode);
2665 Opts.Deprecated = Args.hasFlag(OPT_fdeprecated_macro,
2666 OPT_fno_deprecated_macro,
2672 Opts.Optimize = Opt != 0;
2673 Opts.OptimizeSize = OptSize != 0;
2678 Opts.NoInlineDefine = !Opts.Optimize;
2679 if (Arg *InlineArg = Args.getLastArg(
2680 options::OPT_finline_functions, options::OPT_finline_hint_functions,
2681 options::OPT_fno_inline_functions, options::OPT_fno_inline))
2682 if (InlineArg->getOption().matches(options::OPT_fno_inline))
2683 Opts.NoInlineDefine =
true;
2685 Opts.FastMath = Args.hasArg(OPT_ffast_math) ||
2686 Args.hasArg(OPT_cl_fast_relaxed_math);
2687 Opts.FiniteMathOnly = Args.hasArg(OPT_ffinite_math_only) ||
2688 Args.hasArg(OPT_cl_finite_math_only) ||
2689 Args.hasArg(OPT_cl_fast_relaxed_math);
2690 Opts.UnsafeFPMath = Args.hasArg(OPT_menable_unsafe_fp_math) ||
2691 Args.hasArg(OPT_cl_unsafe_math_optimizations) ||
2692 Args.hasArg(OPT_cl_fast_relaxed_math);
2694 if (Arg *A = Args.getLastArg(OPT_ffp_contract)) {
2695 StringRef Val = A->getValue();
2698 else if (Val ==
"on")
2700 else if (Val ==
"off")
2703 Diags.
Report(diag::err_drv_invalid_value) << A->getAsString(Args) << Val;
2706 Opts.RetainCommentsFromSystemHeaders =
2707 Args.hasArg(OPT_fretain_comments_from_system_headers);
2712 Diags.
Report(diag::err_drv_invalid_value)
2713 << Args.getLastArg(OPT_stack_protector)->getAsString(Args) << SSP;
2725 Opts.SanitizeAddressFieldPadding =
2730 Opts.XRayInstrument =
2731 Args.hasFlag(OPT_fxray_instrument, OPT_fnoxray_instrument,
false);
2734 Opts.XRayAlwaysEmitCustomEvents =
2735 Args.hasFlag(OPT_fxray_always_emit_customevents,
2736 OPT_fnoxray_always_emit_customevents,
false);
2739 Opts.XRayAlwaysEmitTypedEvents =
2740 Args.hasFlag(OPT_fxray_always_emit_typedevents,
2741 OPT_fnoxray_always_emit_customevents,
false);
2745 Args.getAllArgValues(OPT_fxray_always_instrument);
2747 Args.getAllArgValues(OPT_fxray_never_instrument);
2751 Opts.ForceEmitVTables = Args.hasArg(OPT_fforce_emit_vtables);
2754 Opts.AllowEditorPlaceholders = Args.hasArg(OPT_fallow_editor_placeholders);
2756 if (Arg *A = Args.getLastArg(OPT_fclang_abi_compat_EQ)) {
2759 StringRef Ver = A->getValue();
2760 std::pair<StringRef, StringRef> VerParts = Ver.split(
'.');
2761 unsigned Major, Minor = 0;
2765 if (!VerParts.first.startswith(
"0") &&
2766 !VerParts.first.getAsInteger(10, Major) &&
2767 3 <= Major && Major <= CLANG_VERSION_MAJOR &&
2768 (Major == 3 ? VerParts.second.size() == 1 &&
2769 !VerParts.second.getAsInteger(10, Minor)
2770 : VerParts.first.size() == Ver.size() ||
2771 VerParts.second ==
"0")) {
2773 if (Major == 3 && Minor <= 8)
2775 else if (Major <= 4)
2777 else if (Major <= 6)
2779 }
else if (Ver !=
"latest") {
2780 Diags.
Report(diag::err_drv_invalid_value)
2781 << A->getAsString(Args) << A->getValue();
2785 Opts.CompleteMemberPointers = Args.hasArg(OPT_fcomplete_member_pointers);
2786 Opts.BuildingPCHWithObjectFile = Args.hasArg(OPT_building_pch_with_obj);
2829 llvm_unreachable(
"invalid frontend action");
2838 if (
const Arg *A = Args.getLastArg(OPT_token_cache))
2843 Opts.
DetailedRecord = Args.hasArg(OPT_detailed_preprocessing_record);
2848 for (
const auto *A : Args.filtered(OPT_error_on_deserialized_pch_decl))
2851 if (
const Arg *A = Args.getLastArg(OPT_preamble_bytes_EQ)) {
2852 StringRef
Value(A->getValue());
2855 unsigned EndOfLine = 0;
2857 if (Comma == StringRef::npos ||
2858 Value.substr(0, Comma).getAsInteger(10, Bytes) ||
2859 Value.substr(Comma + 1).getAsInteger(10, EndOfLine))
2860 Diags.
Report(diag::err_drv_preamble_format);
2868 if (
const Arg *A = Args.getLastArg(OPT_fcf_protection_EQ)) {
2869 StringRef Name = A->getValue();
2870 if (Name ==
"branch")
2872 else if (Name ==
"return")
2874 else if (Name ==
"full")
2879 for (
const auto *A : Args.filtered(OPT_D, OPT_U)) {
2880 if (A->getOption().matches(OPT_D))
2889 for (
const auto *A : Args.filtered(OPT_include))
2890 Opts.
Includes.emplace_back(A->getValue());
2892 for (
const auto *A : Args.filtered(OPT_chain_include))
2895 for (
const auto *A : Args.filtered(OPT_remap_file)) {
2896 std::pair<StringRef, StringRef> Split = StringRef(A->getValue()).split(
';');
2898 if (Split.second.empty()) {
2899 Diags.
Report(diag::err_drv_invalid_remap_file) << A->getAsString(Args);
2906 if (Arg *A = Args.getLastArg(OPT_fobjc_arc_cxxlib_EQ)) {
2907 StringRef Name = A->getValue();
2908 unsigned Library = llvm::StringSwitch<unsigned>(Name)
2914 Diags.
Report(diag::err_drv_invalid_value) << A->getAsString(Args) << Name;
2930 Opts.
ShowCPP = !Args.hasArg(OPT_dM);
2937 Opts.
ShowMacros = Args.hasArg(OPT_dM) || Args.hasArg(OPT_dD);
2946 Opts.
ABI = Args.getLastArgValue(OPT_target_abi);
2947 if (Arg *A = Args.getLastArg(OPT_meabi)) {
2948 StringRef
Value = A->getValue();
2949 llvm::EABI EABIVersion = llvm::StringSwitch<llvm::EABI>(
Value)
2950 .Case(
"default", llvm::EABI::Default)
2951 .Case(
"4", llvm::EABI::EABI4)
2952 .Case(
"5", llvm::EABI::EABI5)
2953 .Case(
"gnu", llvm::EABI::GNU)
2956 Diags.
Report(diag::err_drv_invalid_value) << A->getAsString(Args)
2961 Opts.
CPU = Args.getLastArgValue(OPT_target_cpu);
2962 Opts.
FPMath = Args.getLastArgValue(OPT_mfpmath);
2964 Opts.
LinkerVersion = Args.getLastArgValue(OPT_target_linker_version);
2965 Opts.
Triple = Args.getLastArgValue(OPT_triple);
2968 Opts.
Triple = llvm::sys::getDefaultTargetTriple();
2973 options::OPT_fcuda_short_ptr, options::OPT_fno_cuda_short_ptr,
false);
2977 const char *
const *ArgBegin,
2978 const char *
const *ArgEnd,
2980 bool Success =
true;
2985 unsigned MissingArgIndex, MissingArgCount;
2987 Opts->ParseArgs(llvm::makeArrayRef(ArgBegin, ArgEnd), MissingArgIndex,
2988 MissingArgCount, IncludedFlagsBitmask);
2992 if (MissingArgCount) {
2993 Diags.
Report(diag::err_drv_missing_argument)
2994 << Args.getArgString(MissingArgIndex) << MissingArgCount;
2999 for (
const auto *A : Args.filtered(OPT_UNKNOWN)) {
3000 auto ArgString = A->getAsString(Args);
3001 std::string Nearest;
3002 if (Opts->findNearest(ArgString, Nearest, IncludedFlagsBitmask) > 1)
3003 Diags.
Report(diag::err_drv_unknown_argument) << ArgString;
3005 Diags.
Report(diag::err_drv_unknown_argument_with_suggestion)
3006 << ArgString << Nearest;
3031 if (Args.hasArg(OPT_fobjc_arc))
3032 LangOpts.ObjCAutoRefCount = 1;
3036 LangOpts.PIE = Args.hasArg(OPT_pic_is_pie);
3045 LangOpts.ObjCExceptions = 1;
3048 LangOpts.FunctionAlignment =
3051 if (LangOpts.CUDA) {
3054 if (LangOpts.CUDAIsDevice)
3059 if (LangOpts.OpenMPIsDevice)
3076 auto Arch = T.getArch();
3077 if (Arch == llvm::Triple::spir || Arch == llvm::Triple::spir64) {
3085 Diags.Report(diag::warn_drv_fine_grained_bitfield_accesses_ignored);
3093 using llvm::hash_code;
3094 using llvm::hash_value;
3103 #define LANGOPT(Name, Bits, Default, Description) \ 3104 code = hash_combine(code, LangOpts->Name); 3105 #define ENUM_LANGOPT(Name, Type, Bits, Default, Description) \ 3106 code = hash_combine(code, static_cast<unsigned>(LangOpts->get##Name())); 3107 #define BENIGN_LANGOPT(Name, Bits, Default, Description) 3108 #define BENIGN_ENUM_LANGOPT(Name, Type, Bits, Default, Description) 3109 #include "clang/Basic/LangOptions.def" 3111 for (StringRef Feature :
LangOpts->ModuleFeatures)
3117 for (
const auto &FeatureAsWritten :
TargetOpts->FeaturesAsWritten)
3130 StringRef MacroDef = I.first;
3132 llvm::CachedHashString(MacroDef.split(
'=').first)))
3156 code = ext->hashExtension(code);
3163 if (!SanHash.
empty())
3166 return llvm::APInt(64, code).toString(36,
false);
3169 template<
typename IntTy>
3174 if (Arg *A = Args.getLastArg(Id)) {
3175 if (StringRef(A->getValue()).getAsInteger(10, Res)) {
3177 Diags->
Report(diag::err_drv_invalid_int_value) << A->getAsString(Args)
3189 return getLastArgIntValueImpl<int>(Args,
Id,
Default, Diags);
3195 return getLastArgIntValueImpl<uint64_t>(Args,
Id,
Default, Diags);
3204 static const size_t kGraveYardMaxSize = 16;
3205 LLVM_ATTRIBUTE_UNUSED
static const void *GraveYard[kGraveYardMaxSize];
3206 static std::atomic<unsigned> GraveYardSize;
3207 unsigned Idx = GraveYardSize++;
3208 if (Idx >= kGraveYardMaxSize)
3210 GraveYard[Idx] = Ptr;
3230 llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>> Buffer =
3231 BaseFS->getBufferForFile(File);
3233 Diags.
Report(diag::err_missing_vfs_overlay_file) << File;
3238 std::move(Buffer.get()),
nullptr, File);
3240 Overlay->pushOverlay(FS);
3242 Diags.
Report(diag::err_invalid_vfs_overlay) << File;
HeaderSearchOptions & getHeaderSearchOpts()
static Visibility parseVisibility(Arg *arg, ArgList &args, DiagnosticsEngine &diags)
Attempt to parse a visibility value out of the given argument.
std::string CoverageNotesFile
The filename with path we use for coverage notes files.
Expand macros but not #includes.
std::string ProfileInstrumentUsePath
Name of the profile file to use as input for -fprofile-instr-use.
std::string OutputFile
The output file, if any.
bool ParseDiagnosticArgs(DiagnosticOptions &Opts, llvm::opt::ArgList &Args, DiagnosticsEngine *Diags=nullptr, bool DefaultDiagColor=true, bool DefaultShowOpt=true)
Fill out Opts based on the options given in Args.
static void ParseFileSystemArgs(FileSystemOptions &Opts, ArgList &Args)
unsigned NoFinalizeRemoval
static DiagnosticBuilder Diag(DiagnosticsEngine *Diags, const LangOptions &Features, FullSourceLoc TokLoc, const char *TokBegin, const char *TokRangeBegin, const char *TokRangeEnd, unsigned DiagID)
Produce a diagnostic highlighting some portion of a literal.
static void ParseCommentArgs(CommentOptions &Opts, ArgList &Args)
Conform to the underlying platform's C and C++ ABIs as closely as we can.
unsigned InlineMaxStackDepth
The inlining stack depth limit.
Paths for '#include <>' added by '-I'.
std::string ModuleDependencyOutputDir
The directory to copy module dependencies to when collecting them.
std::string ObjCMTWhiteListPath
std::string DwarfDebugFlags
The string to embed in the debug information for the compile unit, if non-empty.
if(T->getSizeExpr()) TRY_TO(TraverseStmt(T -> getSizeExpr()))
std::string DOTOutputFile
The file to write GraphViz-formatted header dependencies to.
void addMacroUndef(StringRef Name)
Enable migration to modern ObjC readonly property.
static InputKind ParseFrontendArgs(FrontendOptions &Opts, ArgList &Args, DiagnosticsEngine &Diags, bool &IsHeaderFile)
Generate pre-compiled module from a module map.
Attempt to be ABI-compatible with code generated by Clang 6.0.x (SVN r321711).
unsigned IncludeBriefComments
Show brief documentation comments in code completion results.
static void ParseLangArgs(LangOptions &Opts, ArgList &Args, InputKind IK, const TargetOptions &TargetOpts, PreprocessorOptions &PPOpts, DiagnosticsEngine &Diags)
std::string SaveTempsFilePrefix
Prefix to use for -save-temps output.
TargetOptions & getTargetOpts()
Parse and perform semantic analysis.
Enable migration to add conforming protocols.
ObjCXXARCStandardLibraryKind
Enumerate the kinds of standard library that.
static StringRef getCodeModel(ArgList &Args, DiagnosticsEngine &Diags)
unsigned IncludeGlobals
Show top-level decls in code completion results.
SanitizerSet Sanitize
Set of enabled sanitizers.
Like System, but headers are implicitly wrapped in extern "C".
DependencyOutputOptions & getDependencyOutputOpts()
std::shared_ptr< HeaderSearchOptions > HeaderSearchOpts
Options controlling the #include directive.
IntrusiveRefCntPtr< FileSystem > getRealFileSystem()
Gets an vfs::FileSystem for the 'real' file system, as seen by the operating system.
std::shared_ptr< llvm::Regex > OptimizationRemarkMissedPattern
Regular expression to select optimizations for which we should enable missed optimization remarks...
static unsigned getOptimizationLevel(ArgList &Args, InputKind IK, DiagnosticsEngine &Diags)
LangStandard - Information about the properties of a particular language standard.
static bool isBuiltinFunc(const char *Name)
Returns true if this is a libc/libm function without the '__builtin_' prefix.
unsigned IncludeModuleFiles
Include module file dependencies.
void set(XRayInstrMask K, bool Value)
Parse ASTs and print them.
bool hasDigraphs() const
hasDigraphs - Language supports digraphs.
Like System, but only used for C++.
std::string HeaderIncludeOutputFile
The file to write header include output to.
std::vector< std::string > Includes
static bool parseDiagnosticLevelMask(StringRef FlagName, const std::vector< std::string > &Levels, DiagnosticsEngine *Diags, DiagnosticLevelMask &M)
std::string FPDenormalMode
The floating-point denormal mode to use.
Defines types useful for describing an Objective-C runtime.
unsigned visualizeExplodedGraphWithGraphViz
std::string SampleProfileFile
Name of the profile file to use with -fprofile-sample-use.
Like System, but only used for ObjC++.
DiagnosticBuilder Report(SourceLocation Loc, unsigned DiagID)
Issue the message to the client.
static bool CreateFromArgs(CompilerInvocation &Res, const char *const *ArgBegin, const char *const *ArgEnd, DiagnosticsEngine &Diags)
Create a compiler invocation from a list of input options.
#define ANALYSIS_STORE(NAME, CMDFLAG, DESC, CREATFN)
std::shared_ptr< LangOptions > LangOpts
Options controlling the language variant.
PreprocessorOptions - This class is used for passing the various options used in preprocessor initial...
std::vector< std::string > Reciprocals
std::vector< std::string > RewriteMapFiles
Set of files defining the rules for the symbol rewriting.
static const LangStandard & getLangStandardForKind(Kind K)
InputKind::Language getLanguage() const
Get the language that this standard describes.
std::string ASTDumpFilter
If given, filter dumped AST Decl nodes by this substring.
Enable inferring NS_DESIGNATED_INITIALIZER for ObjC methods.
Objects with "hidden" visibility are not seen by the dynamic linker.
static void ParseHeaderSearchArgs(HeaderSearchOptions &Opts, ArgList &Args, const std::string &WorkingDir)
std::string ImplicitPTHInclude
The implicit PTH input included at the start of the translation unit, or empty.
Options for controlling the target.
bool PropagateAttrs
If true, we set attributes functions in the bitcode library according to our CodeGenOptions, much as we set attrs on functions that we generate ourselves.
void addRemappedFile(StringRef From, StringRef To)
std::string FixItSuffix
If given, the new suffix for fix-it rewritten files.
std::string HostTriple
When compiling for the device side, contains the triple used to compile for the host.
std::string SplitDwarfFile
The name for the split debug info file that we'll break out.
Like System, but searched after the system directories.
std::string DebugPass
Enable additional debugging information.
float __ovld __cnfn normalize(float p)
Returns a vector in the same direction as p but with a length of 1.
SanitizerSet SanitizeRecover
Set of sanitizer checks that are non-fatal (i.e.
Parse and apply any fixits to the source.
Defines the clang::SanitizerKind enum.
static void setPGOInstrumentor(CodeGenOptions &Opts, ArgList &Args, DiagnosticsEngine &Diags)
'macosx-fragile' is the Apple-provided NeXT-derived runtime on Mac OS X platforms that use the fragil...
std::map< std::string, std::string > DebugPrefixMap
std::vector< std::string > XRayAlwaysInstrumentFiles
Paths to the XRay "always instrument" files specifying which objects (files, functions, variables) should be imbued with the XRay "always instrument" attribute.
bool isCPlusPlus14() const
isCPlusPlus14 - Language is a C++14 variant (or later).
std::string FPMath
If given, the unit to use for floating point math.
static std::shared_ptr< llvm::Regex > GenerateOptimizationRemarkRegex(DiagnosticsEngine &Diags, ArgList &Args, Arg *RpassArg)
Create a new Regex instance out of the string value in RpassArg.
LLVM_READONLY bool isLetter(unsigned char c)
Return true if this character is an ASCII letter: [a-zA-Z].
unsigned IncludeSystemHeaders
Include system header dependencies.
ShowIncludesDestination ShowIncludesDest
Destination of cl.exe style /showIncludes info.
IntrusiveRefCntPtr< FileSystem > getVFSFromYAML(std::unique_ptr< llvm::MemoryBuffer > Buffer, llvm::SourceMgr::DiagHandlerTy DiagHandler, StringRef YAMLFilePath, void *DiagContext=nullptr, IntrusiveRefCntPtr< FileSystem > ExternalFS=getRealFileSystem())
Gets a FileSystem for a virtual file system described in YAML format.
Translate input source into HTML.
static bool ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, InputKind IK, DiagnosticsEngine &Diags, const TargetOptions &TargetOpts, const FrontendOptions &FrontendOpts)
SanitizerMask Mask
Bitmask of enabled sanitizers.
Enable migration to modern ObjC literals.
std::vector< uint8_t > CmdArgs
List of backend command-line options for -fembed-bitcode.
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
unsigned eagerlyAssumeBinOpBifurcation
The flag regulates if we should eagerly assume evaluations of conditionals, thus, bifurcating the pat...
std::vector< std::string > ASTMergeFiles
The list of AST files to merge.
std::string CodeModel
The code model to use (-mcmodel).
Print DeclContext and their Decls.
std::vector< std::string > ModulesEmbedFiles
The list of files to embed into the compiled module file.
unsigned RelocatablePCH
When generating PCH files, instruct the AST writer to create relocatable PCH files.
Objects with "default" visibility are seen by the dynamic linker and act like normal objects...
std::shared_ptr< PreprocessorOptions > PreprocessorOpts
Options controlling the preprocessor (aside from #include handling).
unsigned IncludeCodePatterns
Show code patterns in code completion results.
Action - Represent an abstract compilation step to perform.
A file system that allows overlaying one AbstractFileSystem on top of another.
Generate LLVM IR, but do not emit anything.
static bool ParseAnalyzerArgs(AnalyzerOptions &Opts, ArgList &Args, DiagnosticsEngine &Diags)
Enable annotation of ObjCMethods of all kinds.
std::vector< std::string > XRayAttrListFiles
Paths to the XRay attribute list files, specifying which objects (files, functions, variables) should be imbued with the appropriate XRay attribute(s).
CodeGenOptions & getCodeGenOpts()
bool hasLineComments() const
Language supports '//' comments.
unsigned ShowStats
Show frontend performance metrics and statistics.
Enable migration to modern ObjC readwrite property.
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified...
static void ParseDependencyOutputArgs(DependencyOutputOptions &Opts, ArgList &Args)
static void ParseTargetArgs(TargetOptions &Opts, ArgList &Args, DiagnosticsEngine &Diags)
Visibility
Describes the different kinds of visibility that a declaration may have.
bool isOpenCL() const
isOpenCL - Language is a OpenCL variant.
bool isCPlusPlus2a() const
isCPlusPlus2a - Language is a post-C++17 variant (or later).
Concrete class used by the front-end to report problems and issues.
unsigned FixWhatYouCan
Apply fixes even if there are unfixable errors.
annotate property with NS_RETURNS_INNER_POINTER
Enable migration to NS_ENUM/NS_OPTIONS macros.
Defines the Diagnostic-related interfaces.
std::unique_ptr< llvm::opt::OptTable > createDriverOptTable()
std::string FullCompilerInvocation
Store full compiler invocation for reproducible instructions in the generated report.
std::vector< std::string > Warnings
The list of -W...
std::vector< std::pair< std::string, bool > > CheckersControlList
Pair of checker name and enable/disable.
AnalysisStores
AnalysisStores - Set of available analysis store models.
constexpr XRayInstrMask All
bool isCPlusPlus() const
isCPlusPlus - Language is a C++ variant.
bool DisablePCHValidation
When true, disables most of the normal validation performed on precompiled headers.
VersionTuple getOpenCLVersionTuple() const
Return the OpenCL C or C++ version as a VersionTuple.
static void setPGOUseInstrumentor(CodeGenOptions &Opts, const Twine &ProfileName)
unsigned FixAndRecompile
Apply fixes and recompile.
Defines the clang::Visibility enumeration and various utility functions.
std::string FloatABI
The ABI to use for passing floating point arguments.
std::vector< std::string > ModuleFeatures
The names of any features to enable in module 'requires' decls in addition to the hard-coded list in ...
PreprocessorOutputOptions & getPreprocessorOutputOpts()
std::string ThreadModel
The thread model to use.
FrontendOptions & getFrontendOpts()
std::vector< std::string > DependentLibraries
A list of dependent libraries.
bool DetailedRecord
Whether we should maintain a detailed record of all macro definitions and expansions.
Dump the compiler configuration.
MigratorOptions & getMigratorOpts()
Dump template instantiations.
char CoverageVersion[4]
The version string to put into coverage files.
Dump out preprocessed tokens.
std::string CurrentModule
The name of the current module, of which the main source file is a part.
const char * getName() const
getName - Get the name of this standard.
AnalysisDiagClients AnalysisDiagOpt
std::vector< std::string > NoBuiltinFuncs
A list of all -fno-builtin-* function names (e.g., memset).
std::vector< std::string > ChainedIncludes
Headers that will be converted to chained PCHs in memory.
PreprocessorOutputOptions - Options for controlling the C preprocessor output (e.g., -E).
static bool IsHeaderFile(const std::string &Filename)
std::string LimitFloatPrecision
The float precision limit to use, if non-empty.
unsigned ASTDumpAll
Whether we deserialize all decls when forming AST dumps.
Generate pre-compiled module from a C++ module interface file.
for(unsigned I=0, E=TL.getNumArgs();I !=E;++I)
uint64_t getLastArgUInt64Value(const llvm::opt::ArgList &Args, llvm::opt::OptSpecifier Id, uint64_t Default, DiagnosticsEngine *Diags=nullptr)
#define LANGSTANDARD(id, name, lang, desc, features)
static void setLangDefaults(LangOptions &Opts, InputKind IK, const llvm::Triple &T, PreprocessorOptions &PPOpts, LangStandard::Kind LangStd=LangStandard::lang_unspecified)
Set language defaults for the given input language and language standard in the given LangOptions obj...
AnalysisInliningMode InliningMode
The mode of function selection used during inlining.
CommentOptions CommentOpts
Options for parsing comments.
static std::string GetResourcesPath(const char *Argv0, void *MainAddr)
Get the directory where the compiler headers reside, relative to the compiler binary (found by the pa...
bool isCPlusPlus11() const
isCPlusPlus11 - Language is a C++11 variant (or later).
Defines the clang::LangOptions interface.
Enable migration to modern ObjC subscripting.
std::vector< std::string > Plugins
The list of plugins to load.
Show just the "best" overload candidates.
IncludeDirGroup
IncludeDirGroup - Identifies the group an include Entry belongs to, representing its relative positiv...
Emit only debug info necessary for generating line number tables (-gline-tables-only).
static IntTy getLastArgIntValueImpl(const ArgList &Args, OptSpecifier Id, IntTy Default, DiagnosticsEngine *Diags)
unsigned ShowEnabledCheckerList
std::string WorkingDir
If set, paths are resolved as if the working directory was set to the value of WorkingDir.
std::string OMPHostIRFile
Name of the IR file that contains the result of the OpenMP target host code generation.
std::set< std::string > DeserializedPCHDeclsToErrorOn
This is a set of names for decls that we do not want to be deserialized, and we emit an error if they...
unsigned RewriteIncludes
Preprocess include directives only.
unsigned ShowTimers
Show timers for individual actions.
std::string LinkerVersion
If given, the version string of the linker in use.
Only execute frontend initialization.
Defines version macros and version-related utility functions for Clang.
unsigned IncludeNamespaceLevelDecls
Show decls in namespace (including the global namespace) in code completion results.
Print the "preamble" of the input file.
unsigned LinkFlags
Bitwise combination of llvm::Linker::Flags, passed to the LLVM linker.
IntrusiveRefCntPtr< vfs::FileSystem > createVFSFromCompilerInvocation(const CompilerInvocation &CI, DiagnosticsEngine &Diags)
static llvm::Reloc::Model getRelocModel(ArgList &Args, DiagnosticsEngine &Diags)
bool tryParse(StringRef input)
Try to parse an Objective-C runtime specification from the given string.
unsigned ShowHeaderIncludes
Show header inclusions (-H).
std::shared_ptr< llvm::Regex > OptimizationRemarkPattern
Regular expression to select optimizations for which we should enable optimization remarks...
bool hasImplicitInt() const
hasImplicitInt - Language allows variables to be typed as int implicitly.
LLVM_READONLY bool isAlphanumeric(unsigned char c)
Return true if this character is an ASCII letter or digit: [a-zA-Z0-9].
static bool IsInputCompatibleWithStandard(InputKind IK, const LangStandard &S)
Check if input file kind and language standard are compatible.
void clear(SanitizerMask K=SanitizerKind::All)
Disable the sanitizers specified in K.
unsigned ModulesEmbedAllFiles
Whether we should embed all used files into the PCM file.
AnalysisInliningMode
AnalysisInlineFunctionSelection - Set of inlining function selection heuristics.
Objects with "protected" visibility are seen by the dynamic linker but always dynamically resolve to ...
unsigned ShowMacros
Print macro definitions.
clang::ObjCRuntime ObjCRuntime
static void ParsePreprocessorOutputArgs(PreprocessorOutputOptions &Opts, ArgList &Args, frontend::ActionKind Action)
static void ParsePreprocessorArgs(PreprocessorOptions &Opts, ArgList &Args, DiagnosticsEngine &Diags, frontend::ActionKind Action)
unsigned FixOnlyWarnings
Apply fixes only for warnings.
unsigned NoNSAllocReallocError
bool ForceEnableInt128
If given, enables support for __int128_t and __uint128_t types.
Attempt to be ABI-compatible with code generated by Clang 3.8.x (SVN r257626).
static void addDiagnosticArgs(ArgList &Args, OptSpecifier Group, OptSpecifier GroupWithValue, std::vector< std::string > &Diagnostics)
std::string AuxTriple
Auxiliary triple for CUDA compilation.
bool isC11() const
isC11 - Language is a superset of C11.
Defines the clang::XRayInstrKind enum.
bool AllowPCHWithCompilerErrors
When true, a PCH with compiler errors will not be rejected.
std::string CPU
If given, the name of the target CPU to generate code for.
bool hasHexFloats() const
hasHexFloats - Language supports hexadecimal float constants.
unsigned ShowIncludeDirectives
Print includes, imports etc. within preprocessed output.
SanitizerMask getPPTransparentSanitizers()
Return the sanitizers which do not affect preprocessing.
std::string Filename
The filename of the bitcode file to link in.
unsigned ARCMTMigrateEmitARCErrors
Emit ARC errors even if the migrator can fix them.
void set(SanitizerMask K, bool Value)
Enable or disable a certain (single) sanitizer.
std::string ABI
If given, the name of the target ABI to use.
AnalysisConstraints
AnalysisConstraints - Set of available constraint models.
AnalyzerOptionsRef getAnalyzerOpts() const
AnalysisStores AnalysisStoreOpt
Encodes a location in the source.
Generate machine code, but don't emit anything.
std::vector< std::string > ModuleFiles
The list of additional prebuilt module files to load before processing the input. ...
ParsedSourceLocation CodeCompletionAt
If given, enable code completion at the provided location.
std::string ImplicitPCHInclude
The implicit PCH included at the start of the translation unit, or empty.
Limit generated debug info to reduce size (-fno-standalone-debug).
Options for controlling the compiler diagnostics engine.
std::vector< FrontendInputFile > Inputs
The input files and their types.
Attempt to be ABI-compatible with code generated by Clang 4.0.x (SVN r291814).
ConfigTable Config
A key-value table of use-specified configuration values.
std::string DiagnosticSerializationFile
The file to serialize diagnostics to (non-appending).
#define ANALYSIS_CONSTRAINTS(NAME, CMDFLAG, DESC, CREATFN)
unsigned IncludeTimestamps
Whether timestamps should be written to the produced PCH file.
Parse ASTs and view them in Graphviz.
std::vector< std::string > Remarks
The list of -R...
std::vector< std::string > OpenCLExtensionsAsWritten
The list of OpenCL extensions to enable or disable, as written on the command line.
unsigned visualizeExplodedGraphWithUbiGraph
Parse ASTs and list Decl nodes.
std::string getClangFullRepositoryVersion()
Retrieves the full repository version that is an amalgamation of the information in getClangRepositor...
static void getAllNoBuiltinFuncValues(ArgList &Args, std::vector< std::string > &Funcs)
Defines the clang::TargetOptions class.
std::unordered_map< std::string, std::vector< std::string > > PluginArgs
Args to pass to the plugins.
DiagnosticOptions & getDiagnosticOpts() const
DependencyOutputOptions - Options for controlling the compiler dependency file generation.
unsigned ASTDumpLookups
Whether we include lookup table dumps in AST dumps.
std::vector< std::string > ExtraDeps
A list of filenames to be used as extra dependencies for every target.
Load and verify that a PCH file is usable.
std::shared_ptr< TargetOptions > TargetOpts
Options controlling the target.
std::string ModuleName
The module currently being compiled as speficied by -fmodule-name.
SanitizerSet SanitizeTrap
Set of sanitizer checks that trap rather than diagnose.
unsigned UseLineDirectives
Use #line instead of GCC-style # N.
Like System, but only used for ObjC.
unsigned ShowVersion
Show the -version text.
unsigned RewriteImports
Include contents of transitively-imported modules.
std::shared_ptr< llvm::Regex > OptimizationRemarkAnalysisPattern
Regular expression to select optimizations for which we should enable optimization analyses...
std::vector< std::string > FeaturesAsWritten
The list of target specific features to enable or disable, as written on the command line...
XRayInstrSet XRayInstrumentationBundle
Set of XRay instrumentation kinds to emit.
std::vector< BitcodeFileToLink > LinkBitcodeFiles
The files specified here are linked in to the module before optimizations.
constexpr XRayInstrMask None
PragmaMSPointersToMembersKind
unsigned GenerateGlobalModuleIndex
Whether we can generate the global module index if needed.
__DEVICE__ void * memcpy(void *__a, const void *__b, size_t __c)
std::string PCHThroughHeader
If non-empty, the filename used in an #include directive in the primary source file (or command-line ...
static const StringRef GetInputKindName(InputKind IK)
Get language name for given input kind.
void addMacroDef(StringRef Name)
llvm::EABI EABIVersion
The EABI version to use.
'#include ""' paths, added by 'gcc -iquote'.
std::string ThinLTOIndexFile
Name of the function summary index file to use for ThinLTO function importing.
std::vector< std::string > MacroIncludes
unsigned ShowHelp
Show the -help text.
std::string OverrideRecordLayoutsFile
File name of the file that will provide record layouts (in the format produced by -fdump-record-layou...
unsigned FixToTemporaries
Apply fixes to temporary files.
unsigned ShowComments
Show comments.
Like Angled, but marks system directories.
static bool parseTestModuleFileExtensionArg(StringRef Arg, std::string &BlockName, unsigned &MajorVersion, unsigned &MinorVersion, bool &Hashed, std::string &UserInfo)
Parse the argument to the -ftest-module-file-extension command-line argument.
unsigned maxBlockVisitOnPath
The maximum number of times the analyzer visits a block.
unsigned DisableAllChecks
Disable all analyzer checks.
std::string OutputFile
The file to write dependency output to.
bool allowsARC() const
Does this runtime allow ARC at all?
DependencyOutputFormat OutputFormat
The format for the dependency file.
std::string CudaGpuBinaryFileName
Name of file passed with -fcuda-include-gpubinary option to forward to CUDA runtime back-end for inco...
Dataflow Directional Tag Classes.
std::string OverflowHandler
The name of the handler function to be called when -ftrapv is specified.
static ParsedSourceLocation FromString(StringRef Str)
Construct a parsed source location from a string; the Filename is empty on error. ...
PreprocessorOptions & getPreprocessorOpts()
bool UsePredefines
Initialize the preprocessor with the compiler and target specific predefines.
frontend::ActionKind ProgramAction
The frontend action to perform.
std::vector< llvm::Triple > OMPTargetTriples
Triples of the OpenMP targets that the host code codegen should take into account in order to generat...
std::vector< std::string > VerifyPrefixes
The prefixes for comment directives sought by -verify ("expected" by default).
std::string ARCMTMigrateReportOut
std::string PreferVectorWidth
The preferred width for auto-vectorization transforms.
Emit location information but do not generate debug info in the output.
std::unique_ptr< DiagnosticConsumer > create(StringRef OutputFile, DiagnosticOptions *Diags, bool MergeChildRecords=false)
Returns a DiagnosticConsumer that serializes diagnostics to a bitcode file.
Like System, but only used for C.
bool empty() const
Returns true if at least one sanitizer is enabled.
unsigned UseGlobalModuleIndex
Whether we can use the global module index if available.
AnalysisConstraints AnalysisConstraintsOpt
llvm::Reloc::Model RelocationModel
The name of the relocation model to use.
static bool isStrictlyPreprocessorAction(frontend::ActionKind Action)
Helper class for holding the data necessary to invoke the compiler.
Defines the virtual file system interface vfs::FileSystem.
std::string DebugCompilationDir
The string to embed in debug information as the current working directory.
unsigned UsePhonyTargets
Include phony targets for each dependency, which can avoid some 'make' problems.
std::string AnalyzeSpecificFunction
bool IsHeaderFile
Indicates whether the front-end is explicitly told that the input is a header file (i...
FrontendOptions - Options for controlling the behavior of the frontend.
bool isC17() const
isC17 - Language is a superset of C17.
static bool ParseMigratorArgs(MigratorOptions &Opts, ArgList &Args)
SanitizerMask parseSanitizerValue(StringRef Value, bool AllowGroups)
Parse a single value from a -fsanitize= or -fno-sanitize= value list.
bool isGNUMode() const
isGNUMode - Language includes GNU extensions.
std::string StatsFile
Filename to write statistics to.
void BuryPointer(const void *Ptr)
Parse ASTs and dump them.
Don't generate debug info.
Enable migration of ObjC methods to 'instancetype'.
std::string CoverageDataFile
The filename with path we use for coverage data files.
Defines the clang::FileSystemOptions interface.
std::vector< std::string > LinkerOptions
A list of linker options to embed in the object file.
CodeGenOptions - Track various options which control how the code is optimized and passed to the back...
std::vector< std::shared_ptr< ModuleFileExtension > > ModuleFileExtensions
The list of module file extensions.
CodeCompleteOptions CodeCompleteOpts
static bool parseShowColorsArgs(const ArgList &Args, bool DefaultColor)
IntrusiveRefCntPtr< DiagnosticOptions > DiagnosticOpts
Options controlling the diagnostic engine.
std::vector< std::string > AddPluginActions
The list of plugin actions to run in addition to the normal action.
ObjCXXARCStandardLibraryKind ObjCXXARCStandardLibrary
The Objective-C++ ARC standard library that we should support, by providing appropriate definitions t...
AnalysisPurgeMode
AnalysisPurgeModes - Set of available strategies for dead symbol removal.
unsigned AnalyzerDisplayProgress
~CompilerInvocationBase()
Keeps track of options that affect how file operations are performed.
prefer 'atomic' property over 'nonatomic'.
unsigned DisableFree
Disable memory freeing on exit.
Generate pre-compiled header.
int getLastArgIntValue(const llvm::opt::ArgList &Args, llvm::opt::OptSpecifier Id, int Default, DiagnosticsEngine *Diags=nullptr)
Return the value of the last argument as an integer, or a default.
enum clang::FrontendOptions::@169 ARCMTAction
X
Add a minimal nested name specifier fixit hint to allow lookup of a tag name from an outer enclosing ...
unsigned ShowMacroComments
Show comments, even in macros.
Defines the clang::SourceLocation class and associated facilities.
unsigned AnalyzeNestedBlocks
unsigned NoRetryExhausted
Do not re-analyze paths leading to exhausted nodes with a different strategy.
bool Internalize
If true, we use LLVM module internalizer.
std::vector< std::string > XRayNeverInstrumentFiles
Paths to the XRay "never instrument" files specifying which objects (files, functions, variables) should be imbued with the XRay "never instrument" attribute.
bool NVPTXUseShortPointers
If enabled, use 32-bit pointers for accessing const/local/shared address space.
std::string MainFileName
The user provided name for the "main file", if non-empty.
std::vector< std::string > NoBuiltinFuncs
A list of all -fno-builtin-* function names (e.g., memset).
static bool checkVerifyPrefixes(const std::vector< std::string > &VerifyPrefixes, DiagnosticsEngine *Diags)
XRayInstrMask parseXRayInstrValue(StringRef Value)
bool isC99() const
isC99 - Language is a superset of C99.
unsigned IncludeFixIts
Include results after corrections (small fix-its), e.g.
unsigned ASTDumpDecls
Whether we include declaration dumps in AST dumps.
Enable converting setter/getter expressions to property-dot syntx.
Enable migration to modern ObjC property.
std::string ActionName
The name of the action to run when using a plugin action.
unsigned ShowLineMarkers
Show #line markers.
bool isCPlusPlus17() const
isCPlusPlus17 - Language is a C++17 variant (or later).
FileSystemOptions & getFileSystemOpts()
static unsigned getOptimizationLevelSize(ArgList &Args)
Run one or more source code analyses.
bool has(SanitizerMask K) const
Check if a certain (single) sanitizer is enabled.
std::pair< unsigned, bool > PrecompiledPreambleBytes
If non-zero, the implicit PCH include is actually a precompiled preamble that covers this number of b...
#define ANALYSIS_DIAGNOSTICS(NAME, CMDFLAG, DESC, CREATFN)
std::vector< std::string > LLVMArgs
A list of arguments to forward to LLVM's option processing; this should only be used for debugging an...
std::vector< std::string > Targets
A list of names to use as the targets in the dependency file; this list must contain at least one ent...
std::string InstrProfileOutput
Name of the profile file to use as output for -fprofile-instr-generate and -fprofile-generate.
const char * getDescription() const
getDescription - Get the description of this standard.
std::string TrapFuncName
If not an empty string, trap intrinsics are lowered to calls to this function instead of to trap inst...
DiagnosticLevelMask
A bitmask representing the diagnostic levels used by VerifyDiagnosticConsumer.
Dump information about a module file.
std::string OptRecordFile
The name of the file to which the backend should save YAML optimization records.
unsigned AddMissingHeaderDeps
Add missing headers to dependency list.
std::string ThinLinkBitcodeFile
Name of a file that can optionally be written with minimized bitcode to be used as input for the Thin...
std::vector< std::string > SanitizerBlacklistFiles
Paths to blacklist files specifying which objects (files, functions, variables) should not be instrum...
unsigned ShowCPP
Print normal preprocessed output.
Like Angled, but marks header maps used when building frameworks.
Generate pre-tokenized header.
static InputKind getInputKindForExtension(StringRef Extension)
getInputKindForExtension - Return the appropriate input kind for a file extension.
std::string ObjCConstantStringClass
use NS_NONATOMIC_IOSONLY for property 'atomic' attribute
#define ANALYSIS_INLINING_MODE(NAME, CMDFLAG, DESC)
unsigned IncludeMacros
Show macros in code completion results.
AnalysisPurgeMode AnalysisPurgeOpt
LangOptions * getLangOpts()
static void parseXRayInstrumentationBundle(StringRef FlagName, StringRef Bundle, ArgList &Args, DiagnosticsEngine &D, XRayInstrSet &S)
bool DumpDeserializedPCHDecls
Dump declarations that are deserialized from PCH, for testing.
AnalysisDiagClients
AnalysisDiagClients - Set of available diagnostic clients for rendering analysis results.
std::string Triple
The name of the target triple to compile for.
#define ANALYSIS_PURGE(NAME, CMDFLAG, DESC)
Defines enum values for all the target-independent builtin functions.
std::string getModuleHash() const
Retrieve a module hash string that is suitable for uniquely identifying the conditions under which th...
static void parseSanitizerKinds(StringRef FlagName, const std::vector< std::string > &Sanitizers, DiagnosticsEngine &Diags, SanitizerSet &S)
bool allowsWeak() const
Does this runtime allow the use of __weak?
std::string DiagnosticLogFile
The file to log diagnostic output to.
std::string TokenCache
If given, a PTH cache file to use for speeding up header parsing.
bool LexEditorPlaceholders
When enabled, the preprocessor will construct editor placeholder tokens.
std::vector< std::string > ModuleMapFiles
The list of module map files to load before processing the input.