13 #include "clang/Config/config.h"
22 #include "llvm/ADT/Hashing.h"
23 #include "llvm/ADT/STLExtras.h"
24 #include "llvm/ADT/SmallVector.h"
25 #include "llvm/ADT/StringExtras.h"
26 #include "llvm/ADT/StringSwitch.h"
27 #include "llvm/ADT/Triple.h"
28 #include "llvm/Option/Arg.h"
29 #include "llvm/Option/ArgList.h"
30 #include "llvm/Option/OptTable.h"
31 #include "llvm/Option/Option.h"
32 #include "llvm/Support/CodeGen.h"
33 #include "llvm/Support/ErrorHandling.h"
34 #include "llvm/Support/FileSystem.h"
35 #include "llvm/Support/Host.h"
36 #include "llvm/Support/Path.h"
37 #include "llvm/Support/Process.h"
41 #include <system_error>
42 using namespace clang;
68 using namespace clang::driver;
69 using namespace clang::driver::options;
70 using namespace llvm::opt;
76 unsigned DefaultOpt = 0;
77 if (IK ==
IK_OpenCL && !Args.hasArg(OPT_cl_opt_disable))
80 if (Arg *A = Args.getLastArg(options::OPT_O_Group)) {
81 if (A->getOption().matches(options::OPT_O0))
84 if (A->getOption().matches(options::OPT_Ofast))
87 assert (A->getOption().matches(options::OPT_O));
89 StringRef
S(A->getValue());
90 if (
S ==
"s" ||
S ==
"z" ||
S.empty())
100 if (Arg *A = Args.getLastArg(options::OPT_O_Group)) {
101 if (A->getOption().matches(options::OPT_O)) {
102 switch (A->getValue()[0]) {
116 OptSpecifier GroupWithValue,
117 std::vector<std::string> &Diagnostics) {
118 for (Arg *A : Args.filtered(Group)) {
119 if (A->getOption().getKind() == Option::FlagClass) {
122 Diagnostics.push_back(A->getOption().getName().drop_front(1));
123 }
else if (A->getOption().matches(GroupWithValue)) {
125 Diagnostics.push_back(A->getOption().getName().drop_front(1).rtrim(
"=-"));
128 for (
const char *Arg : A->getValues())
129 Diagnostics.emplace_back(Arg);
136 using namespace options;
138 if (Arg *A = Args.getLastArg(OPT_analyzer_store)) {
139 StringRef Name = A->getValue();
142 .Case(CMDFLAG, NAME##Model)
143 #include "clang/StaticAnalyzer/Core/Analyses.def"
146 Diags.
Report(diag::err_drv_invalid_value)
147 << A->getAsString(Args) << Name;
154 if (Arg *A = Args.getLastArg(OPT_analyzer_constraints)) {
155 StringRef Name = A->getValue();
158 .Case(CMDFLAG, NAME##Model)
159 #include "clang/StaticAnalyzer/Core/Analyses.def"
162 Diags.
Report(diag::err_drv_invalid_value)
163 << A->getAsString(Args) << Name;
170 if (Arg *A = Args.getLastArg(OPT_analyzer_output)) {
171 StringRef Name = A->getValue();
174 .Case(CMDFLAG, PD_##NAME)
175 #include "clang/StaticAnalyzer/Core/Analyses.def"
178 Diags.
Report(diag::err_drv_invalid_value)
179 << A->getAsString(Args) << Name;
186 if (Arg *A = Args.getLastArg(OPT_analyzer_purge)) {
187 StringRef Name = A->getValue();
191 #include "clang/StaticAnalyzer/Core/Analyses.def"
194 Diags.
Report(diag::err_drv_invalid_value)
195 << A->getAsString(Args) << Name;
202 if (Arg *A = Args.getLastArg(OPT_analyzer_inlining_mode)) {
203 StringRef Name = A->getValue();
207 #include "clang/StaticAnalyzer/Core/Analyses.def"
210 Diags.
Report(diag::err_drv_invalid_value)
211 << A->getAsString(Args) << Name;
222 Args.hasArg(OPT_analyzer_viz_egraph_graphviz);
224 Args.hasArg(OPT_analyzer_viz_egraph_ubigraph);
226 Opts.
AnalyzeAll = Args.hasArg(OPT_analyzer_opt_analyze_headers);
229 Args.hasArg(OPT_analyzer_opt_analyze_nested_blocks);
233 Opts.
TrimGraph = Args.hasArg(OPT_trim_egraph);
236 Opts.
PrintStats = Args.hasArg(OPT_analyzer_stats);
243 Args.filtered(OPT_analyzer_checker, OPT_analyzer_disable_checker)) {
245 bool enable = (A->getOption().getID() == OPT_analyzer_checker);
248 StringRef checkerList = A->getValue();
250 checkerList.split(checkers,
",");
251 for (StringRef checker : checkers)
256 for (
const Arg *A : Args.filtered(OPT_analyzer_config)) {
260 StringRef configList = A->getValue();
262 configList.split(configVals,
",");
263 for (
unsigned i = 0, e = configVals.size(); i != e; ++i) {
265 std::tie(key, val) = configVals[i].split(
"=");
268 diag::err_analyzer_config_no_value) << configVals[i];
272 if (val.find(
'=') != StringRef::npos) {
274 diag::err_analyzer_config_multiple_values)
298 if (Arg *A = Args.getLastArg(OPT_mcode_model)) {
299 StringRef
Value = A->getValue();
300 if (Value ==
"small" || Value ==
"kernel" || Value ==
"medium" ||
303 Diags.
Report(diag::err_drv_invalid_value) << A->getAsString(Args) <<
Value;
310 static std::shared_ptr<llvm::Regex>
313 StringRef Val = RpassArg->getValue();
314 std::string RegexError;
315 std::shared_ptr<llvm::Regex> Pattern = std::make_shared<llvm::Regex>(Val);
316 if (!Pattern->isValid(RegexError)) {
317 Diags.
Report(diag::err_drv_optimization_remark_pattern)
318 << RegexError << RpassArg->getAsString(Args);
325 const std::vector<std::string> &Levels,
329 for (
const auto &
Level : Levels) {
331 llvm::StringSwitch<DiagnosticLevelMask>(
Level)
340 Diags->
Report(diag::err_drv_invalid_value) << FlagName <<
Level;
348 const std::vector<std::string> &Sanitizers,
350 for (
const auto &Sanitizer : Sanitizers) {
353 Diags.
Report(diag::err_drv_invalid_value) << FlagName << Sanitizer;
362 using namespace options;
367 unsigned MaxOptLevel = 3;
368 if (OptimizationLevel > MaxOptLevel) {
371 Diags.
Report(diag::warn_drv_optimization_value)
372 << Args.getLastArg(OPT_O)->getAsString(Args) <<
"-O" << MaxOptLevel;
373 OptimizationLevel = MaxOptLevel;
375 Opts.OptimizationLevel = OptimizationLevel;
382 Opts.NoInline = Args.hasArg(OPT_fno_inline);
383 Opts.setInlining(Args.hasArg(OPT_fno_inline_functions) ?
384 CodeGenOptions::OnlyAlwaysInlining : Opts.getInlining());
386 if (Arg *A = Args.getLastArg(OPT_fveclib)) {
387 StringRef Name = A->getValue();
388 if (Name ==
"Accelerate")
390 else if (Name ==
"none")
393 Diags.
Report(diag::err_drv_invalid_value) << A->getAsString(Args) << Name;
396 if (Args.hasArg(OPT_gline_tables_only)) {
398 }
else if (Args.hasArg(OPT_g_Flag) || Args.hasArg(OPT_gdwarf_2) ||
399 Args.hasArg(OPT_gdwarf_3) || Args.hasArg(OPT_gdwarf_4)) {
400 bool Default =
false;
403 if (llvm::Triple(TargetOpts.
Triple).isOSDarwin() ||
404 llvm::Triple(TargetOpts.
Triple).isOSFreeBSD())
407 if (Args.hasFlag(OPT_fstandalone_debug, OPT_fno_standalone_debug, Default))
412 Opts.DebugColumnInfo = Args.hasArg(OPT_dwarf_column_info);
414 if (Args.hasArg(OPT_gdwarf_2))
415 Opts.DwarfVersion = 2;
416 else if (Args.hasArg(OPT_gdwarf_3))
417 Opts.DwarfVersion = 3;
418 else if (Args.hasArg(OPT_gdwarf_4))
419 Opts.DwarfVersion = 4;
422 Opts.DwarfVersion = 4;
425 Args.getLastArg(OPT_emit_llvm_uselists, OPT_no_emit_llvm_uselists))
426 Opts.EmitLLVMUseLists = A->getOption().getID() == OPT_emit_llvm_uselists;
428 Opts.DisableLLVMOpts = Args.hasArg(OPT_disable_llvm_optzns);
429 Opts.DisableRedZone = Args.hasArg(OPT_disable_red_zone);
430 Opts.ForbidGuardVariables = Args.hasArg(OPT_fforbid_guard_variables);
431 Opts.UseRegisterSizedBitfieldAccess = Args.hasArg(
432 OPT_fuse_register_sized_bitfield_access);
433 Opts.RelaxedAliasing = Args.hasArg(OPT_relaxed_aliasing);
434 Opts.StructPathTBAA = !Args.hasArg(OPT_no_struct_path_tbaa);
436 Opts.MergeAllConstants = !Args.hasArg(OPT_fno_merge_all_constants);
437 Opts.NoCommon = Args.hasArg(OPT_fno_common);
438 Opts.NoImplicitFloat = Args.hasArg(OPT_no_implicit_float);
440 Opts.SimplifyLibCalls = !(Args.hasArg(OPT_fno_builtin) ||
441 Args.hasArg(OPT_ffreestanding));
443 Args.hasFlag(OPT_funroll_loops, OPT_fno_unroll_loops,
444 (Opts.OptimizationLevel > 1 && !Opts.OptimizeSize));
445 Opts.RerollLoops = Args.hasArg(OPT_freroll_loops);
447 Opts.DisableIntegratedAS = Args.hasArg(OPT_fno_integrated_as);
448 Opts.Autolink = !Args.hasArg(OPT_fno_autolink);
450 Opts.ProfileInstrGenerate = Args.hasArg(OPT_fprofile_instr_generate) ||
451 Args.hasArg(OPT_fprofile_instr_generate_EQ);
454 Opts.CoverageMapping = Args.hasArg(OPT_fcoverage_mapping);
455 Opts.DumpCoverageMapping = Args.hasArg(OPT_dump_coverage_mapping);
456 Opts.AsmVerbose = Args.hasArg(OPT_masm_verbose);
457 Opts.ObjCAutoRefCountExceptions = Args.hasArg(OPT_fobjc_arc_exceptions);
458 Opts.CXAAtExit = !Args.hasArg(OPT_fno_use_cxa_atexit);
459 Opts.CXXCtorDtorAliases = Args.hasArg(OPT_mconstructor_aliases);
461 Opts.
DebugPass = Args.getLastArgValue(OPT_mdebug_pass);
462 Opts.DisableFPElim = Args.hasArg(OPT_mdisable_fp_elim);
463 Opts.DisableFree = Args.hasArg(OPT_disable_free);
464 Opts.DisableTailCalls = Args.hasArg(OPT_mdisable_tail_calls);
465 Opts.
FloatABI = Args.getLastArgValue(OPT_mfloat_abi);
466 Opts.LessPreciseFPMAD = Args.hasArg(OPT_cl_mad_enable);
468 Opts.NoInfsFPMath = (Args.hasArg(OPT_menable_no_infinities) ||
469 Args.hasArg(OPT_cl_finite_math_only) ||
470 Args.hasArg(OPT_cl_fast_relaxed_math));
471 Opts.NoNaNsFPMath = (Args.hasArg(OPT_menable_no_nans) ||
472 Args.hasArg(OPT_cl_unsafe_math_optimizations) ||
473 Args.hasArg(OPT_cl_finite_math_only) ||
474 Args.hasArg(OPT_cl_fast_relaxed_math));
475 Opts.NoSignedZeros = Args.hasArg(OPT_fno_signed_zeros);
476 Opts.ReciprocalMath = Args.hasArg(OPT_freciprocal_math);
477 Opts.NoZeroInitializedInBSS = Args.hasArg(OPT_mno_zero_initialized_in_bss);
480 Opts.NoExecStack = Args.hasArg(OPT_mno_exec_stack);
481 Opts.FatalWarnings = Args.hasArg(OPT_massembler_fatal_warnings);
482 Opts.EnableSegmentedStacks = Args.hasArg(OPT_split_stacks);
483 Opts.RelaxAll = Args.hasArg(OPT_mrelax_all);
484 Opts.OmitLeafFramePointer = Args.hasArg(OPT_momit_leaf_frame_pointer);
485 Opts.SaveTempLabels = Args.hasArg(OPT_msave_temp_labels);
486 Opts.NoDwarfDirectoryAsm = Args.hasArg(OPT_fno_dwarf_directory_asm);
487 Opts.SoftFloat = Args.hasArg(OPT_msoft_float);
488 Opts.StrictEnums = Args.hasArg(OPT_fstrict_enums);
489 Opts.UnsafeFPMath = Args.hasArg(OPT_menable_unsafe_fp_math) ||
490 Args.hasArg(OPT_cl_unsafe_math_optimizations) ||
491 Args.hasArg(OPT_cl_fast_relaxed_math);
492 Opts.UnwindTables = Args.hasArg(OPT_munwind_tables);
493 Opts.
RelocationModel = Args.getLastArgValue(OPT_mrelocation_model,
"pic");
494 Opts.
ThreadModel = Args.getLastArgValue(OPT_mthread_model,
"posix");
496 Diags.
Report(diag::err_drv_invalid_value)
497 << Args.getLastArg(OPT_mthread_model)->getAsString(Args)
499 Opts.
TrapFuncName = Args.getLastArgValue(OPT_ftrap_function_EQ);
500 Opts.UseInitArray = Args.hasArg(OPT_fuse_init_array);
502 Opts.FunctionSections = Args.hasFlag(OPT_ffunction_sections,
503 OPT_fno_function_sections,
false);
504 Opts.DataSections = Args.hasFlag(OPT_fdata_sections,
505 OPT_fno_data_sections,
false);
506 Opts.UniqueSectionNames = Args.hasFlag(OPT_funique_section_names,
507 OPT_fno_unique_section_names,
true);
509 Opts.MergeFunctions = Args.hasArg(OPT_fmerge_functions);
511 Opts.PrepareForLTO = Args.hasArg(OPT_flto);
513 Opts.MSVolatile = Args.hasArg(OPT_fms_volatile);
515 Opts.VectorizeBB = Args.hasArg(OPT_vectorize_slp_aggressive);
516 Opts.VectorizeLoop = Args.hasArg(OPT_vectorize_loops);
517 Opts.VectorizeSLP = Args.hasArg(OPT_vectorize_slp);
519 Opts.
MainFileName = Args.getLastArgValue(OPT_main_file_name);
520 Opts.VerifyModule = !Args.hasArg(OPT_disable_llvm_verifier);
522 Opts.DisableGCov = Args.hasArg(OPT_test_coverage);
523 Opts.EmitGcovArcs = Args.hasArg(OPT_femit_coverage_data);
524 Opts.EmitGcovNotes = Args.hasArg(OPT_femit_coverage_notes);
525 if (Opts.EmitGcovArcs || Opts.EmitGcovNotes) {
526 Opts.
CoverageFile = Args.getLastArgValue(OPT_coverage_file);
527 Opts.CoverageExtraChecksum = Args.hasArg(OPT_coverage_cfg_checksum);
528 Opts.CoverageNoFunctionNamesInData =
529 Args.hasArg(OPT_coverage_no_function_names_in_data);
530 Opts.CoverageExitBlockBeforeBody =
531 Args.hasArg(OPT_coverage_exit_block_before_body);
532 if (Args.hasArg(OPT_coverage_version_EQ)) {
533 StringRef CoverageVersion = Args.getLastArgValue(OPT_coverage_version_EQ);
534 if (CoverageVersion.size() != 4) {
535 Diags.
Report(diag::err_drv_invalid_value)
536 << Args.getLastArg(OPT_coverage_version_EQ)->getAsString(Args)
544 Opts.InstrumentFunctions = Args.hasArg(OPT_finstrument_functions);
545 Opts.InstrumentForProfiling = Args.hasArg(OPT_pg);
546 Opts.EmitOpenCLArgMetadata = Args.hasArg(OPT_cl_kernel_arg_info);
547 Opts.CompressDebugSections = Args.hasArg(OPT_compress_debug_sections);
550 Opts.SanitizeCoverageType =
552 Opts.SanitizeCoverageIndirectCalls =
553 Args.hasArg(OPT_fsanitize_coverage_indirect_calls);
554 Opts.SanitizeCoverageTraceBB = Args.hasArg(OPT_fsanitize_coverage_trace_bb);
555 Opts.SanitizeCoverageTraceCmp = Args.hasArg(OPT_fsanitize_coverage_trace_cmp);
556 Opts.SanitizeCoverage8bitCounters =
557 Args.hasArg(OPT_fsanitize_coverage_8bit_counters);
558 Opts.SanitizeMemoryTrackOrigins =
560 Opts.SanitizeMemoryUseAfterDtor =
561 Args.hasArg(OPT_fsanitize_memory_use_after_dtor);
564 Opts.StackRealignment = Args.hasArg(OPT_mstackrealign);
565 if (Arg *A = Args.getLastArg(OPT_mstack_alignment)) {
566 StringRef Val = A->getValue();
567 unsigned StackAlignment = Opts.StackAlignment;
568 Val.getAsInteger(10, StackAlignment);
569 Opts.StackAlignment = StackAlignment;
572 if (Arg *A = Args.getLastArg(OPT_mstack_probe_size)) {
573 StringRef Val = A->getValue();
574 unsigned StackProbeSize = Opts.StackProbeSize;
575 Val.getAsInteger(0, StackProbeSize);
576 Opts.StackProbeSize = StackProbeSize;
579 if (Arg *A = Args.getLastArg(OPT_fobjc_dispatch_method_EQ)) {
580 StringRef Name = A->getValue();
581 unsigned Method = llvm::StringSwitch<unsigned>(Name)
587 Diags.
Report(diag::err_drv_invalid_value) << A->getAsString(Args) << Name;
590 Opts.setObjCDispatchMethod(
591 static_cast<CodeGenOptions::ObjCDispatchMethodKind>(Method));
595 if (Arg *A = Args.getLastArg(OPT_ftlsmodel_EQ)) {
596 StringRef Name = A->getValue();
597 unsigned Model = llvm::StringSwitch<unsigned>(Name)
604 Diags.
Report(diag::err_drv_invalid_value) << A->getAsString(Args) << Name;
607 Opts.setDefaultTLSModel(static_cast<CodeGenOptions::TLSModel>(Model));
611 if (Arg *A = Args.getLastArg(OPT_ffp_contract)) {
612 StringRef Val = A->getValue();
615 else if (Val ==
"on")
617 else if (Val ==
"off")
620 Diags.
Report(diag::err_drv_invalid_value) << A->getAsString(Args) << Val;
623 if (Arg *A = Args.getLastArg(OPT_fpcc_struct_return, OPT_freg_struct_return)) {
624 if (A->getOption().matches(OPT_fpcc_struct_return)) {
627 assert(A->getOption().matches(OPT_freg_struct_return));
633 bool NeedLocTracking =
false;
635 if (Arg *A = Args.getLastArg(OPT_Rpass_EQ)) {
638 NeedLocTracking =
true;
641 if (Arg *A = Args.getLastArg(OPT_Rpass_missed_EQ)) {
644 NeedLocTracking =
true;
647 if (Arg *A = Args.getLastArg(OPT_Rpass_analysis_EQ)) {
650 NeedLocTracking =
true;
657 NeedLocTracking =
true;
669 Args.getAllArgValues(OPT_fsanitize_recover_EQ), Diags,
672 Args.getAllArgValues(OPT_fsanitize_trap_EQ), Diags,
676 Args.getAllArgValues(OPT_fcuda_include_gpubinary);
683 using namespace options;
684 Opts.
OutputFile = Args.getLastArgValue(OPT_dependency_file);
685 Opts.
Targets = Args.getAllArgValues(OPT_MT);
693 Opts.
DOTOutputFile = Args.getLastArgValue(OPT_dependency_dot);
695 Args.getLastArgValue(OPT_module_dependency_dir);
696 if (Args.hasArg(OPT_MV))
702 using namespace options;
707 Args.getLastArg(OPT_diagnostic_serialized_file, OPT__serialize_diags))
709 Opts.IgnoreWarnings = Args.hasArg(OPT_w);
710 Opts.NoRewriteMacros = Args.hasArg(OPT_Wno_rewrite_macros);
711 Opts.Pedantic = Args.hasArg(OPT_pedantic);
712 Opts.PedanticErrors = Args.hasArg(OPT_pedantic_errors);
713 Opts.ShowCarets = !Args.hasArg(OPT_fno_caret_diagnostics);
714 Opts.ShowColors = Args.hasArg(OPT_fcolor_diagnostics);
715 Opts.ShowColumn = Args.hasFlag(OPT_fshow_column,
718 Opts.ShowFixits = !Args.hasArg(OPT_fno_diagnostics_fixit_info);
719 Opts.ShowLocation = !Args.hasArg(OPT_fno_show_source_location);
720 Opts.ShowOptionNames = Args.hasArg(OPT_fdiagnostics_show_option);
722 llvm::sys::Process::UseANSIEscapeCodes(Args.hasArg(OPT_fansi_escape_codes));
725 Opts.ShowNoteIncludeStack =
false;
726 if (Arg *A = Args.getLastArg(OPT_fdiagnostics_show_note_include_stack,
727 OPT_fno_diagnostics_show_note_include_stack))
728 if (A->getOption().matches(OPT_fdiagnostics_show_note_include_stack))
729 Opts.ShowNoteIncludeStack =
true;
731 StringRef ShowOverloads =
732 Args.getLastArgValue(OPT_fshow_overloads_EQ,
"all");
733 if (ShowOverloads ==
"best")
735 else if (ShowOverloads ==
"all")
736 Opts.setShowOverloads(
Ovl_All);
740 Diags->
Report(diag::err_drv_invalid_value)
741 << Args.getLastArg(OPT_fshow_overloads_EQ)->getAsString(Args)
745 StringRef ShowCategory =
746 Args.getLastArgValue(OPT_fdiagnostics_show_category,
"none");
747 if (ShowCategory ==
"none")
748 Opts.ShowCategories = 0;
749 else if (ShowCategory ==
"id")
750 Opts.ShowCategories = 1;
751 else if (ShowCategory ==
"name")
752 Opts.ShowCategories = 2;
756 Diags->
Report(diag::err_drv_invalid_value)
757 << Args.getLastArg(OPT_fdiagnostics_show_category)->getAsString(Args)
762 Args.getLastArgValue(OPT_fdiagnostics_format,
"clang");
763 if (Format ==
"clang")
765 else if (Format ==
"msvc")
767 else if (Format ==
"msvc-fallback") {
769 Opts.CLFallbackMode =
true;
770 }
else if (Format ==
"vi")
775 Diags->
Report(diag::err_drv_invalid_value)
776 << Args.getLastArg(OPT_fdiagnostics_format)->getAsString(Args)
780 Opts.ShowSourceRanges = Args.hasArg(OPT_fdiagnostics_print_source_range_info);
781 Opts.ShowParseableFixits = Args.hasArg(OPT_fdiagnostics_parseable_fixits);
782 Opts.ShowPresumedLoc = !Args.hasArg(OPT_fno_diagnostics_use_presumed_location);
783 Opts.VerifyDiagnostics = Args.hasArg(OPT_verify);
786 Args.getAllArgValues(OPT_verify_ignore_unexpected_EQ),
788 if (Args.hasArg(OPT_verify_ignore_unexpected))
790 Opts.setVerifyIgnoreUnexpected(DiagMask);
791 Opts.ElideType = !Args.hasArg(OPT_fno_elide_type);
792 Opts.ShowTemplateTree = Args.hasArg(OPT_fdiagnostics_show_template_tree);
794 Opts.MacroBacktraceLimit =
798 Args, OPT_ftemplate_backtrace_limit,
801 Args, OPT_fconstexpr_backtrace_limit,
804 Args, OPT_fspell_checking_limit,
811 Diags->
Report(diag::warn_ignoring_ftabstop_value)
822 Opts.
WorkingDir = Args.getLastArgValue(OPT_working_directory);
827 using namespace options;
829 if (
const Arg *A = Args.getLastArg(OPT_Action_Group)) {
830 switch (A->getOption().getID()) {
832 llvm_unreachable(
"Invalid option in group!");
836 case OPT_ast_dump_lookups:
842 case OPT_dump_raw_tokens:
844 case OPT_dump_tokens:
848 case OPT_emit_llvm_bc:
854 case OPT_emit_llvm_only:
856 case OPT_emit_codegen_only:
865 case OPT_emit_module:
873 case OPT_fsyntax_only:
875 case OPT_module_file_info:
879 case OPT_print_decl_contexts:
881 case OPT_print_preamble:
885 case OPT_rewrite_macros:
887 case OPT_rewrite_objc:
889 case OPT_rewrite_test:
900 if (
const Arg* A = Args.getLastArg(OPT_plugin)) {
901 Opts.
Plugins.emplace_back(A->getValue(0));
905 for (
const Arg *AA : Args.filtered(OPT_plugin_arg))
907 Opts.
PluginArgs.emplace_back(AA->getValue(1));
913 for (
const Arg *A : Args.filtered(OPT_plugin_arg))
917 if (
const Arg *A = Args.getLastArg(OPT_code_completion_at)) {
921 Diags.
Report(diag::err_drv_invalid_value)
922 << A->getAsString(Args) << A->getValue();
926 Opts.
OutputFile = Args.getLastArgValue(OPT_o);
927 Opts.
Plugins = Args.getAllArgValues(OPT_load);
929 Opts.
ShowHelp = Args.hasArg(OPT_help);
930 Opts.
ShowStats = Args.hasArg(OPT_print_stats);
931 Opts.
ShowTimers = Args.hasArg(OPT_ftime_report);
934 Opts.
LLVMArgs = Args.getAllArgValues(OPT_mllvm);
940 Opts.
ASTDumpFilter = Args.getLastArgValue(OPT_ast_dump_filter);
945 Opts.
ModuleFiles = Args.getAllArgValues(OPT_fmodule_file);
948 = Args.hasArg(OPT_code_completion_macros);
950 = Args.hasArg(OPT_code_completion_patterns);
952 = !Args.hasArg(OPT_no_code_completion_globals);
954 = Args.hasArg(OPT_code_completion_brief_comments);
957 = Args.getLastArgValue(OPT_foverride_record_layout_EQ);
958 if (
const Arg *A = Args.getLastArg(OPT_arcmt_check,
960 OPT_arcmt_migrate)) {
961 switch (A->getOption().getID()) {
963 llvm_unreachable(
"missed a case");
964 case OPT_arcmt_check:
967 case OPT_arcmt_modify:
970 case OPT_arcmt_migrate:
975 Opts.
MTMigrateDir = Args.getLastArgValue(OPT_mt_migrate_directory);
977 = Args.getLastArgValue(OPT_arcmt_migrate_report_output);
979 = Args.hasArg(OPT_arcmt_migrate_emit_arc_errors);
981 if (Args.hasArg(OPT_objcmt_migrate_literals))
983 if (Args.hasArg(OPT_objcmt_migrate_subscripting))
985 if (Args.hasArg(OPT_objcmt_migrate_property_dot_syntax))
987 if (Args.hasArg(OPT_objcmt_migrate_property))
989 if (Args.hasArg(OPT_objcmt_migrate_readonly_property))
991 if (Args.hasArg(OPT_objcmt_migrate_readwrite_property))
993 if (Args.hasArg(OPT_objcmt_migrate_annotation))
995 if (Args.hasArg(OPT_objcmt_returns_innerpointer_property))
997 if (Args.hasArg(OPT_objcmt_migrate_instancetype))
999 if (Args.hasArg(OPT_objcmt_migrate_nsmacros))
1001 if (Args.hasArg(OPT_objcmt_migrate_protocol_conformance))
1003 if (Args.hasArg(OPT_objcmt_atomic_property))
1005 if (Args.hasArg(OPT_objcmt_ns_nonatomic_iosonly))
1007 if (Args.hasArg(OPT_objcmt_migrate_designated_init))
1009 if (Args.hasArg(OPT_objcmt_migrate_all))
1016 Diags.
Report(diag::err_drv_argument_not_allowed_with)
1017 <<
"ARC migration" <<
"ObjC migration";
1021 if (
const Arg *A = Args.getLastArg(OPT_x)) {
1022 DashX = llvm::StringSwitch<InputKind>(A->getValue())
1030 .Case(
"assembler-with-cpp",
IK_Asm)
1037 .Case(
"c-header",
IK_C)
1039 .Case(
"objective-c-header",
IK_ObjC)
1040 .Case(
"c++-header",
IK_CXX)
1041 .Case(
"objective-c++-header",
IK_ObjCXX)
1042 .Cases(
"ast",
"pcm",
IK_AST)
1046 Diags.
Report(diag::err_drv_invalid_value)
1047 << A->getAsString(Args) << A->getValue();
1051 std::vector<std::string> Inputs = Args.getAllArgValues(OPT_INPUT);
1054 Inputs.push_back(
"-");
1055 for (
unsigned i = 0, e = Inputs.size(); i != e; ++i) {
1059 StringRef(Inputs[i]).rsplit(
'.').second);
1064 Opts.
Inputs.emplace_back(std::move(Inputs[i]), IK);
1072 std::string ClangExecutable =
1073 llvm::sys::fs::getMainExecutable(Argv0, MainAddr);
1074 StringRef Dir = llvm::sys::path::parent_path(ClangExecutable);
1077 StringRef ClangResourceDir(CLANG_RESOURCE_DIR);
1079 if (ClangResourceDir !=
"") {
1080 llvm::sys::path::append(P, ClangResourceDir);
1082 StringRef ClangLibdirSuffix(CLANG_LIBDIR_SUFFIX);
1083 llvm::sys::path::append(P,
"..", Twine(
"lib") + ClangLibdirSuffix,
"clang",
1091 using namespace options;
1092 Opts.
Sysroot = Args.getLastArgValue(OPT_isysroot,
"/");
1093 Opts.
Verbose = Args.hasArg(OPT_v);
1097 if (
const Arg *A = Args.getLastArg(OPT_stdlib_EQ))
1098 Opts.
UseLibcxx = (strcmp(A->getValue(),
"libc++") == 0);
1099 Opts.
ResourceDir = Args.getLastArgValue(OPT_resource_dir);
1110 Args.hasArg(OPT_fmodules_validate_once_per_build_session);
1114 Args.hasArg(OPT_fmodules_validate_system_headers);
1115 if (
const Arg *A = Args.getLastArg(OPT_fmodule_format_EQ))
1118 for (
const Arg *A : Args.filtered(OPT_fmodules_ignore_macro)) {
1119 StringRef MacroDef = A->getValue();
1124 bool IsIndexHeaderMap =
false;
1125 for (
const Arg *A : Args.filtered(OPT_I, OPT_F, OPT_index_header_map)) {
1126 if (A->getOption().matches(OPT_index_header_map)) {
1128 IsIndexHeaderMap =
true;
1135 Opts.
AddPath(A->getValue(), Group,
1136 A->getOption().matches(OPT_F),
true);
1137 IsIndexHeaderMap =
false;
1141 StringRef Prefix =
"";
1143 Args.filtered(OPT_iprefix, OPT_iwithprefix, OPT_iwithprefixbefore)) {
1144 if (A->getOption().matches(OPT_iprefix))
1145 Prefix = A->getValue();
1146 else if (A->getOption().matches(OPT_iwithprefix))
1152 for (
const Arg *A : Args.filtered(OPT_idirafter))
1154 for (
const Arg *A : Args.filtered(OPT_iquote))
1156 for (
const Arg *A : Args.filtered(OPT_isystem, OPT_iwithsysroot))
1158 !A->getOption().matches(OPT_iwithsysroot));
1159 for (
const Arg *A : Args.filtered(OPT_iframework))
1163 for (
const Arg *A : Args.filtered(OPT_c_isystem))
1165 for (
const Arg *A : Args.filtered(OPT_cxx_isystem))
1167 for (
const Arg *A : Args.filtered(OPT_objc_isystem))
1169 for (
const Arg *A : Args.filtered(OPT_objcxx_isystem))
1174 Args.filtered(OPT_internal_isystem, OPT_internal_externc_isystem)) {
1176 if (A->getOption().matches(OPT_internal_externc_isystem))
1178 Opts.
AddPath(A->getValue(), Group,
false,
true);
1183 Args.filtered(OPT_system_header_prefix, OPT_no_system_header_prefix))
1185 A->getValue(), A->getOption().matches(OPT_system_header_prefix));
1187 for (
const Arg *A : Args.filtered(OPT_ivfsoverlay))
1197 Opts.AsmPreprocessor = 1;
1202 Opts.ObjC1 = Opts.ObjC2 = 1;
1211 llvm_unreachable(
"Invalid input kind!");
1213 LangStd = LangStandard::lang_opencl;
1217 LangStd = LangStandard::lang_cuda;
1224 LangStd = LangStandard::lang_gnu11;
1230 LangStd = LangStandard::lang_gnucxx98;
1237 Opts.C99 = Std.
isC99();
1238 Opts.C11 = Std.
isC11();
1245 Opts.GNUInline = Std.
isC89();
1250 Opts.OpenCL = LangStd == LangStandard::lang_opencl || IK ==
IK_OpenCL;
1251 if (LangStd == LangStandard::lang_opencl)
1252 Opts.OpenCLVersion = 100;
1253 else if (LangStd == LangStandard::lang_opencl11)
1254 Opts.OpenCLVersion = 110;
1255 else if (LangStd == LangStandard::lang_opencl12)
1256 Opts.OpenCLVersion = 120;
1257 else if (LangStd == LangStandard::lang_opencl20)
1258 Opts.OpenCLVersion = 200;
1264 Opts.CXXOperatorNames = 1;
1265 Opts.LaxVectorConversions = 0;
1266 Opts.DefaultFPContract = 1;
1267 Opts.NativeHalfType = 1;
1271 LangStd == LangStandard::lang_cuda;
1274 Opts.Bool = Opts.OpenCL || Opts.CPlusPlus;
1277 Opts.Half = Opts.OpenCL;
1280 Opts.WChar = Opts.CPlusPlus;
1282 Opts.GNUKeywords = Opts.GNUMode;
1283 Opts.CXXOperatorNames = Opts.CPlusPlus;
1285 Opts.DollarIdents = !Opts.AsmPreprocessor;
1291 StringRef value = arg->getValue();
1292 if (value ==
"default") {
1294 }
else if (value ==
"hidden") {
1296 }
else if (value ==
"protected") {
1301 diags.
Report(diag::err_drv_invalid_value)
1302 << arg->getAsString(args) << value;
1310 if (
const Arg *A = Args.getLastArg(OPT_std_EQ)) {
1311 LangStd = llvm::StringSwitch<LangStandard::Kind>(A->getValue())
1313 .Case(name, LangStandard::lang_##
id)
1314 #include "clang/Frontend/LangStandards.def"
1317 Diags.
Report(diag::err_drv_invalid_value)
1318 << A->getAsString(Args) << A->getValue();
1329 Diags.
Report(diag::err_drv_argument_not_allowed_with)
1330 << A->getAsString(Args) <<
"C/ObjC";
1337 Diags.
Report(diag::err_drv_argument_not_allowed_with)
1338 << A->getAsString(Args) <<
"C++/ObjC++";
1342 Diags.
Report(diag::err_drv_argument_not_allowed_with)
1343 << A->getAsString(Args) <<
"OpenCL";
1348 Diags.
Report(diag::err_drv_argument_not_allowed_with)
1349 << A->getAsString(Args) <<
"CUDA";
1359 if (
const Arg *A = Args.getLastArg(OPT_cl_std_EQ)) {
1361 = llvm::StringSwitch<LangStandard::Kind>(A->getValue())
1362 .Case(
"CL", LangStandard::lang_opencl)
1363 .Case(
"CL1.1", LangStandard::lang_opencl11)
1364 .Case(
"CL1.2", LangStandard::lang_opencl12)
1365 .Case(
"CL2.0", LangStandard::lang_opencl20)
1369 Diags.
Report(diag::err_drv_invalid_value)
1370 << A->getAsString(Args) << A->getValue();
1373 LangStd = OpenCLLangStd;
1383 Opts.GNUKeywords = Args.hasFlag(OPT_fgnu_keywords, OPT_fno_gnu_keywords,
1386 if (Args.hasArg(OPT_fno_operator_names))
1387 Opts.CXXOperatorNames = 0;
1389 if (Args.hasArg(OPT_fcuda_is_device))
1390 Opts.CUDAIsDevice = 1;
1392 if (Args.hasArg(OPT_fcuda_allow_host_calls_from_host_device))
1393 Opts.CUDAAllowHostCallsFromHostDevice = 1;
1395 if (Args.hasArg(OPT_fcuda_disable_target_call_checks))
1396 Opts.CUDADisableTargetCallChecks = 1;
1399 if (Arg *arg = Args.getLastArg(OPT_fobjc_runtime_EQ)) {
1400 StringRef value = arg->getValue();
1402 Diags.
Report(diag::err_drv_unknown_objc_runtime) << value;
1405 if (Args.hasArg(OPT_fobjc_gc_only))
1407 else if (Args.hasArg(OPT_fobjc_gc))
1409 else if (Args.hasArg(OPT_fobjc_arc)) {
1410 Opts.ObjCAutoRefCount = 1;
1412 Diags.
Report(diag::err_arc_unsupported_on_runtime);
1415 if (Args.hasArg(OPT_fobjc_runtime_has_weak))
1416 Opts.ObjCARCWeak = 1;
1421 if (Args.hasArg(OPT_fno_objc_infer_related_result_type))
1422 Opts.ObjCInferRelatedResultType = 0;
1424 if (Args.hasArg(OPT_fobjc_subscripting_legacy_runtime))
1425 Opts.ObjCSubscriptingLegacyRuntime =
1429 if (Args.hasArg(OPT_fgnu89_inline)) {
1431 Diags.
Report(diag::err_drv_argument_not_allowed_with) <<
"-fgnu89-inline"
1437 if (Args.hasArg(OPT_fapple_kext)) {
1438 if (!Opts.CPlusPlus)
1439 Diags.
Report(diag::warn_c_kext);
1444 if (Args.hasArg(OPT_print_ivar_layout))
1445 Opts.ObjCGCBitmapPrint = 1;
1446 if (Args.hasArg(OPT_fno_constant_cfstrings))
1447 Opts.NoConstantCFStrings = 1;
1449 if (Args.hasArg(OPT_faltivec))
1452 if (Args.hasArg(OPT_fzvector))
1455 if (Args.hasArg(OPT_pthread))
1456 Opts.POSIXThreads = 1;
1459 if (Arg *visOpt = Args.getLastArg(OPT_fvisibility)) {
1466 if (Arg *typeVisOpt = Args.getLastArg(OPT_ftype_visibility)) {
1469 Opts.setTypeVisibilityMode(Opts.getValueVisibilityMode());
1472 if (Args.hasArg(OPT_fvisibility_inlines_hidden))
1473 Opts.InlineVisibilityHidden = 1;
1475 if (Args.hasArg(OPT_ftrapv)) {
1479 Args.getLastArgValue(OPT_ftrapv_handler);
1481 else if (Args.hasArg(OPT_fwrapv))
1484 Opts.MSVCCompat = Args.hasArg(OPT_fms_compatibility);
1485 Opts.MicrosoftExt = Opts.MSVCCompat || Args.hasArg(OPT_fms_extensions);
1486 Opts.AsmBlocks = Args.hasArg(OPT_fasm_blocks) || Opts.MicrosoftExt;
1487 Opts.MSCompatibilityVersion = 0;
1488 if (
const Arg *A = Args.getLastArg(OPT_fms_compatibility_version)) {
1491 Diags.
Report(diag::err_drv_invalid_value) << A->getAsString(Args)
1493 Opts.MSCompatibilityVersion = VT.
getMajor() * 10000000 +
1494 VT.
getMinor().getValueOr(0) * 100000 +
1501 Opts.Trigraphs = !Opts.GNUMode && !Opts.MSVCCompat && !Opts.CPlusPlus1z;
1503 Args.hasFlag(OPT_ftrigraphs, OPT_fno_trigraphs, Opts.Trigraphs);
1505 Opts.DollarIdents = Args.hasFlag(OPT_fdollars_in_identifiers,
1506 OPT_fno_dollars_in_identifiers,
1508 Opts.PascalStrings = Args.hasArg(OPT_fpascal_strings);
1510 Opts.Borland = Args.hasArg(OPT_fborland_extensions);
1511 Opts.WritableStrings = Args.hasArg(OPT_fwritable_strings);
1512 Opts.ConstStrings = Args.hasFlag(OPT_fconst_strings, OPT_fno_const_strings,
1514 if (Args.hasArg(OPT_fno_lax_vector_conversions))
1515 Opts.LaxVectorConversions = 0;
1516 if (Args.hasArg(OPT_fno_threadsafe_statics))
1517 Opts.ThreadsafeStatics = 0;
1518 Opts.Exceptions = Args.hasArg(OPT_fexceptions);
1519 Opts.ObjCExceptions = Args.hasArg(OPT_fobjc_exceptions);
1520 Opts.CXXExceptions = Args.hasArg(OPT_fcxx_exceptions);
1521 Opts.SjLjExceptions = Args.hasArg(OPT_fsjlj_exceptions);
1522 Opts.TraditionalCPP = Args.hasArg(OPT_traditional_cpp);
1524 Opts.RTTI = !Args.hasArg(OPT_fno_rtti);
1525 Opts.RTTIData = Opts.RTTI && !Args.hasArg(OPT_fno_rtti_data);
1526 Opts.Blocks = Args.hasArg(OPT_fblocks);
1527 Opts.BlocksRuntimeOptional = Args.hasArg(OPT_fblocks_runtime_optional);
1528 Opts.Modules = Args.hasArg(OPT_fmodules);
1529 Opts.ModulesStrictDeclUse = Args.hasArg(OPT_fmodules_strict_decluse);
1530 Opts.ModulesDeclUse =
1531 Args.hasArg(OPT_fmodules_decluse) || Opts.ModulesStrictDeclUse;
1532 Opts.ModulesLocalVisibility =
1533 Args.hasArg(OPT_fmodules_local_submodule_visibility);
1534 Opts.ModulesHideInternalLinkage =
1535 !Args.hasArg(OPT_fno_modules_hide_internal_linkage);
1536 Opts.ModulesSearchAll = Opts.Modules &&
1537 !Args.hasArg(OPT_fno_modules_search_all) &&
1538 Args.hasArg(OPT_fmodules_search_all);
1539 Opts.ModulesErrorRecovery = !Args.hasArg(OPT_fno_modules_error_recovery);
1540 Opts.ImplicitModules = !Args.hasArg(OPT_fno_implicit_modules);
1541 Opts.CharIsSigned = Opts.OpenCL || !Args.hasArg(OPT_fno_signed_char);
1542 Opts.WChar = Opts.CPlusPlus && !Args.hasArg(OPT_fno_wchar);
1543 Opts.ShortWChar = Args.hasFlag(OPT_fshort_wchar, OPT_fno_short_wchar,
false);
1544 Opts.ShortEnums = Args.hasArg(OPT_fshort_enums);
1545 Opts.Freestanding = Args.hasArg(OPT_ffreestanding);
1546 Opts.NoBuiltin = Args.hasArg(OPT_fno_builtin) || Opts.Freestanding;
1547 Opts.NoMathBuiltin = Args.hasArg(OPT_fno_math_builtin);
1548 Opts.AssumeSaneOperatorNew = !Args.hasArg(OPT_fno_assume_sane_operator_new);
1549 Opts.SizedDeallocation = Args.hasArg(OPT_fsized_deallocation);
1550 Opts.ConceptsTS = Args.hasArg(OPT_fconcepts_ts);
1551 Opts.HeinousExtensions = Args.hasArg(OPT_fheinous_gnu_extensions);
1552 Opts.AccessControl = !Args.hasArg(OPT_fno_access_control);
1553 Opts.ElideConstructors = !Args.hasArg(OPT_fno_elide_constructors);
1554 Opts.MathErrno = !Opts.OpenCL && Args.hasArg(OPT_fmath_errno);
1555 Opts.InstantiationDepth =
1559 Opts.ConstexprCallDepth =
1561 Opts.ConstexprStepLimit =
1564 Opts.DelayedTemplateParsing = Args.hasArg(OPT_fdelayed_template_parsing);
1565 Opts.NumLargeByValueCopy =
1567 Opts.MSBitfields = Args.hasArg(OPT_mms_bitfields);
1569 Args.getLastArgValue(OPT_fconstant_string_class);
1570 Opts.ObjCDefaultSynthProperties =
1571 !Args.hasArg(OPT_disable_objc_default_synthesize_properties);
1572 Opts.EncodeExtendedBlockSig =
1573 Args.hasArg(OPT_fencode_extended_block_signature);
1574 Opts.EmitAllDecls = Args.hasArg(OPT_femit_all_decls);
1579 Opts.Static = Args.hasArg(OPT_static_define);
1580 Opts.DumpRecordLayoutsSimple = Args.hasArg(OPT_fdump_record_layouts_simple);
1581 Opts.DumpRecordLayouts = Opts.DumpRecordLayoutsSimple
1582 || Args.hasArg(OPT_fdump_record_layouts);
1583 Opts.DumpVTableLayouts = Args.hasArg(OPT_fdump_vtable_layouts);
1584 Opts.SpellChecking = !Args.hasArg(OPT_fno_spell_checking);
1585 Opts.NoBitFieldTypeAlign = Args.hasArg(OPT_fno_bitfield_type_align);
1586 Opts.SinglePrecisionConstants = Args.hasArg(OPT_cl_single_precision_constant);
1587 Opts.FastRelaxedMath = Args.hasArg(OPT_cl_fast_relaxed_math);
1588 Opts.MRTD = Args.hasArg(OPT_mrtd);
1589 Opts.HexagonQdsp6Compat = Args.hasArg(OPT_mqdsp6_compat);
1590 Opts.FakeAddressSpaceMap = Args.hasArg(OPT_ffake_address_space_map);
1591 Opts.ParseUnknownAnytype = Args.hasArg(OPT_funknown_anytype);
1592 Opts.DebuggerSupport = Args.hasArg(OPT_fdebugger_support);
1593 Opts.DebuggerCastResultToId = Args.hasArg(OPT_fdebugger_cast_result_to_id);
1594 Opts.DebuggerObjCLiteral = Args.hasArg(OPT_fdebugger_objc_literal);
1595 Opts.ApplePragmaPack = Args.hasArg(OPT_fapple_pragma_pack);
1596 Opts.
CurrentModule = Args.getLastArgValue(OPT_fmodule_name);
1597 Opts.AppExt = Args.hasArg(OPT_fapplication_extension);
1599 Args.getLastArgValue(OPT_fmodule_implementation_of);
1602 Opts.NativeHalfType |= Args.hasArg(OPT_fnative_half_type);
1603 Opts.HalfArgsAndReturns = Args.hasArg(OPT_fallow_half_arguments_and_returns);
1604 Opts.GNUAsm = !Args.hasArg(OPT_fno_gnu_inline_asm);
1608 Diags.
Report(diag::err_conflicting_module_names)
1614 if (Opts.ModulesLocalVisibility && !Opts.CPlusPlus)
1615 Diags.
Report(diag::err_drv_argument_not_allowed_with)
1616 <<
"-fmodules-local-submodule-visibility" <<
"C";
1618 if (Arg *A = Args.getLastArg(OPT_faddress_space_map_mangling_EQ)) {
1619 switch (llvm::StringSwitch<unsigned>(A->getValue())
1625 Diags.
Report(diag::err_drv_invalid_value)
1626 <<
"-faddress-space-map-mangling=" << A->getValue();
1640 if (Arg *A = Args.getLastArg(OPT_fms_memptr_rep_EQ)) {
1642 llvm::StringSwitch<LangOptions::PragmaMSPointersToMembersKind>(
1652 Diags.
Report(diag::err_drv_invalid_value)
1653 <<
"-fms-memptr-rep=" << A->getValue();
1655 Opts.setMSPointerToMemberRepresentationMethod(InheritanceModel);
1659 Opts.OpenMP = Args.hasArg(options::OPT_fopenmp);
1661 Opts.OpenMP && !Args.hasArg(options::OPT_fnoopenmp_use_tls);
1664 Opts.Deprecated = Args.hasFlag(OPT_fdeprecated_macro,
1665 OPT_fno_deprecated_macro,
1671 Opts.Optimize = Opt != 0;
1672 Opts.OptimizeSize = OptSize != 0;
1677 Opts.NoInlineDefine = !Opt || Args.hasArg(OPT_fno_inline);
1679 Opts.FastMath = Args.hasArg(OPT_ffast_math) ||
1680 Args.hasArg(OPT_cl_fast_relaxed_math);
1681 Opts.FiniteMathOnly = Args.hasArg(OPT_ffinite_math_only) ||
1682 Args.hasArg(OPT_cl_finite_math_only) ||
1683 Args.hasArg(OPT_cl_fast_relaxed_math);
1685 Opts.RetainCommentsFromSystemHeaders =
1686 Args.hasArg(OPT_fretain_comments_from_system_headers);
1691 Diags.
Report(diag::err_drv_invalid_value)
1692 << Args.getLastArg(OPT_stack_protector)->getAsString(Args) << SSP;
1704 Opts.SanitizeAddressFieldPadding =
1712 using namespace options;
1715 if (
const Arg *A = Args.getLastArg(OPT_token_cache))
1720 Opts.
DetailedRecord = Args.hasArg(OPT_detailed_preprocessing_record);
1724 for (
const Arg *A : Args.filtered(OPT_error_on_deserialized_pch_decl))
1727 if (
const Arg *A = Args.getLastArg(OPT_preamble_bytes_EQ)) {
1728 StringRef
Value(A->getValue());
1731 unsigned EndOfLine = 0;
1733 if (Comma == StringRef::npos ||
1734 Value.substr(0, Comma).getAsInteger(10, Bytes) ||
1735 Value.substr(Comma + 1).getAsInteger(10, EndOfLine))
1736 Diags.
Report(diag::err_drv_preamble_format);
1744 for (
const Arg *A : Args.filtered(OPT_D, OPT_U)) {
1745 if (A->getOption().matches(OPT_D))
1754 for (
const Arg *A : Args.filtered(OPT_include))
1755 Opts.
Includes.emplace_back(A->getValue());
1757 for (
const Arg *A : Args.filtered(OPT_chain_include))
1761 if (Args.hasArg(OPT_faltivec))
1762 Opts.
Includes.emplace_back(
"altivec.h");
1764 for (
const Arg *A : Args.filtered(OPT_remap_file)) {
1765 std::pair<StringRef, StringRef> Split = StringRef(A->getValue()).split(
';');
1767 if (Split.second.empty()) {
1768 Diags.
Report(diag::err_drv_invalid_remap_file) << A->getAsString(Args);
1775 if (Arg *A = Args.getLastArg(OPT_fobjc_arc_cxxlib_EQ)) {
1776 StringRef Name = A->getValue();
1777 unsigned Library = llvm::StringSwitch<unsigned>(Name)
1783 Diags.
Report(diag::err_drv_invalid_value) << A->getAsString(Args) << Name;
1792 using namespace options;
1829 Opts.
ShowCPP = !Args.hasArg(OPT_dM);
1836 Opts.
ShowMacros = Args.hasArg(OPT_dM) || Args.hasArg(OPT_dD);
1842 using namespace options;
1843 Opts.
ABI = Args.getLastArgValue(OPT_target_abi);
1844 Opts.
CPU = Args.getLastArgValue(OPT_target_cpu);
1845 Opts.
FPMath = Args.getLastArgValue(OPT_mfpmath);
1847 Opts.
LinkerVersion = Args.getLastArgValue(OPT_target_linker_version);
1848 Opts.
Triple = llvm::Triple::normalize(Args.getLastArgValue(OPT_triple));
1849 Opts.
Reciprocals = Args.getAllArgValues(OPT_mrecip_EQ);
1852 Opts.
Triple = llvm::sys::getDefaultTargetTriple();
1856 const char *
const *ArgBegin,
1857 const char *
const *ArgEnd,
1859 bool Success =
true;
1864 unsigned MissingArgIndex, MissingArgCount;
1866 Opts->ParseArgs(llvm::makeArrayRef(ArgBegin, ArgEnd), MissingArgIndex,
1867 MissingArgCount, IncludedFlagsBitmask);
1870 if (MissingArgCount) {
1871 Diags.
Report(diag::err_drv_missing_argument)
1872 << Args.getArgString(MissingArgIndex) << MissingArgCount;
1877 for (
const Arg *A : Args.filtered(OPT_UNKNOWN)) {
1878 Diags.
Report(diag::err_drv_unknown_argument) << A->getAsString(Args);
1912 class ModuleSignature {
1918 ModuleSignature() : CurBit(0), CurValue(0) { }
1920 void add(uint64_t
Value,
unsigned Bits);
1921 void add(StringRef
Value);
1924 llvm::APInt getAsInteger()
const;
1928 void ModuleSignature::add(uint64_t
Value,
unsigned int NumBits) {
1929 CurValue |= Value << CurBit;
1930 if (CurBit + NumBits < 64) {
1936 Data.push_back(CurValue);
1939 CurValue = Value >> (64-CurBit);
1942 CurBit = (CurBit+NumBits) & 63;
1945 void ModuleSignature::flush() {
1949 Data.push_back(CurValue);
1954 void ModuleSignature::add(StringRef Value) {
1955 for (StringRef::iterator I = Value.begin(), IEnd = Value.end(); I != IEnd;++I)
1959 llvm::APInt ModuleSignature::getAsInteger()
const {
1960 return llvm::APInt(Data.size() * 64, Data);
1966 using llvm::hash_code;
1967 using llvm::hash_value;
1968 using llvm::hash_combine;
1976 #define LANGOPT(Name, Bits, Default, Description) \
1977 code = hash_combine(code, LangOpts->Name);
1978 #define ENUM_LANGOPT(Name, Type, Bits, Default, Description) \
1979 code = hash_combine(code, static_cast<unsigned>(LangOpts->get##Name()));
1980 #define BENIGN_LANGOPT(Name, Bits, Default, Description)
1981 #define BENIGN_ENUM_LANGOPT(Name, Type, Bits, Default, Description)
1982 #include "clang/Basic/LangOptions.def"
1984 for (StringRef Feature : LangOpts->ModuleFeatures)
1985 code = hash_combine(code, Feature);
1988 code = hash_combine(code, TargetOpts->Triple, TargetOpts->CPU,
1990 for (
unsigned i = 0, n = TargetOpts->FeaturesAsWritten.size(); i != n; ++i)
1991 code = hash_combine(code, TargetOpts->FeaturesAsWritten[i]);
1998 for (std::vector<std::pair<std::string, bool/*isUndef*/> >::const_iterator
1999 I = getPreprocessorOpts().Macros.begin(),
2000 IEnd = getPreprocessorOpts().Macros.end();
2006 StringRef MacroDef = I->first;
2011 code = hash_combine(code, I->first, I->second);
2028 if (!hsOpts.
Sysroot.empty()) {
2030 systemVersionFile += hsOpts.
Sysroot;
2031 llvm::sys::path::append(systemVersionFile,
"System");
2032 llvm::sys::path::append(systemVersionFile,
"Library");
2033 llvm::sys::path::append(systemVersionFile,
"CoreServices");
2034 llvm::sys::path::append(systemVersionFile,
"SystemVersion.plist");
2036 llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>> buffer =
2037 llvm::MemoryBuffer::getFile(systemVersionFile);
2039 code = hash_combine(code, buffer.get()->getBuffer());
2041 struct stat statBuf;
2042 if (stat(systemVersionFile.c_str(), &statBuf) == 0)
2043 code = hash_combine(code, statBuf.st_mtime);
2047 return llvm::APInt(64, code).toString(36,
false);
2052 template<
typename IntTy>
2056 IntTy Res = Default;
2057 if (Arg *A = Args.getLastArg(Id)) {
2058 if (StringRef(A->getValue()).getAsInteger(10, Res)) {
2060 Diags->
Report(diag::err_drv_invalid_int_value) << A->getAsString(Args)
2071 return getLastArgIntValueImpl<int>(Args, Id, Default, Diags);
2077 return getLastArgIntValueImpl<uint64_t>(Args, Id, Default, Diags);
2086 static const size_t kGraveYardMaxSize = 16;
2087 LLVM_ATTRIBUTE_UNUSED
static const void *GraveYard[kGraveYardMaxSize];
2088 static std::atomic<unsigned> GraveYardSize;
2089 unsigned Idx = GraveYardSize++;
2090 if (Idx >= kGraveYardMaxSize)
2092 GraveYard[Idx] = Ptr;
2105 llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>> Buffer =
2106 llvm::MemoryBuffer::getFile(File);
2108 Diags.
Report(diag::err_missing_vfs_overlay_file) << File;
2115 Diags.
Report(diag::err_invalid_vfs_overlay) << File;
2118 Overlay->pushOverlay(FS);
HeaderSearchOptions & getHeaderSearchOpts()
static Visibility parseVisibility(Arg *arg, ArgList &args, DiagnosticsEngine &diags)
Attempt to parse a visibility value out of the given argument.
Expand macros but not #includes.
std::string OutputFile
The output file, if any.
static void ParseFileSystemArgs(FileSystemOptions &Opts, ArgList &Args)
unsigned NoFinalizeRemoval
static void ParseCommentArgs(CommentOptions &Opts, ArgList &Args)
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
std::string DOTOutputFile
The file to write GraphViz-formatted header dependencies to.
void addMacroUndef(StringRef Name)
std::vector< std::vector< std::string > > AddPluginArgs
Args to pass to the additional plugins.
Generate pre-compiled module.
Represents a version number in the form major[.minor[.subminor[.build]]].
Implements support for file system lookup, file system caching, and directory search management...
static void ParseTargetArgs(TargetOptions &Opts, ArgList &Args)
TargetOptions & getTargetOpts()
Defines the clang::FileManager interface and associated types.
Parse and perform semantic analysis.
ObjCXXARCStandardLibraryKind
Enumerate the kinds of standard library that.
static StringRef getCodeModel(ArgList &Args, DiagnosticsEngine &Diags)
SanitizerSet Sanitize
Set of enabled sanitizers.
DependencyOutputOptions & getDependencyOutputOpts()
IntrusiveRefCntPtr< FileSystem > getRealFileSystem()
Gets an vfs::FileSystem for the 'real' file system, as seen by the operating system.
std::shared_ptr< llvm::Regex > OptimizationRemarkMissedPattern
static unsigned getOptimizationLevel(ArgList &Args, InputKind IK, DiagnosticsEngine &Diags)
bool isGNUMode() const
isGNUMode - Language includes GNU extensions.
unsigned IncludeModuleFiles
Include module file dependencies.
Parse ASTs and print them.
Like System, but only used for C++.
std::string HeaderIncludeOutputFile
std::vector< std::string > Includes
static bool parseDiagnosticLevelMask(StringRef FlagName, const std::vector< std::string > &Levels, DiagnosticsEngine *Diags, DiagnosticLevelMask &M)
Optional< unsigned > getMinor() const
Retrieve the minor version number, if provided.
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.
Enable migration of ObjC methods to 'instancetype'.
bool allowsWeak() const
Does this runtime allow the use of __weak?
#define ANALYSIS_STORE(NAME, CMDFLAG, DESC, CREATFN)
static bool ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, InputKind IK, DiagnosticsEngine &Diags, const TargetOptions &TargetOpts)
std::vector< std::string > RewriteMapFiles
Set of files definining the rules for the symbol rewriting.
bool hasLineComments() const
Language supports '//' comments.
static const LangStandard & getLangStandardForKind(Kind K)
std::string ASTDumpFilter
If given, filter dumped AST Decl nodes by this substring.
std::string getModuleHash() const
Retrieve a module hash string that is suitable for uniquely identifying the conditions under which th...
std::string ImplicitPTHInclude
static InputKind ParseFrontendArgs(FrontendOptions &Opts, ArgList &Args, DiagnosticsEngine &Diags)
Options for controlling the target.
bool allowsARC() const
Does this runtime allow ARC at all?
void addRemappedFile(StringRef From, StringRef To)
std::vector< std::string > PluginArgs
Args to pass to the plugin.
std::string FixItSuffix
If given, the new suffix for fix-it rewritten files.
std::string SplitDwarfFile
Like System, but searched after the system directories.
std::string DebugPass
Enable additional debugging information.
SanitizerSet SanitizeRecover
Parse and apply any fixits to the source.
std::vector< std::string > Reciprocals
std::vector< std::string > CudaGpuBinaryFileNames
IntrusiveRefCntPtr< FileSystem > getVFSFromYAML(std::unique_ptr< llvm::MemoryBuffer > Buffer, llvm::SourceMgr::DiagHandlerTy DiagHandler, void *DiagContext=nullptr, IntrusiveRefCntPtr< FileSystem > ExternalFS=getRealFileSystem())
Gets a FileSystem for a virtual file system described in YAML format.
std::string FPMath
If given, the unit to use for floating point math.
bool isCPlusPlus11() const
isCPlusPlus11 - Language is a C++11 variant (or later).
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. It returns a pointer to the newly ge...
bool isCPlusPlus() const
isCPlusPlus - Language is a C++ variant.
unsigned IncludeSystemHeaders
Include system header dependencies.
Don't generate debug info.
Translate input source into HTML.
unsigned DetailedRecord
Whether we should maintain a detailed record of all macro definitions and expansions.
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.
Enable migration to add conforming protocols.
std::string CodeModel
The code model to use (-mcmodel).
Print DeclContext and their Decls.
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)
CodeGenOptions & getCodeGenOpts()
Enable annotation of ObjCMethods of all kinds.
static void ParseDependencyOutputArgs(DependencyOutputOptions &Opts, ArgList &Args)
Visibility
Describes the different kinds of visibility that a declaration may have.
Concrete class used by the front-end to report problems and issues.
std::vector< std::string > Warnings
std::vector< std::pair< std::string, bool > > CheckersControlList
Pair of checker name and enable/disable.
AnalysisStores
AnalysisStores - Set of available analysis store models.
bool DisablePCHValidation
When true, disables most of the normal validation performed on precompiled headers.
static void ParsePreprocessorArgs(PreprocessorOptions &Opts, ArgList &Args, FileManager &FileMgr, DiagnosticsEngine &Diags)
unsigned FixAndRecompile
Apply fixes and recompile.
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.
static IntTy getLastArgIntValueImpl(const ArgList &Args, OptSpecifier Id, IntTy Default, DiagnosticsEngine *Diags)
MigratorOptions & getMigratorOpts()
char CoverageVersion[4]
The version string to put into coverage files.
Dump out preprocessed tokens.
std::string CurrentModule
The name of the current module.
AnalysisDiagClients AnalysisDiagOpt
Enable migration to modern ObjC literals.
std::vector< std::string > ChainedIncludes
Headers that will be converted to chained PCHs in memory.
std::string LimitFloatPrecision
The float precision limit to use, if non-empty.
bool isCPlusPlus14() const
isCPlusPlus14 - Language is a C++14 variant (or later).
uint64_t getLastArgUInt64Value(const llvm::opt::ArgList &Args, llvm::opt::OptSpecifier Id, uint64_t Default, DiagnosticsEngine *Diags=nullptr)
unsigned UsePredefines
Initialize the preprocessor with the compiler and target specific predefines.
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 hasDigraphs() const
hasDigraphs - Language supports digraphs.
std::vector< std::string > Plugins
The list of plugins to load.
Show just the "best" overload candidates.
unsigned IncludeCodePatterns
Show code patterns in code completion results.
std::string WorkingDir
If set, paths are resolved as if the working directory was set to the value of WorkingDir.
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.
std::string LinkerVersion
If given, the version string of the linker in use.
Only execute frontend initialization.
bool isCPlusPlus1z() const
isCPlusPlus1z - Language is a C++17 variant (or later).
Defines version macros and version-related utility functions for Clang.
std::string RelocationModel
The name of the relocation model to use.
Print the "preamble" of the input file.
Enable migration to modern ObjC property.
IntrusiveRefCntPtr< vfs::FileSystem > createVFSFromCompilerInvocation(const CompilerInvocation &CI, DiagnosticsEngine &Diags)
bool isC89() const
isC89 - Language is a superset of C89.
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
AnalysisInliningMode
AnalysisInlineFunctionSelection - Set of inlining function selection heuristics.
unsigned ShowMacros
Print macro definitions.
clang::ObjCRuntime ObjCRuntime
static void ParsePreprocessorOutputArgs(PreprocessorOutputOptions &Opts, ArgList &Args, frontend::ActionKind Action)
unsigned FixOnlyWarnings
Apply fixes only for warnings.
Enable migration to modern ObjC readwrite property.
bool hasImplicitInt() const
hasImplicitInt - Language allows variables to be typed as int implicitly.
unsigned NoNSAllocReallocError
static void addDiagnosticArgs(ArgList &Args, OptSpecifier Group, OptSpecifier GroupWithValue, std::vector< std::string > &Diagnostics)
std::string CPU
If given, the name of the target CPU to generate code for.
unsigned ARCMTMigrateEmitARCErrors
bool isC99() const
isC99 - Language is a superset of C99.
void set(SanitizerMask K, bool Value)
Enable or disable a certain (single) sanitizer.
Enable inferring NS_DESIGNATED_INITIALIZER for ObjC methods.
bool ParseDiagnosticArgs(DiagnosticOptions &Opts, llvm::opt::ArgList &Args, DiagnosticsEngine *Diags=nullptr)
Fill out Opts based on the options given in Args.
std::string ABI
If given, the name of the target ABI to use.
AnalysisConstraints
AnalysisConstraints - Set of available constraint models.
bool isC11() const
isC11 - Language is a superset of C11.
AnalysisStores AnalysisStoreOpt
Encodes a location in the source. The SourceManager can decode this to get at the full include stack...
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.
Options for controlling the compiler diagnostics engine.
std::vector< FrontendInputFile > Inputs
The input files and their types.
AnalyzerOptionsRef getAnalyzerOpts() const
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)
Parse ASTs and view them in Graphviz.
std::vector< std::string > Remarks
annotate property with NS_RETURNS_INNER_POINTER
Enable migration to modern ObjC readonly property.
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...
std::string InstrProfileInput
Name of the profile file to use as input for -fprofile-instr-use.
unsigned getMajor() const
Retrieve the major version number.
Enable migration to modern ObjC subscripting.
Load and verify that a PCH file is usable.
static void setLangDefaults(LangOptions &Opts, InputKind IK, LangStandard::Kind LangStd=LangStandard::lang_unspecified)
Set language defaults for the given input language and language standard in the given LangOptions obj...
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.
std::string LinkBitcodeFile
The name of the bitcode file to link before optzns.
std::shared_ptr< llvm::Regex > OptimizationRemarkAnalysisPattern
std::vector< std::string > FeaturesAsWritten
The list of target specific features to enable or disable, as written on the command line...
PragmaMSPointersToMembersKind
unsigned GenerateGlobalModuleIndex
void addMacroDef(StringRef Name)
'#include ""' paths, added by 'gcc -iquote'.
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.
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.
if(T->getSizeExpr()) TRY_TO(TraverseStmt(T-> getSizeExpr()))
DependencyOutputFormat OutputFormat
The format for the dependency file.
unsigned IncludeGlobals
Show top-level decls in code completion results.
std::string OverflowHandler
The name of the handler function to be called when -ftrapv is specified.
bool tryParse(StringRef string)
Try to parse the given string as a version number.
static ParsedSourceLocation FromString(StringRef Str)
PreprocessorOptions & getPreprocessorOpts()
frontend::ActionKind ProgramAction
The frontend action to perform.
Enable migration to NS_ENUM/NS_OPTIONS macros.
std::string ARCMTMigrateReportOut
Like System, but only used for C.
unsigned UseGlobalModuleIndex
AnalysisConstraints AnalysisConstraintsOpt
Helper class for holding the data necessary to invoke the compiler.
DiagnosticOptions & getDiagnosticOpts() const
std::string DebugCompilationDir
The string to embed in debug information as the current working directory.
std::string AnalyzeSpecificFunction
enum clang::FrontendOptions::@156 ARCMTAction
FrontendOptions - Options for controlling the behavior of the frontend.
static bool ParseMigratorArgs(MigratorOptions &Opts, ArgList &Args)
SanitizerMask parseSanitizerValue(StringRef Value, bool AllowGroups)
std::string ImplementationOfModule
The name of the module that the translation unit is an implementation of. Prevents semantic imports...
static void ParseHeaderSearchArgs(HeaderSearchOptions &Opts, ArgList &Args)
unsigned IncludeBriefComments
Show brief documentation comments in code completion results.
void BuryPointer(const void *Ptr)
Parse ASTs and dump them.
CodeCompleteOptions CodeCompleteOpts
std::vector< std::string > AddPluginActions
The list of plugin actions to run in addition to the normal action.
Optional< unsigned > getSubminor() const
Retrieve the subminor version number, if provided.
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.
llvm::opt::OptTable * createDriverOptTable()
unsigned AnalyzerDisplayProgress
~CompilerInvocationBase()
Keeps track of options that affect how file operations are performed.
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)
unsigned ShowMacroComments
Show comments, even in macros.
Enable converting setter/getter expressions to property-dot syntx.
unsigned AnalyzeNestedBlocks
unsigned NoRetryExhausted
Do not re-analyze paths leading to exhausted nodes with a different strategy. We get better code cove...
unsigned IncludeMacros
Show macros in code completion results.
std::string ActionName
The name of the action to run when using a plugin action.
unsigned ShowLineMarkers
Show #line markers.
FileSystemOptions & getFileSystemOpts()
static unsigned getOptimizationLevelSize(ArgList &Args)
Run one or more source code analyses.
#define LANGSTANDARD(id, name, desc, features)
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
std::string InstrProfileOutput
DiagnosticLevelMask
A bitmask representing the diagnostic levels used by VerifyDiagnosticConsumer.
Generate complete debug info.
Dump information about a module file.
#define CLANG_VERSION_STRING
A string that describes the Clang version number, e.g., "1.0".
unsigned AddMissingHeaderDeps
Add missing headers to dependency list.
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.
std::vector< std::string > BackendOptions
A list of command-line options to forward to the LLVM backend.
prefer 'atomic' property over 'nonatomic'.
Generate pre-tokenized header.
static void ParseLangArgs(LangOptions &Opts, ArgList &Args, InputKind IK, DiagnosticsEngine &Diags)
static InputKind getInputKindForExtension(StringRef Extension)
std::string ObjCConstantStringClass
use NS_NONATOMIC_IOSONLY for property 'atomic' attribute
#define ANALYSIS_INLINING_MODE(NAME, CMDFLAG, DESC)
AnalysisPurgeMode AnalysisPurgeOpt
LangOptions * getLangOpts()
unsigned PrintShowIncludes
Print cl.exe style /showIncludes info.
bool DumpDeserializedPCHDecls
Dump declarations that are deserialized from PCH, for testing.
#define ANALYSIS_PURGE(NAME, CMDFLAG, DESC)
static void parseSanitizerKinds(StringRef FlagName, const std::vector< std::string > &Sanitizers, DiagnosticsEngine &Diags, SanitizerSet &S)
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 hasHexFloats() const
hasHexFloats - Language supports hexadecimal float constants.
std::vector< std::string > ModuleMapFiles
The list of module map files to load before processing the input.