diff options
Diffstat (limited to 'include/clang/Driver')
-rw-r--r-- | include/clang/Driver/Action.h | 26 | ||||
-rw-r--r-- | include/clang/Driver/CC1Options.td | 16 | ||||
-rw-r--r-- | include/clang/Driver/CLCompatOptions.td | 14 | ||||
-rw-r--r-- | include/clang/Driver/Driver.h | 14 | ||||
-rw-r--r-- | include/clang/Driver/Options.h | 2 | ||||
-rw-r--r-- | include/clang/Driver/Options.td | 136 | ||||
-rw-r--r-- | include/clang/Driver/Phases.h | 3 | ||||
-rw-r--r-- | include/clang/Driver/SanitizerArgs.h | 7 | ||||
-rw-r--r-- | include/clang/Driver/ToolChain.h | 9 | ||||
-rw-r--r-- | include/clang/Driver/Types.def | 123 | ||||
-rw-r--r-- | include/clang/Driver/Types.h | 7 |
11 files changed, 256 insertions, 101 deletions
diff --git a/include/clang/Driver/Action.h b/include/clang/Driver/Action.h index c1ff0b1a60230..8ccbb6c2bbfa2 100644 --- a/include/clang/Driver/Action.h +++ b/include/clang/Driver/Action.h @@ -65,15 +65,17 @@ public: BackendJobClass, AssembleJobClass, LinkJobClass, + IfsMergeJobClass, LipoJobClass, DsymutilJobClass, VerifyDebugInfoJobClass, VerifyPCHJobClass, OffloadBundlingJobClass, OffloadUnbundlingJobClass, + OffloadWrapperJobClass, JobClassFirst = PreprocessJobClass, - JobClassLast = OffloadUnbundlingJobClass + JobClassLast = OffloadWrapperJobClass }; // The offloading kind determines if this action is binded to a particular @@ -485,6 +487,17 @@ public: } }; +class IfsMergeJobAction : public JobAction { + void anchor() override; + +public: + IfsMergeJobAction(ActionList &Inputs, types::ID Type); + + static bool classof(const Action *A) { + return A->getKind() == IfsMergeJobClass; + } +}; + class LinkJobAction : public JobAction { void anchor() override; @@ -613,6 +626,17 @@ public: } }; +class OffloadWrapperJobAction : public JobAction { + void anchor() override; + +public: + OffloadWrapperJobAction(ActionList &Inputs, types::ID Type); + + static bool classof(const Action *A) { + return A->getKind() == OffloadWrapperJobClass; + } +}; + } // namespace driver } // namespace clang diff --git a/include/clang/Driver/CC1Options.td b/include/clang/Driver/CC1Options.td index 1f6c000ecf6a1..4518aca82ef6b 100644 --- a/include/clang/Driver/CC1Options.td +++ b/include/clang/Driver/CC1Options.td @@ -140,7 +140,8 @@ def analyzer_checker_help_developer : Flag<["-"], "analyzer-checker-help-develop "and debug checkers">; def analyzer_config_help : Flag<["-"], "analyzer-config-help">, - HelpText<"Display the list of -analyzer-config options">; + HelpText<"Display the list of -analyzer-config options. These are meant for " + "development purposes only!">; def analyzer_list_enabled_checkers : Flag<["-"], "analyzer-list-enabled-checkers">, HelpText<"Display the list of enabled analyzer checkers">; @@ -200,6 +201,8 @@ def compress_debug_sections_EQ : Joined<["-", "--"], "compress-debug-sections="> HelpText<"DWARF debug sections compression type">; def mno_exec_stack : Flag<["-"], "mnoexecstack">, HelpText<"Mark the file as not needing an executable stack">; +def massembler_no_warn : Flag<["-"], "massembler-no-warn">, + HelpText<"Make assembler not emit warnings">; def massembler_fatal_warnings : Flag<["-"], "massembler-fatal-warnings">, HelpText<"Make assembler warnings fatal">; def mrelax_relocations : Flag<["--"], "mrelax-relocations">, @@ -285,8 +288,8 @@ def mcode_model : Separate<["-"], "mcode-model">, HelpText<"The code model to use">, Values<"tiny,small,kernel,medium,large">; def mdebug_pass : Separate<["-"], "mdebug-pass">, HelpText<"Enable additional debug output">; -def mdisable_fp_elim : Flag<["-"], "mdisable-fp-elim">, - HelpText<"Disable frame pointer elimination optimization">; +def mframe_pointer_EQ : Joined<["-"], "mframe-pointer=">, + HelpText<"Specify which frame pointers to retain (all, non-leaf, none).">, Values<"all,non-leaf,none">; def mdisable_tail_calls : Flag<["-"], "mdisable-tail-calls">, HelpText<"Disable tail call optimization, keeping the call stack accurate">; def menable_no_infinities : Flag<["-"], "menable-no-infs">, @@ -684,7 +687,7 @@ let Flags = [CC1Option, CC1AsOption, NoDriverOption] in { def version : Flag<["-"], "version">, HelpText<"Print the compiler version">; def main_file_name : Separate<["-"], "main-file-name">, - HelpText<"Main file name to use for debug info">; + HelpText<"Main file name to use for debug info and source if missing">; def split_dwarf_output : Separate<["-"], "split-dwarf-output">, HelpText<"File name to use for split dwarf debug info output">; @@ -812,6 +815,9 @@ def fdisable_module_hash : Flag<["-"], "fdisable-module-hash">, HelpText<"Disable the module hash">; def fmodules_hash_content : Flag<["-"], "fmodules-hash-content">, HelpText<"Enable hashing the content of a module file">; +def fmodules_strict_context_hash : Flag<["-"], "fmodules-strict-context-hash">, + HelpText<"Enable hashing of all compiler options that could impact the " + "semantics of a module in an implicit build">; def c_isystem : JoinedOrSeparate<["-"], "c-isystem">, MetaVarName<"<directory>">, HelpText<"Add directory to the C SYSTEM include search path">; def objc_isystem : JoinedOrSeparate<["-"], "objc-isystem">, @@ -843,6 +849,8 @@ def preamble_bytes_EQ : Joined<["-"], "preamble-bytes=">, "covering the first N bytes of the main file">; def detailed_preprocessing_record : Flag<["-"], "detailed-preprocessing-record">, HelpText<"include a detailed record of preprocessing actions">; +def setup_static_analyzer : Flag<["-"], "setup-static-analyzer">, + HelpText<"Set up preprocessor for static analyzer (done automatically when static analyzer is run).">; //===----------------------------------------------------------------------===// // OpenCL Options diff --git a/include/clang/Driver/CLCompatOptions.td b/include/clang/Driver/CLCompatOptions.td index a0af3035ea46b..50d4622009c95 100644 --- a/include/clang/Driver/CLCompatOptions.td +++ b/include/clang/Driver/CLCompatOptions.td @@ -254,7 +254,13 @@ def _SLASH_Zp_flag : CLFlag<"Zp">, Alias<fpack_struct_EQ>, AliasArgs<["1"]>; def _SLASH_Zs : CLFlag<"Zs">, HelpText<"Syntax-check only">, Alias<fsyntax_only>; - +def _SLASH_openmp_ : CLFlag<"openmp-">, + HelpText<"Disable OpenMP support">, Alias<fno_openmp>; +def _SLASH_openmp : CLFlag<"openmp">, HelpText<"Enable OpenMP support">, + Alias<fopenmp>; +def _SLASH_openmp_experimental : CLFlag<"openmp:experimental">, + HelpText<"Enable OpenMP support with experimental SIMD support">, + Alias<fopenmp>; // Non-aliases: @@ -381,7 +387,6 @@ def _SLASH_FS : CLIgnoredFlag<"FS">; def _SLASH_JMC : CLIgnoredFlag<"JMC">; def _SLASH_kernel_ : CLIgnoredFlag<"kernel-">; def _SLASH_nologo : CLIgnoredFlag<"nologo">; -def _SLASH_openmp_ : CLIgnoredFlag<"openmp-">; def _SLASH_permissive_ : CLIgnoredFlag<"permissive-">; def _SLASH_RTC : CLIgnoredJoined<"RTC">; def _SLASH_sdl : CLIgnoredFlag<"sdl">; @@ -396,6 +401,9 @@ def _SLASH_Zc_inline : CLIgnoredFlag<"Zc:inline">; def _SLASH_Zc_rvalueCast : CLIgnoredFlag<"Zc:rvalueCast">; def _SLASH_Zc_ternary : CLIgnoredFlag<"Zc:ternary">; def _SLASH_Zc_wchar_t : CLIgnoredFlag<"Zc:wchar_t">; +def _SLASH_ZH_MD5 : CLIgnoredFlag<"ZH:MD5">; +def _SLASH_ZH_SHA1 : CLIgnoredFlag<"ZH:SHA1">; +def _SLASH_ZH_SHA_256 : CLIgnoredFlag<"ZH:SHA_256">; def _SLASH_Zm : CLIgnoredJoined<"Zm">; def _SLASH_Zo : CLIgnoredFlag<"Zo">; def _SLASH_Zo_ : CLIgnoredFlag<"Zo-">; @@ -436,8 +444,6 @@ def _SLASH_hotpatch : CLFlag<"hotpatch">; def _SLASH_kernel : CLFlag<"kernel">; def _SLASH_LN : CLFlag<"LN">; def _SLASH_MP : CLJoined<"MP">; -def _SLASH_openmp : CLFlag<"openmp">; -def _SLASH_openmp_experimental : CLFlag<"openmp:experimental">; def _SLASH_Qfast_transcendentals : CLFlag<"Qfast_transcendentals">; def _SLASH_QIfist : CLFlag<"QIfist">; def _SLASH_Qimprecise_fwaits : CLFlag<"Qimprecise_fwaits">; diff --git a/include/clang/Driver/Driver.h b/include/clang/Driver/Driver.h index f9528641073a4..5e7283e31ee06 100644 --- a/include/clang/Driver/Driver.h +++ b/include/clang/Driver/Driver.h @@ -12,12 +12,14 @@ #include "clang/Basic/Diagnostic.h" #include "clang/Basic/LLVM.h" #include "clang/Driver/Action.h" +#include "clang/Driver/Options.h" #include "clang/Driver/Phases.h" #include "clang/Driver/ToolChain.h" #include "clang/Driver/Types.h" #include "clang/Driver/Util.h" #include "llvm/ADT/StringMap.h" #include "llvm/ADT/StringRef.h" +#include "llvm/Option/Arg.h" #include "llvm/Option/ArgList.h" #include "llvm/Support/StringSaver.h" @@ -55,8 +57,6 @@ enum LTOKind { /// Driver - Encapsulate logic for constructing compilation processes /// from a set of gcc-driver-like command line arguments. class Driver { - std::unique_ptr<llvm::opt::OptTable> Opts; - DiagnosticsEngine &Diags; IntrusiveRefCntPtr<llvm::vfs::FileSystem> VFS; @@ -250,9 +250,17 @@ private: // getFinalPhase - Determine which compilation mode we are in and record // which option we used to determine the final phase. + // TODO: Much of what getFinalPhase returns are not actually true compiler + // modes. Fold this functionality into Types::getCompilationPhases and + // handleArguments. phases::ID getFinalPhase(const llvm::opt::DerivedArgList &DAL, llvm::opt::Arg **FinalPhaseArg = nullptr) const; + // handleArguments - All code related to claiming and printing diagnostics + // related to arguments to the driver are done here. + void handleArguments(Compilation &C, llvm::opt::DerivedArgList &Args, + const InputList &Inputs, ActionList &Actions) const; + // Before executing jobs, sets up response files for commands that need them. void setUpResponseFiles(Compilation &C, Command &Cmd); @@ -292,7 +300,7 @@ public: const std::string &getConfigFile() const { return ConfigFile; } - const llvm::opt::OptTable &getOpts() const { return *Opts; } + const llvm::opt::OptTable &getOpts() const { return getDriverOptTable(); } const DiagnosticsEngine &getDiags() const { return Diags; } diff --git a/include/clang/Driver/Options.h b/include/clang/Driver/Options.h index f8963d48112a0..7c5cddd9e8960 100644 --- a/include/clang/Driver/Options.h +++ b/include/clang/Driver/Options.h @@ -47,7 +47,7 @@ enum ID { }; } -std::unique_ptr<llvm::opt::OptTable> createDriverOptTable(); +const llvm::opt::OptTable &getDriverOptTable(); } } diff --git a/include/clang/Driver/Options.td b/include/clang/Driver/Options.td index dfd27fab796e3..3ce6fcf29f94f 100644 --- a/include/clang/Driver/Options.td +++ b/include/clang/Driver/Options.td @@ -211,6 +211,10 @@ def clang_ignored_legacy_options_Group : OptionGroup<"<clang legacy flags>">, def : Flag<["-"], "fslp-vectorize-aggressive">, Group<clang_ignored_legacy_options_Group>; def : Flag<["-"], "fno-slp-vectorize-aggressive">, Group<clang_ignored_legacy_options_Group>; +// Retired with clang-10.0. Previously controlled X86 MPX ISA. +def mmpx : Flag<["-"], "mmpx">, Group<clang_ignored_legacy_options_Group>; +def mno_mpx : Flag<["-"], "mno-mpx">, Group<clang_ignored_legacy_options_Group>; + // Group that ignores all gcc optimizations that won't be implemented def clang_ignored_gcc_optimization_f_Group : OptionGroup< "<clang_ignored_gcc_optimization_f_Group>">, Group<f_Group>, Flags<[Ignored]>; @@ -280,6 +284,8 @@ def arcmt_migrate_emit_arc_errors : Flag<["-"], "arcmt-migrate-emit-errors">, Flags<[CC1Option]>; def gen_reproducer: Flag<["-"], "gen-reproducer">, InternalDebugOpt, HelpText<"Auto-generates preprocessed source files and a reproduction script">; +def gen_cdb_fragment_path: Separate<["-"], "gen-cdb-fragment-path">, InternalDebugOpt, + HelpText<"Emit a compilation database fragment to the specified directory">; def _migrate : Flag<["--"], "migrate">, Flags<[DriverOption]>, HelpText<"Run the migrator">; @@ -518,7 +524,7 @@ def cl_mad_enable : Flag<["-"], "cl-mad-enable">, Group<opencl_Group>, Flags<[CC def cl_no_signed_zeros : Flag<["-"], "cl-no-signed-zeros">, Group<opencl_Group>, Flags<[CC1Option]>, HelpText<"OpenCL only. Allow use of less precise no signed zeros computations in the generated binary.">; def cl_std_EQ : Joined<["-"], "cl-std=">, Group<opencl_Group>, Flags<[CC1Option]>, - HelpText<"OpenCL language standard to compile for.">, Values<"cl,CL,cl1.1,CL1.1,cl1.2,CL1.2,cl2.0,CL2.0,c++">; + HelpText<"OpenCL language standard to compile for.">, Values<"cl,CL,cl1.1,CL1.1,cl1.2,CL1.2,cl2.0,CL2.0,clc++,CLC++">; def cl_denorms_are_zero : Flag<["-"], "cl-denorms-are-zero">, Group<opencl_Group>, Flags<[CC1Option]>, HelpText<"OpenCL only. Allow denormals to be flushed to zero.">; def cl_fp32_correctly_rounded_divide_sqrt : Flag<["-"], "cl-fp32-correctly-rounded-divide-sqrt">, Group<opencl_Group>, Flags<[CC1Option]>, @@ -593,9 +599,11 @@ def hip_device_lib_EQ : Joined<["--"], "hip-device-lib=">, Group<Link_Group>, HelpText<"HIP device library">; def fhip_dump_offload_linker_script : Flag<["-"], "fhip-dump-offload-linker-script">, Group<f_Group>, Flags<[NoArgumentUnused, HelpHidden]>; +def fhip_new_launch_api : Flag<["-"], "fhip-new-launch-api">, + Flags<[CC1Option]>, HelpText<"Use new kernel launching API for HIP.">; +def fno_hip_new_launch_api : Flag<["-"], "fno-hip-new-launch-api">; def libomptarget_nvptx_path_EQ : Joined<["--"], "libomptarget-nvptx-path=">, Group<i_Group>, HelpText<"Path to libomptarget-nvptx libraries">; -def dA : Flag<["-"], "dA">, Group<d_Group>; def dD : Flag<["-"], "dD">, Group<d_Group>, Flags<[CC1Option]>, HelpText<"Print macro definitions in -E mode in addition to normal output">; def dI : Flag<["-"], "dI">, Group<d_Group>, Flags<[CC1Option]>, @@ -623,9 +631,12 @@ def emit_ast : Flag<["-"], "emit-ast">, HelpText<"Emit Clang AST files for source inputs">; def emit_llvm : Flag<["-"], "emit-llvm">, Flags<[CC1Option]>, Group<Action_Group>, HelpText<"Use the LLVM representation for assembler and object files">; -def emit_iterface_stubs : Flag<["-"], "emit-interface-stubs">, Flags<[CC1Option]>, Group<Action_Group>, +def emit_interface_stubs : Flag<["-"], "emit-interface-stubs">, Flags<[CC1Option]>, Group<Action_Group>, HelpText<"Generate Inteface Stub Files.">; -def iterface_stub_version_EQ : JoinedOrSeparate<["-"], "interface-stub-version=">, Flags<[CC1Option]>; +def emit_merged_ifs : Flag<["-"], "emit-merged-ifs">, + Flags<[CC1Option]>, Group<Action_Group>, + HelpText<"Generate Interface Stub Files, emit merged text not binary.">; +def interface_stub_version_EQ : JoinedOrSeparate<["-"], "interface-stub-version=">, Flags<[CC1Option]>; def exported__symbols__list : Separate<["-"], "exported_symbols_list">; def e : JoinedOrSeparate<["-"], "e">, Group<Link_Group>; def fPIC : Flag<["-"], "fPIC">, Group<f_Group>; @@ -833,6 +844,10 @@ def fconstant_cfstrings : Flag<["-"], "fconstant-cfstrings">, Group<f_Group>; def fconstant_string_class_EQ : Joined<["-"], "fconstant-string-class=">, Group<f_Group>; def fconstexpr_depth_EQ : Joined<["-"], "fconstexpr-depth=">, Group<f_Group>; def fconstexpr_steps_EQ : Joined<["-"], "fconstexpr-steps=">, Group<f_Group>; +def fexperimental_new_constant_interpreter : Flag<["-"], "fexperimental-new-constant-interpreter">, Group<f_Group>, + HelpText<"Enable the experimental new constant interpreter">, Flags<[CC1Option]>; +def fforce_experimental_new_constant_interpreter : Flag<["-"], "fforce-experimental-new-constant-interpreter">, Group<f_Group>, + HelpText<"Force the use of the experimental new constant interpreter, failing on missing features">, Flags<[CC1Option]>; def fconstexpr_backtrace_limit_EQ : Joined<["-"], "fconstexpr-backtrace-limit=">, Group<f_Group>; def fno_crash_diagnostics : Flag<["-"], "fno-crash-diagnostics">, Group<f_clang_Group>, Flags<[NoArgumentUnused, CoreOption]>, @@ -899,6 +914,8 @@ def fsjlj_exceptions : Flag<["-"], "fsjlj-exceptions">, Group<f_Group>, Flags<[CC1Option]>, HelpText<"Use SjLj style exceptions">; def fseh_exceptions : Flag<["-"], "fseh-exceptions">, Group<f_Group>, Flags<[CC1Option]>, HelpText<"Use SEH style exceptions">; +def fwasm_exceptions : Flag<["-"], "fwasm-exceptions">, Group<f_Group>, + Flags<[CC1Option]>, HelpText<"Use WebAssembly style exceptions">; def fexcess_precision_EQ : Joined<["-"], "fexcess-precision=">, Group<clang_ignored_gcc_optimization_f_Group>; def : Flag<["-"], "fexpensive-optimizations">, Group<clang_ignored_gcc_optimization_f_Group>; @@ -1043,8 +1060,14 @@ def fsanitize_minimal_runtime : Flag<["-"], "fsanitize-minimal-runtime">, Group<f_clang_Group>; def fno_sanitize_minimal_runtime : Flag<["-"], "fno-sanitize-minimal-runtime">, Group<f_clang_Group>; +def fsanitize_link_runtime : Flag<["-"], "fsanitize-link-runtime">, + Group<f_clang_Group>; +def fno_sanitize_link_runtime : Flag<["-"], "fno-sanitize-link-runtime">, + Group<f_clang_Group>; def fsanitize_link_cxx_runtime : Flag<["-"], "fsanitize-link-c++-runtime">, Group<f_clang_Group>; +def fno_sanitize_link_cxx_runtime : Flag<["-"], "fno-sanitize-link-c++-runtime">, + Group<f_clang_Group>; def fsanitize_cfi_cross_dso : Flag<["-"], "fsanitize-cfi-cross-dso">, Group<f_clang_Group>, HelpText<"Enable control flow integrity (CFI) checks for cross-DSO calls.">; @@ -1055,6 +1078,13 @@ def fno_sanitize_cfi_cross_dso : Flag<["-"], "fno-sanitize-cfi-cross-dso">, def fsanitize_cfi_icall_generalize_pointers : Flag<["-"], "fsanitize-cfi-icall-generalize-pointers">, Group<f_clang_Group>, HelpText<"Generalize pointers in CFI indirect call type signature checks">; +def fsanitize_cfi_canonical_jump_tables : Flag<["-"], "fsanitize-cfi-canonical-jump-tables">, + Group<f_clang_Group>, + HelpText<"Make the jump table addresses canonical in the symbol table">; +def fno_sanitize_cfi_canonical_jump_tables : Flag<["-"], "fno-sanitize-cfi-canonical-jump-tables">, + Group<f_clang_Group>, + Flags<[CoreOption, DriverOption]>, + HelpText<"Do not make the jump table addresses canonical in the symbol table">; def fsanitize_stats : Flag<["-"], "fsanitize-stats">, Group<f_clang_Group>, HelpText<"Enable sanitizer statistics gathering.">; @@ -1117,7 +1147,8 @@ def ftrapping_math : Flag<["-"], "ftrapping-math">, Group<f_Group>, Flags<[CC1Op def fno_trapping_math : Flag<["-"], "fno-trapping-math">, Group<f_Group>, Flags<[CC1Option]>; def ffp_contract : Joined<["-"], "ffp-contract=">, Group<f_Group>, Flags<[CC1Option]>, HelpText<"Form fused FP ops (e.g. FMAs): fast (everywhere)" - " | on (according to FP_CONTRACT pragma, default) | off (never fuse)">, Values<"fast,on,off">; + " | on (according to FP_CONTRACT pragma) | off (never fuse). Default" + " is 'fast' for CUDA/HIP and 'on' otherwise.">, Values<"fast,on,off">; def fstrict_float_cast_overflow : Flag<["-"], "fstrict-float-cast-overflow">, Group<f_Group>, Flags<[CC1Option]>, @@ -1157,6 +1188,9 @@ def fno_use_line_directives : Flag<["-"], "fno-use-line-directives">, Group<f_Gr def ffreestanding : Flag<["-"], "ffreestanding">, Group<f_Group>, Flags<[CC1Option]>, HelpText<"Assert that the compilation takes place in a freestanding environment">; +def fgnuc_version_EQ : Joined<["-"], "fgnuc-version=">, Group<f_Group>, + HelpText<"Sets various macros to claim compatibility with the given GCC version (default is 4.2.1)">, + Flags<[CC1Option, CoreOption]>; def fgnu_keywords : Flag<["-"], "fgnu-keywords">, Group<f_Group>, Flags<[CC1Option]>, HelpText<"Allow GNU-extension keywords regardless of language standard">; def fgnu89_inline : Flag<["-"], "fgnu89-inline">, Group<f_Group>, Flags<[CC1Option]>, @@ -1254,7 +1288,10 @@ def fno_fine_grained_bitfield_accesses : Flag<["-"], HelpText<"Use large-integer access for consecutive bitfield runs.">; def flat__namespace : Flag<["-"], "flat_namespace">; -def flax_vector_conversions : Flag<["-"], "flax-vector-conversions">, Group<f_Group>; +def flax_vector_conversions_EQ : Joined<["-"], "flax-vector-conversions=">, Group<f_Group>, + HelpText<"Enable implicit vector bit-casts">, Values<"none,integer,all">, Flags<[CC1Option]>; +def flax_vector_conversions : Flag<["-"], "flax-vector-conversions">, Group<f_Group>, + Alias<flax_vector_conversions_EQ>, AliasArgs<["integer"]>; def flimited_precision_EQ : Joined<["-"], "flimited-precision=">, Group<f_Group>; def fapple_link_rtlib : Flag<["-"], "fapple-link-rtlib">, Group<f_Group>, HelpText<"Force linking the clang builtins runtime library">; @@ -1331,6 +1368,28 @@ def fmodules_validate_system_headers : Flag<["-"], "fmodules-validate-system-hea HelpText<"Validate the system headers that a module depends on when loading the module">; def fno_modules_validate_system_headers : Flag<["-"], "fno-modules-validate-system-headers">, Group<i_Group>, Flags<[DriverOption]>; + +def fvalidate_ast_input_files_content: + Flag <["-"], "fvalidate-ast-input-files-content">, + Group<f_Group>, Flags<[CC1Option]>, + HelpText<"Compute and store the hash of input files used to build an AST." + " Files with mismatching mtime's are considered valid" + " if both contents is identical">; +def fmodules_validate_input_files_content: + Flag <["-"], "fmodules-validate-input-files-content">, + Group<f_Group>, Flags<[DriverOption]>, + HelpText<"Validate PCM input files based on content if mtime differs">; +def fno_modules_validate_input_files_content: + Flag <["-"], "fno_modules-validate-input-files-content">, + Group<f_Group>, Flags<[DriverOption]>; +def fpch_validate_input_files_content: + Flag <["-"], "fpch-validate-input-files-content">, + Group<f_Group>, Flags<[DriverOption]>, + HelpText<"Validate PCH input files based on content if mtime differs">; +def fno_pch_validate_input_files_content: + Flag <["-"], "fno_pch-validate-input-files-content">, + Group<f_Group>, Flags<[DriverOption]>; + def fmodules : Flag <["-"], "fmodules">, Group<f_Group>, Flags<[DriverOption, CC1Option]>, HelpText<"Enable the 'modules' language feature">; @@ -1428,7 +1487,7 @@ def fno_experimental_new_pass_manager : Flag<["-"], "fno-experimental-new-pass-m def fveclib : Joined<["-"], "fveclib=">, Group<f_Group>, Flags<[CC1Option]>, HelpText<"Use the given vector functions library">, Values<"Accelerate,MASSV,SVML,none">; def fno_lax_vector_conversions : Flag<["-"], "fno-lax-vector-conversions">, Group<f_Group>, - HelpText<"Disallow implicit conversions between vectors with a different number of elements or different element types">, Flags<[CC1Option]>; + Alias<flax_vector_conversions_EQ>, AliasArgs<["none"]>; def fno_merge_all_constants : Flag<["-"], "fno-merge-all-constants">, Group<f_Group>, HelpText<"Disallow merging of constants">; def fno_modules : Flag <["-"], "fno-modules">, Group<f_Group>, @@ -1571,8 +1630,6 @@ def fnoopenmp_use_tls : Flag<["-"], "fnoopenmp-use-tls">, Group<f_Group>, Flags<[CC1Option, NoArgumentUnused, HelpHidden]>; def fopenmp_targets_EQ : CommaJoined<["-"], "fopenmp-targets=">, Flags<[DriverOption, CC1Option]>, HelpText<"Specify comma-separated list of triples OpenMP offloading targets to be supported">; -def fopenmp_dump_offload_linker_script : Flag<["-"], "fopenmp-dump-offload-linker-script">, - Group<f_Group>, Flags<[NoArgumentUnused, HelpHidden]>; def fopenmp_relocatable_target : Flag<["-"], "fopenmp-relocatable-target">, Group<f_Group>, Flags<[CC1Option, NoArgumentUnused, HelpHidden]>; def fnoopenmp_relocatable_target : Flag<["-"], "fnoopenmp-relocatable-target">, @@ -1598,6 +1655,8 @@ def fopenmp_optimistic_collapse : Flag<["-"], "fopenmp-optimistic-collapse">, Gr Flags<[CC1Option, NoArgumentUnused, HelpHidden]>; def fno_openmp_optimistic_collapse : Flag<["-"], "fno-openmp-optimistic-collapse">, Group<f_Group>, Flags<[NoArgumentUnused, HelpHidden]>; +def static_openmp: Flag<["-"], "static-openmp">, + HelpText<"Use the static host OpenMP runtime while linking.">; def fno_optimize_sibling_calls : Flag<["-"], "fno-optimize-sibling-calls">, Group<f_Group>; def foptimize_sibling_calls : Flag<["-"], "foptimize-sibling-calls">, Group<f_Group>; def fno_escaping_block_tail_calls : Flag<["-"], "fno-escaping-block-tail-calls">, Group<f_Group>, Flags<[CC1Option]>; @@ -1683,10 +1742,10 @@ def fstack_protector : Flag<["-"], "fstack-protector">, Group<f_Group>, "alloca, which are of greater size than ssp-buffer-size (default: 8 bytes). " "All variable sized calls to alloca are considered vulnerable">; def ftrivial_auto_var_init : Joined<["-"], "ftrivial-auto-var-init=">, Group<f_Group>, - Flags<[CC1Option]>, HelpText<"Initialize trivial automatic stack variables: uninitialized (default)" + Flags<[CC1Option, CoreOption]>, HelpText<"Initialize trivial automatic stack variables: uninitialized (default)" " | pattern">, Values<"uninitialized,pattern">; -def enable_trivial_var_init_zero : Joined<["-"], "enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang">, - Flags<[CC1Option]>, +def enable_trivial_var_init_zero : Flag<["-"], "enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang">, + Flags<[CC1Option, CoreOption]>, HelpText<"Trivial automatic variable initialization to zero is only here for benchmarks, it'll eventually be removed, and I'm OK with that because I'm only using it to benchmark">; def fstandalone_debug : Flag<["-"], "fstandalone-debug">, Group<f_Group>, Flags<[CoreOption]>, HelpText<"Emit full debug info for all types used by the program">; @@ -1757,7 +1816,16 @@ def Wframe_larger_than_EQ : Joined<["-"], "Wframe-larger-than=">, Group<f_Group> def : Flag<["-"], "fterminated-vtables">, Alias<fapple_kext>; def fthreadsafe_statics : Flag<["-"], "fthreadsafe-statics">, Group<f_Group>; def ftime_report : Flag<["-"], "ftime-report">, Group<f_Group>, Flags<[CC1Option]>; -def ftime_trace : Flag<["-"], "ftime-trace">, Group<f_Group>, Flags<[CC1Option, CoreOption]>; +def ftime_trace : Flag<["-"], "ftime-trace">, Group<f_Group>, + HelpText<"Turn on time profiler. Generates JSON file based on output filename.">, + DocBrief<[{ +Turn on time profiler. Generates JSON file based on output filename. Results +can be analyzed with chrome://tracing or `Speedscope App +<https://www.speedscope.app>`_ for flamegraph visualization.}]>, + Flags<[CC1Option, CoreOption]>; +def ftime_trace_granularity_EQ : Joined<["-"], "ftime-trace-granularity=">, Group<f_Group>, + HelpText<"Minimum time granularity (in microseconds) traced by time profiler">, + Flags<[CC1Option, CoreOption]>; def ftlsmodel_EQ : Joined<["-"], "ftls-model=">, Group<f_Group>, Flags<[CC1Option]>; def ftrapv : Flag<["-"], "ftrapv">, Group<f_Group>, Flags<[CC1Option]>, HelpText<"Trap on integer overflow">; @@ -1791,6 +1859,7 @@ def fuse_init_array : Flag<["-"], "fuse-init-array">, Group<f_Group>, Flags<[CC1 HelpText<"Use .init_array instead of .ctors">; def fno_var_tracking : Flag<["-"], "fno-var-tracking">, Group<clang_ignored_f_Group>; def fverbose_asm : Flag<["-"], "fverbose-asm">, Group<f_Group>; +def dA : Flag<["-"], "dA">, Alias<fverbose_asm>; def fvisibility_EQ : Joined<["-"], "fvisibility=">, Group<f_Group>, HelpText<"Set the default symbol visibility for all global declarations">, Values<"hidden,default">; def fvisibility_inlines_hidden : Flag<["-"], "fvisibility-inlines-hidden">, Group<f_Group>, @@ -1816,6 +1885,13 @@ def fforce_emit_vtables : Flag<["-"], "fforce-emit-vtables">, Group<f_Group>, HelpText<"Emits more virtual tables to improve devirtualization">; def fno_force_emit_vtables : Flag<["-"], "fno-force-emit-vtables">, Group<f_Group>, Flags<[CoreOption]>; + +def fvirtual_function_elimination : Flag<["-"], "fvirtual-function-elimination">, Group<f_Group>, + Flags<[CoreOption, CC1Option]>, + HelpText<"Enables dead virtual function elimination optimization. Requires -flto=full">; +def fno_virtual_function_elimination : Flag<["-"], "fno-virtual-function_elimination">, Group<f_Group>, + Flags<[CoreOption]>; + def fwrapv : Flag<["-"], "fwrapv">, Group<f_Group>, Flags<[CC1Option]>, HelpText<"Treat signed integer overflow as two's complement">; def fwritable_strings : Flag<["-"], "fwritable-strings">, Group<f_Group>, Flags<[CC1Option]>, @@ -2023,9 +2099,14 @@ def malign_jumps_EQ : Joined<["-"], "malign-jumps=">, Group<clang_ignored_m_Grou def mfancy_math_387 : Flag<["-"], "mfancy-math-387">, Group<clang_ignored_m_Group>; def mlong_calls : Flag<["-"], "mlong-calls">, Group<m_Group>, HelpText<"Generate branches with extended addressability, usually via indirect jumps.">; -def mlong_double_64 : Flag<["-"], "mlong-double-64">, Group<f_Group>, Flags<[CC1Option]>, +def LongDouble_Group : OptionGroup<"<LongDouble group>">, Group<m_Group>, + DocName<"Long double flags">, + DocBrief<[{Selects the long double implementation}]>; +def mlong_double_64 : Flag<["-"], "mlong-double-64">, Group<LongDouble_Group>, Flags<[CC1Option]>, HelpText<"Force long double to be 64 bits">; -def mlong_double_128 : Flag<["-"], "mlong-double-128">, Group<f_Group>, Flags<[CC1Option]>, +def mlong_double_80 : Flag<["-"], "mlong-double-80">, Group<LongDouble_Group>, Flags<[CC1Option]>, + HelpText<"Force long double to be 80 bits, padded to 128 bits for storage">; +def mlong_double_128 : Flag<["-"], "mlong-double-128">, Group<LongDouble_Group>, Flags<[CC1Option]>, HelpText<"Force long double to be 128 bits">; def mno_long_calls : Flag<["-"], "mno-long-calls">, Group<m_Group>, HelpText<"Restore the default behaviour of not generating long calls">; @@ -2138,6 +2219,12 @@ def msave_restore : Flag<["-"], "msave-restore">, Group<m_riscv_Features_Group>, HelpText<"Enable using library calls for save and restore">; def mno_save_restore : Flag<["-"], "mno-save-restore">, Group<m_riscv_Features_Group>, HelpText<"Disable using library calls for save and restore">; +def mcmodel_EQ_medlow : Flag<["-"], "mcmodel=medlow">, Group<m_riscv_Features_Group>, + Flags<[CC1Option]>, Alias<mcmodel_EQ>, AliasArgs<["small"]>, + HelpText<"Equivalent to -mcmodel=small, compatible with RISC-V gcc.">; +def mcmodel_EQ_medany : Flag<["-"], "mcmodel=medany">, Group<m_riscv_Features_Group>, + Flags<[CC1Option]>, Alias<mcmodel_EQ>, AliasArgs<["medium"]>, + HelpText<"Equivalent to -mcmodel=medium, compatible with RISC-V gcc.">; def munaligned_access : Flag<["-"], "munaligned-access">, Group<m_arm_Features_Group>, HelpText<"Allow memory accesses to be unaligned (AArch32/AArch64 only)">; @@ -2241,6 +2328,8 @@ def faltivec : Flag<["-"], "faltivec">, Group<f_Group>, Flags<[DriverOption]>; def fno_altivec : Flag<["-"], "fno-altivec">, Group<f_Group>, Flags<[DriverOption]>; def maltivec : Flag<["-"], "maltivec">, Group<m_ppc_Features_Group>; def mno_altivec : Flag<["-"], "mno-altivec">, Group<m_ppc_Features_Group>; +def mspe : Flag<["-"], "mspe">, Group<m_ppc_Features_Group>; +def mno_spe : Flag<["-"], "mno-spe">, Group<m_ppc_Features_Group>; def mvsx : Flag<["-"], "mvsx">, Group<m_ppc_Features_Group>; def mno_vsx : Flag<["-"], "mno-vsx">, Group<m_ppc_Features_Group>; def msecure_plt : Flag<["-"], "msecure-plt">, Group<m_ppc_Features_Group>; @@ -2309,7 +2398,7 @@ def mno_backchain : Flag<["-"], "mno-backchain">, Group<m_Group>, Flags<[DriverO def mno_warn_nonportable_cfstrings : Flag<["-"], "mno-warn-nonportable-cfstrings">, Group<m_Group>; def mno_omit_leaf_frame_pointer : Flag<["-"], "mno-omit-leaf-frame-pointer">, Group<m_Group>; def momit_leaf_frame_pointer : Flag<["-"], "momit-leaf-frame-pointer">, Group<m_Group>, - HelpText<"Omit frame pointer setup for leaf functions">, Flags<[CC1Option]>; + HelpText<"Omit frame pointer setup for leaf functions">; def moslib_EQ : Joined<["-"], "moslib=">, Group<m_Group>; def mpascal_strings : Flag<["-"], "mpascal-strings">, Alias<fpascal_strings>; def mred_zone : Flag<["-"], "mred-zone">, Group<m_Group>; @@ -2340,7 +2429,7 @@ def mpie_copy_relocations : Flag<["-"], "mpie-copy-relocations">, Group<m_Group> Flags<[CC1Option]>, HelpText<"Use copy relocations support for PIE builds">; def mno_pie_copy_relocations : Flag<["-"], "mno-pie-copy-relocations">, Group<m_Group>; -def mfentry : Flag<["-"], "mfentry">, HelpText<"Insert calls to fentry at function entry (x86 only)">, +def mfentry : Flag<["-"], "mfentry">, HelpText<"Insert calls to fentry at function entry (x86/SystemZ only)">, Flags<[CC1Option]>, Group<m_Group>; def mips16 : Flag<["-"], "mips16">, Group<m_mips_Features_Group>; def mno_mips16 : Flag<["-"], "mno-mips16">, Group<m_mips_Features_Group>; @@ -2506,7 +2595,9 @@ def no__dead__strip__inits__and__terms : Flag<["-"], "no_dead_strip_inits_and_te def nobuiltininc : Flag<["-"], "nobuiltininc">, Flags<[CC1Option, CoreOption]>, HelpText<"Disable builtin #include directories">; def nocudainc : Flag<["-"], "nocudainc">; -def nocudalib : Flag<["-"], "nocudalib">; +def nogpulib : Flag<["-"], "nogpulib">, + HelpText<"Do not link device library for CUDA/HIP device compilation">; +def : Flag<["-"], "nocudalib">, Alias<nogpulib>; def nodefaultlibs : Flag<["-"], "nodefaultlibs">; def nofixprebinding : Flag<["-"], "nofixprebinding">; def nolibc : Flag<["-"], "nolibc">; @@ -2627,11 +2718,15 @@ def std_EQ : Joined<["-", "--"], "std=">, Flags<[CC1Option]>, const char *Values = #define LANGSTANDARD(id, name, lang, desc, features) name "," #define LANGSTANDARD_ALIAS(id, alias) alias "," - #include "clang/Frontend/LangStandards.def" + #include "clang/Basic/LangStandards.def" ; }]>; def stdlib_EQ : Joined<["-", "--"], "stdlib=">, Flags<[CC1Option]>, HelpText<"C++ standard library to use">, Values<"libc++,libstdc++,platform">; +def stdlibxx_isystem : JoinedOrSeparate<["-"], "stdlib++-isystem">, + Group<clang_i_Group>, + HelpText<"Use directory as the C++ standard library include path">, + Flags<[DriverOption]>, MetaVarName<"<directory>">; def unwindlib_EQ : Joined<["-", "--"], "unwindlib=">, Flags<[CC1Option]>, HelpText<"Unwind library to use">, Values<"libgcc,unwindlib,platform">; def sub__library : JoinedOrSeparate<["-"], "sub_library">; @@ -2711,7 +2806,6 @@ def _mhwdiv : Separate<["--"], "mhwdiv">, Alias<mhwdiv_EQ>; def _CLASSPATH_EQ : Joined<["--"], "CLASSPATH=">, Alias<fclasspath_EQ>; def _CLASSPATH : Separate<["--"], "CLASSPATH">, Alias<fclasspath_EQ>; def _all_warnings : Flag<["--"], "all-warnings">, Alias<Wall>; -def _analyze_auto : Flag<["--"], "analyze-auto">, Flags<[DriverOption]>; def _analyzer_no_default_checks : Flag<["--"], "analyzer-no-default-checks">, Flags<[DriverOption]>; def _analyzer_output : JoinedOrSeparate<["--"], "analyzer-output">, Flags<[DriverOption]>, HelpText<"Static analyzer report output format (html|plist|plist-multi-file|plist-html|text).">; @@ -2972,8 +3066,6 @@ def mmovdiri : Flag<["-"], "mmovdiri">, Group<m_x86_Features_Group>; def mno_movdiri : Flag<["-"], "mno-movdiri">, Group<m_x86_Features_Group>; def mmovdir64b : Flag<["-"], "mmovdir64b">, Group<m_x86_Features_Group>; def mno_movdir64b : Flag<["-"], "mno-movdir64b">, Group<m_x86_Features_Group>; -def mmpx : Flag<["-"], "mmpx">, Group<m_x86_Features_Group>; -def mno_mpx : Flag<["-"], "mno-mpx">, Group<m_x86_Features_Group>; def mmwaitx : Flag<["-"], "mmwaitx">, Group<m_x86_Features_Group>; def mno_mwaitx : Flag<["-"], "mno-mwaitx">, Group<m_x86_Features_Group>; def mpku : Flag<["-"], "mpku">, Group<m_x86_Features_Group>; diff --git a/include/clang/Driver/Phases.h b/include/clang/Driver/Phases.h index 7199c657848ca..63931c00c8901 100644 --- a/include/clang/Driver/Phases.h +++ b/include/clang/Driver/Phases.h @@ -20,7 +20,8 @@ namespace phases { Compile, Backend, Assemble, - Link + Link, + IfsMerge, }; enum { diff --git a/include/clang/Driver/SanitizerArgs.h b/include/clang/Driver/SanitizerArgs.h index 957e752b68775..c37499e0f201f 100644 --- a/include/clang/Driver/SanitizerArgs.h +++ b/include/clang/Driver/SanitizerArgs.h @@ -32,6 +32,7 @@ class SanitizerArgs { bool MsanUseAfterDtor = true; bool CfiCrossDso = false; bool CfiICallGeneralizePointers = false; + bool CfiCanonicalJumpTables = false; int AsanFieldPadding = 0; bool SharedRuntime = false; bool AsanUseAfterScope = true; @@ -41,6 +42,7 @@ class SanitizerArgs { bool AsanInvalidPointerCmp = false; bool AsanInvalidPointerSub = false; std::string HwasanAbi; + bool LinkRuntimes = true; bool LinkCXXRuntimes = false; bool NeedPIE = false; bool SafeStackRuntime = false; @@ -59,7 +61,9 @@ class SanitizerArgs { bool needsSharedRt() const { return SharedRuntime; } bool needsAsanRt() const { return Sanitizers.has(SanitizerKind::Address); } - bool needsHwasanRt() const { return Sanitizers.has(SanitizerKind::HWAddress); } + bool needsHwasanRt() const { + return Sanitizers.has(SanitizerKind::HWAddress); + } bool needsTsanRt() const { return Sanitizers.has(SanitizerKind::Thread); } bool needsMsanRt() const { return Sanitizers.has(SanitizerKind::Memory); } bool needsFuzzer() const { return Sanitizers.has(SanitizerKind::Fuzzer); } @@ -80,6 +84,7 @@ class SanitizerArgs { bool requiresPIE() const; bool needsUnwindTables() const; bool needsLTO() const; + bool linkRuntimes() const { return LinkRuntimes; } bool linkCXXRuntimes() const { return LinkCXXRuntimes; } bool hasCrossDsoCfi() const { return CfiCrossDso; } bool hasAnySanitizer() const { return !Sanitizers.empty(); } diff --git a/include/clang/Driver/ToolChain.h b/include/clang/Driver/ToolChain.h index 7dd3db376c8c9..f0676eee2d6ce 100644 --- a/include/clang/Driver/ToolChain.h +++ b/include/clang/Driver/ToolChain.h @@ -136,13 +136,17 @@ private: mutable std::unique_ptr<Tool> Clang; mutable std::unique_ptr<Tool> Assemble; mutable std::unique_ptr<Tool> Link; + mutable std::unique_ptr<Tool> IfsMerge; mutable std::unique_ptr<Tool> OffloadBundler; + mutable std::unique_ptr<Tool> OffloadWrapper; Tool *getClang() const; Tool *getAssemble() const; Tool *getLink() const; + Tool *getIfsMerge() const; Tool *getClangAs() const; Tool *getOffloadBundler() const; + Tool *getOffloadWrapper() const; mutable std::unique_ptr<SanitizerArgs> SanitizerArguments; mutable std::unique_ptr<XRayArgs> XRayArguments; @@ -542,6 +546,11 @@ public: AddClangCXXStdlibIncludeArgs(const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args) const; + /// AddClangCXXStdlibIsystemArgs - Add the clang -cc1 level arguments to set + /// the specified include paths for the C++ standard library. + void AddClangCXXStdlibIsystemArgs(const llvm::opt::ArgList &DriverArgs, + llvm::opt::ArgStringList &CC1Args) const; + /// Returns if the C++ standard library should be linked in. /// Note that e.g. -lm should still be linked even if this returns false. bool ShouldLinkCXXStdlib(const llvm::opt::ArgList &Args) const; diff --git a/include/clang/Driver/Types.def b/include/clang/Driver/Types.def index b45789d4b3144..79e8d109cd97e 100644 --- a/include/clang/Driver/Types.def +++ b/include/clang/Driver/Types.def @@ -29,77 +29,74 @@ // The fourth value is the suffix to use when creating temporary files // of this type, or null if unspecified. -// The fifth value is a string containing option flags. Valid values: -// a - The type should only be assembled. -// p - The type should only be precompiled. -// u - The type can be user specified (with -x). -// m - Precompiling this type produces a module file. -// A - The type's temporary suffix should be appended when generating -// outputs of this type. - +// The final value is a variadic list of phases for each type. Eventually the +// options flag string will be replaced with this variadic list. +// Most of the options in Flags have been removed in favor of subsuming their +// meaning from the phases list. // C family source language (with and without preprocessing). -TYPE("cpp-output", PP_C, INVALID, "i", "u") -TYPE("c", C, PP_C, "c", "u") -TYPE("cl", CL, PP_C, "cl", "u") -TYPE("cuda-cpp-output", PP_CUDA, INVALID, "cui", "u") -TYPE("cuda", CUDA, PP_CUDA, "cu", "u") -TYPE("cuda", CUDA_DEVICE, PP_CUDA, "cu", "") -TYPE("hip-cpp-output", PP_HIP, INVALID, "cui", "u") -TYPE("hip", HIP, PP_HIP, "cu", "u") -TYPE("hip", HIP_DEVICE, PP_HIP, "cu", "") -TYPE("objective-c-cpp-output", PP_ObjC, INVALID, "mi", "u") -TYPE("objc-cpp-output", PP_ObjC_Alias, INVALID, "mi", "u") -TYPE("objective-c", ObjC, PP_ObjC, "m", "u") -TYPE("c++-cpp-output", PP_CXX, INVALID, "ii", "u") -TYPE("c++", CXX, PP_CXX, "cpp", "u") -TYPE("objective-c++-cpp-output", PP_ObjCXX, INVALID, "mii", "u") -TYPE("objc++-cpp-output", PP_ObjCXX_Alias, INVALID, "mii", "u") -TYPE("objective-c++", ObjCXX, PP_ObjCXX, "mm", "u") -TYPE("renderscript", RenderScript, PP_C, "rs", "u") +TYPE("cpp-output", PP_C, INVALID, "i", phases::Compile, phases::Backend, phases::Assemble, phases::Link) +TYPE("c", C, PP_C, "c", phases::Preprocess, phases::Compile, phases::Backend, phases::Assemble, phases::Link) +TYPE("cl", CL, PP_C, "cl", phases::Preprocess, phases::Compile, phases::Backend, phases::Assemble, phases::Link) +TYPE("cuda-cpp-output", PP_CUDA, INVALID, "cui", phases::Compile, phases::Backend, phases::Assemble, phases::Link) +TYPE("cuda", CUDA, PP_CUDA, "cu", phases::Preprocess, phases::Compile, phases::Backend, phases::Assemble, phases::Link) +TYPE("cuda", CUDA_DEVICE, PP_CUDA, "cu", phases::Preprocess, phases::Compile, phases::Backend, phases::Assemble, phases::Link) +TYPE("hip-cpp-output", PP_HIP, INVALID, "cui", phases::Compile, phases::Backend, phases::Assemble, phases::Link) +TYPE("hip", HIP, PP_HIP, "cu", phases::Preprocess, phases::Compile, phases::Backend, phases::Assemble, phases::Link) +TYPE("hip", HIP_DEVICE, PP_HIP, "cu", phases::Preprocess, phases::Compile, phases::Backend, phases::Assemble, phases::Link) +TYPE("objective-c-cpp-output", PP_ObjC, INVALID, "mi", phases::Compile, phases::Backend, phases::Assemble, phases::Link) +TYPE("objc-cpp-output", PP_ObjC_Alias, INVALID, "mi", phases::Compile, phases::Backend, phases::Assemble, phases::Link) +TYPE("objective-c", ObjC, PP_ObjC, "m", phases::Preprocess, phases::Compile, phases::Backend, phases::Assemble, phases::Link) +TYPE("c++-cpp-output", PP_CXX, INVALID, "ii", phases::Compile, phases::Backend, phases::Assemble, phases::Link) +TYPE("c++", CXX, PP_CXX, "cpp", phases::Preprocess, phases::Compile, phases::Backend, phases::Assemble, phases::Link) +TYPE("objective-c++-cpp-output", PP_ObjCXX, INVALID, "mii", phases::Compile, phases::Backend, phases::Assemble, phases::Link) +TYPE("objc++-cpp-output", PP_ObjCXX_Alias, INVALID, "mii", phases::Compile, phases::Backend, phases::Assemble, phases::Link) +TYPE("objective-c++", ObjCXX, PP_ObjCXX, "mm", phases::Preprocess, phases::Compile, phases::Backend, phases::Assemble, phases::Link) +TYPE("renderscript", RenderScript, PP_C, "rs", phases::Preprocess, phases::Compile, phases::Backend, phases::Assemble, phases::Link) // C family input files to precompile. -TYPE("c-header-cpp-output", PP_CHeader, INVALID, "i", "p") -TYPE("c-header", CHeader, PP_CHeader, "h", "pu") -TYPE("cl-header", CLHeader, PP_CHeader, "h", "pu") -TYPE("objective-c-header-cpp-output", PP_ObjCHeader, INVALID, "mi", "p") -TYPE("objective-c-header", ObjCHeader, PP_ObjCHeader, "h", "pu") -TYPE("c++-header-cpp-output", PP_CXXHeader, INVALID, "ii", "p") -TYPE("c++-header", CXXHeader, PP_CXXHeader, "hh", "pu") -TYPE("objective-c++-header-cpp-output", PP_ObjCXXHeader, INVALID, "mii", "p") -TYPE("objective-c++-header", ObjCXXHeader, PP_ObjCXXHeader, "h", "pu") -TYPE("c++-module", CXXModule, PP_CXXModule, "cppm", "mu") -TYPE("c++-module-cpp-output", PP_CXXModule, INVALID, "iim", "m") +TYPE("c-header-cpp-output", PP_CHeader, INVALID, "i", phases::Precompile) +TYPE("c-header", CHeader, PP_CHeader, "h", phases::Preprocess, phases::Precompile) +TYPE("cl-header", CLHeader, PP_CHeader, "h", phases::Preprocess, phases::Precompile) +TYPE("objective-c-header-cpp-output", PP_ObjCHeader, INVALID, "mi", phases::Precompile) +TYPE("objective-c-header", ObjCHeader, PP_ObjCHeader, "h", phases::Preprocess, phases::Precompile) +TYPE("c++-header-cpp-output", PP_CXXHeader, INVALID, "ii", phases::Precompile) +TYPE("c++-header", CXXHeader, PP_CXXHeader, "hh", phases::Preprocess, phases::Precompile) +TYPE("objective-c++-header-cpp-output", PP_ObjCXXHeader, INVALID, "mii", phases::Precompile) +TYPE("objective-c++-header", ObjCXXHeader, PP_ObjCXXHeader, "h", phases::Preprocess, phases::Precompile) +TYPE("c++-module", CXXModule, PP_CXXModule, "cppm", phases::Preprocess, phases::Precompile, phases::Compile, phases::Backend, phases::Assemble, phases::Link) +TYPE("c++-module-cpp-output", PP_CXXModule, INVALID, "iim", phases::Precompile, phases::Compile, phases::Backend, phases::Assemble, phases::Link) // Other languages. -TYPE("ada", Ada, INVALID, nullptr, "u") -TYPE("assembler", PP_Asm, INVALID, "s", "au") -TYPE("assembler-with-cpp", Asm, PP_Asm, "S", "au") -TYPE("f95", PP_Fortran, INVALID, nullptr, "u") -TYPE("f95-cpp-input", Fortran, PP_Fortran, nullptr, "u") -TYPE("java", Java, INVALID, nullptr, "u") +TYPE("ada", Ada, INVALID, nullptr, phases::Compile, phases::Backend, phases::Assemble, phases::Link) +TYPE("assembler", PP_Asm, INVALID, "s", phases::Assemble, phases::Link) +TYPE("assembler-with-cpp", Asm, PP_Asm, "S", phases::Preprocess, phases::Assemble, phases::Link) +TYPE("f95", PP_Fortran, INVALID, nullptr, phases::Compile, phases::Backend, phases::Assemble, phases::Link) +TYPE("f95-cpp-input", Fortran, PP_Fortran, nullptr, phases::Preprocess, phases::Compile, phases::Backend, phases::Assemble, phases::Link) +TYPE("java", Java, INVALID, nullptr, phases::Compile, phases::Backend, phases::Assemble, phases::Link) // LLVM IR/LTO types. We define separate types for IR and LTO because LTO // outputs should use the standard suffixes. -TYPE("ir", LLVM_IR, INVALID, "ll", "u") -TYPE("ir", LLVM_BC, INVALID, "bc", "u") -TYPE("lto-ir", LTO_IR, INVALID, "s", "") -TYPE("lto-bc", LTO_BC, INVALID, "o", "") +TYPE("ir", LLVM_IR, INVALID, "ll", phases::Compile, phases::Backend, phases::Assemble, phases::Link) +TYPE("ir", LLVM_BC, INVALID, "bc", phases::Compile, phases::Backend, phases::Assemble, phases::Link) +TYPE("lto-ir", LTO_IR, INVALID, "s", phases::Compile, phases::Backend, phases::Assemble, phases::Link) +TYPE("lto-bc", LTO_BC, INVALID, "o", phases::Compile, phases::Backend, phases::Assemble, phases::Link) // Misc. -TYPE("ast", AST, INVALID, "ast", "u") -TYPE("ifs", IFS, INVALID, "ifs", "u") -TYPE("pcm", ModuleFile, INVALID, "pcm", "u") -TYPE("plist", Plist, INVALID, "plist", "") -TYPE("rewritten-objc", RewrittenObjC,INVALID, "cpp", "") -TYPE("rewritten-legacy-objc", RewrittenLegacyObjC,INVALID, "cpp", "") -TYPE("remap", Remap, INVALID, "remap", "") -TYPE("precompiled-header", PCH, INVALID, "gch", "A") -TYPE("object", Object, INVALID, "o", "") -TYPE("treelang", Treelang, INVALID, nullptr, "u") -TYPE("image", Image, INVALID, "out", "") -TYPE("dSYM", dSYM, INVALID, "dSYM", "A") -TYPE("dependencies", Dependencies, INVALID, "d", "") -TYPE("cuda-fatbin", CUDA_FATBIN, INVALID, "fatbin","A") -TYPE("hip-fatbin", HIP_FATBIN, INVALID, "hipfb", "A") -TYPE("none", Nothing, INVALID, nullptr, "u") +TYPE("ast", AST, INVALID, "ast", phases::Compile, phases::Backend, phases::Assemble, phases::Link) +TYPE("ifs", IFS, INVALID, "ifs", phases::IfsMerge) +TYPE("ifs-cpp", IFS_CPP, INVALID, "ifs", phases::Compile, phases::IfsMerge) +TYPE("pcm", ModuleFile, INVALID, "pcm", phases::Compile, phases::Backend, phases::Assemble, phases::Link) +TYPE("plist", Plist, INVALID, "plist", phases::Compile, phases::Backend, phases::Assemble, phases::Link) +TYPE("rewritten-objc", RewrittenObjC,INVALID, "cpp", phases::Compile, phases::Backend, phases::Assemble, phases::Link) +TYPE("rewritten-legacy-objc", RewrittenLegacyObjC,INVALID, "cpp", phases::Compile, phases::Backend, phases::Assemble, phases::Link) +TYPE("remap", Remap, INVALID, "remap", phases::Compile, phases::Backend, phases::Assemble, phases::Link) +TYPE("precompiled-header", PCH, INVALID, "gch", phases::Compile, phases::Backend, phases::Assemble, phases::Link) +TYPE("object", Object, INVALID, "o", phases::Link) +TYPE("treelang", Treelang, INVALID, nullptr, phases::Compile, phases::Backend, phases::Assemble, phases::Link) +TYPE("image", Image, INVALID, "out", phases::Compile, phases::Backend, phases::Assemble, phases::Link) +TYPE("dSYM", dSYM, INVALID, "dSYM", phases::Compile, phases::Backend, phases::Assemble, phases::Link) +TYPE("dependencies", Dependencies, INVALID, "d", phases::Compile, phases::Backend, phases::Assemble, phases::Link) +TYPE("cuda-fatbin", CUDA_FATBIN, INVALID, "fatbin", phases::Compile, phases::Backend, phases::Assemble, phases::Link) +TYPE("hip-fatbin", HIP_FATBIN, INVALID, "hipfb", phases::Compile, phases::Backend, phases::Assemble, phases::Link) +TYPE("none", Nothing, INVALID, nullptr, phases::Compile, phases::Backend, phases::Assemble, phases::Link) diff --git a/include/clang/Driver/Types.h b/include/clang/Driver/Types.h index 53afada7abca4..a605450e6e3dd 100644 --- a/include/clang/Driver/Types.h +++ b/include/clang/Driver/Types.h @@ -11,16 +11,18 @@ #include "clang/Driver/Phases.h" #include "llvm/ADT/SmallVector.h" +#include "llvm/Option/ArgList.h" namespace llvm { class StringRef; } namespace clang { namespace driver { +class Driver; namespace types { enum ID { TY_INVALID, -#define TYPE(NAME, ID, PP_TYPE, TEMP_SUFFIX, FLAGS) TY_##ID, +#define TYPE(NAME, ID, PP_TYPE, TEMP_SUFFIX, ...) TY_##ID, #include "clang/Driver/Types.def" #undef TYPE TY_LAST @@ -100,6 +102,9 @@ namespace types { void getCompilationPhases( ID Id, llvm::SmallVectorImpl<phases::ID> &Phases); + void getCompilationPhases(const clang::driver::Driver &Driver, + llvm::opt::DerivedArgList &DAL, ID Id, + llvm::SmallVectorImpl<phases::ID> &Phases); /// lookupCXXTypeForCType - Lookup CXX input type that corresponds to given /// C type (used for clang++ emulation of g++ behaviour) |