diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2015-01-18 16:23:48 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2015-01-18 16:23:48 +0000 |
commit | 06d4ba388873e6d1cfa9cd715a8935ecc8cd2097 (patch) | |
tree | 3eb853da77d46cc77c4b017525a422f9ddb1385b /include/clang/Driver | |
parent | 30d791273d07fac9c0c1641a0731191bca6e8606 (diff) | |
download | src-test2-06d4ba388873e6d1cfa9cd715a8935ecc8cd2097.tar.gz src-test2-06d4ba388873e6d1cfa9cd715a8935ecc8cd2097.zip |
Notes
Diffstat (limited to 'include/clang/Driver')
-rw-r--r-- | include/clang/Driver/Action.h | 46 | ||||
-rw-r--r-- | include/clang/Driver/CC1Options.td | 29 | ||||
-rw-r--r-- | include/clang/Driver/CLCompatOptions.td | 30 | ||||
-rw-r--r-- | include/clang/Driver/Compilation.h | 6 | ||||
-rw-r--r-- | include/clang/Driver/Driver.h | 32 | ||||
-rw-r--r-- | include/clang/Driver/DriverDiagnostic.h | 4 | ||||
-rw-r--r-- | include/clang/Driver/Job.h | 70 | ||||
-rw-r--r-- | include/clang/Driver/Multilib.h | 16 | ||||
-rw-r--r-- | include/clang/Driver/Options.h | 4 | ||||
-rw-r--r-- | include/clang/Driver/Options.td | 179 | ||||
-rw-r--r-- | include/clang/Driver/Phases.h | 5 | ||||
-rw-r--r-- | include/clang/Driver/SanitizerArgs.h | 126 | ||||
-rw-r--r-- | include/clang/Driver/Tool.h | 62 | ||||
-rw-r--r-- | include/clang/Driver/ToolChain.h | 14 | ||||
-rw-r--r-- | include/clang/Driver/Types.h | 4 | ||||
-rw-r--r-- | include/clang/Driver/Util.h | 4 |
16 files changed, 434 insertions, 197 deletions
diff --git a/include/clang/Driver/Action.h b/include/clang/Driver/Action.h index 2cdb581b85c3..dd0261c2f3a1 100644 --- a/include/clang/Driver/Action.h +++ b/include/clang/Driver/Action.h @@ -7,8 +7,8 @@ // //===----------------------------------------------------------------------===// -#ifndef CLANG_DRIVER_ACTION_H_ -#define CLANG_DRIVER_ACTION_H_ +#ifndef LLVM_CLANG_DRIVER_ACTION_H +#define LLVM_CLANG_DRIVER_ACTION_H #include "clang/Driver/Types.h" #include "clang/Driver/Util.h" @@ -46,6 +46,7 @@ public: AnalyzeJobClass, MigrateJobClass, CompileJobClass, + BackendJobClass, AssembleJobClass, LinkJobClass, LipoJobClass, @@ -72,8 +73,12 @@ private: protected: Action(ActionClass _Kind, types::ID _Type) : Kind(_Kind), Type(_Type), OwnsInputs(true) {} - Action(ActionClass _Kind, Action *Input, types::ID _Type) - : Kind(_Kind), Type(_Type), Inputs(&Input, &Input + 1), OwnsInputs(true) {} + Action(ActionClass _Kind, std::unique_ptr<Action> Input, types::ID _Type) + : Kind(_Kind), Type(_Type), Inputs(1, Input.release()), OwnsInputs(true) { + } + Action(ActionClass _Kind, std::unique_ptr<Action> Input) + : Kind(_Kind), Type(Input->getType()), Inputs(1, Input.release()), + OwnsInputs(true) {} Action(ActionClass _Kind, const ActionList &_Inputs, types::ID _Type) : Kind(_Kind), Type(_Type), Inputs(_Inputs), OwnsInputs(true) {} public: @@ -119,7 +124,7 @@ class BindArchAction : public Action { const char *ArchName; public: - BindArchAction(Action *Input, const char *_ArchName); + BindArchAction(std::unique_ptr<Action> Input, const char *_ArchName); const char *getArchName() const { return ArchName; } @@ -131,7 +136,7 @@ public: class JobAction : public Action { virtual void anchor(); protected: - JobAction(ActionClass Kind, Action *Input, types::ID Type); + JobAction(ActionClass Kind, std::unique_ptr<Action> Input, types::ID Type); JobAction(ActionClass Kind, const ActionList &Inputs, types::ID Type); public: @@ -144,7 +149,7 @@ public: class PreprocessJobAction : public JobAction { void anchor() override; public: - PreprocessJobAction(Action *Input, types::ID OutputType); + PreprocessJobAction(std::unique_ptr<Action> Input, types::ID OutputType); static bool classof(const Action *A) { return A->getKind() == PreprocessJobClass; @@ -154,7 +159,7 @@ public: class PrecompileJobAction : public JobAction { void anchor() override; public: - PrecompileJobAction(Action *Input, types::ID OutputType); + PrecompileJobAction(std::unique_ptr<Action> Input, types::ID OutputType); static bool classof(const Action *A) { return A->getKind() == PrecompileJobClass; @@ -164,7 +169,7 @@ public: class AnalyzeJobAction : public JobAction { void anchor() override; public: - AnalyzeJobAction(Action *Input, types::ID OutputType); + AnalyzeJobAction(std::unique_ptr<Action> Input, types::ID OutputType); static bool classof(const Action *A) { return A->getKind() == AnalyzeJobClass; @@ -174,7 +179,7 @@ public: class MigrateJobAction : public JobAction { void anchor() override; public: - MigrateJobAction(Action *Input, types::ID OutputType); + MigrateJobAction(std::unique_ptr<Action> Input, types::ID OutputType); static bool classof(const Action *A) { return A->getKind() == MigrateJobClass; @@ -184,17 +189,27 @@ public: class CompileJobAction : public JobAction { void anchor() override; public: - CompileJobAction(Action *Input, types::ID OutputType); + CompileJobAction(std::unique_ptr<Action> Input, types::ID OutputType); static bool classof(const Action *A) { return A->getKind() == CompileJobClass; } }; +class BackendJobAction : public JobAction { + void anchor() override; +public: + BackendJobAction(std::unique_ptr<Action> Input, types::ID OutputType); + + static bool classof(const Action *A) { + return A->getKind() == BackendJobClass; + } +}; + class AssembleJobAction : public JobAction { void anchor() override; public: - AssembleJobAction(Action *Input, types::ID OutputType); + AssembleJobAction(std::unique_ptr<Action> Input, types::ID OutputType); static bool classof(const Action *A) { return A->getKind() == AssembleJobClass; @@ -234,7 +249,8 @@ public: class VerifyJobAction : public JobAction { void anchor() override; public: - VerifyJobAction(ActionClass Kind, Action *Input, types::ID Type); + VerifyJobAction(ActionClass Kind, std::unique_ptr<Action> Input, + types::ID Type); VerifyJobAction(ActionClass Kind, ActionList &Inputs, types::ID Type); static bool classof(const Action *A) { return A->getKind() == VerifyDebugInfoJobClass || @@ -245,7 +261,7 @@ public: class VerifyDebugInfoJobAction : public VerifyJobAction { void anchor() override; public: - VerifyDebugInfoJobAction(Action *Input, types::ID Type); + VerifyDebugInfoJobAction(std::unique_ptr<Action> Input, types::ID Type); static bool classof(const Action *A) { return A->getKind() == VerifyDebugInfoJobClass; } @@ -254,7 +270,7 @@ public: class VerifyPCHJobAction : public VerifyJobAction { void anchor() override; public: - VerifyPCHJobAction(Action *Input, types::ID Type); + VerifyPCHJobAction(std::unique_ptr<Action> Input, types::ID Type); static bool classof(const Action *A) { return A->getKind() == VerifyPCHJobClass; } diff --git a/include/clang/Driver/CC1Options.td b/include/clang/Driver/CC1Options.td index d25560c9f3ac..e0430014105c 100644 --- a/include/clang/Driver/CC1Options.td +++ b/include/clang/Driver/CC1Options.td @@ -108,6 +108,9 @@ def analyzer_disable_checker : Separate<["-"], "analyzer-disable-checker">, def analyzer_disable_checker_EQ : Joined<["-"], "analyzer-disable-checker=">, Alias<analyzer_disable_checker>; +def analyzer_disable_all_checks : Flag<["-"], "analyzer-disable-all-checks">, + HelpText<"Disable all static analyzer checks">; + def analyzer_checker_help : Flag<["-"], "analyzer-checker-help">, HelpText<"Display the list of analyzer checkers that are available">; @@ -135,6 +138,8 @@ def dwarf_debug_flags : Separate<["-"], "dwarf-debug-flags">, HelpText<"The string to embed in the Dwarf debug flags record.">; def mno_exec_stack : Flag<["-"], "mnoexecstack">, HelpText<"Mark the file as not needing an executable stack">; +def massembler_fatal_warnings : Flag<["-"], "massembler-fatal-warnings">, + HelpText<"Make assembler warnings fatal">; def compress_debug_sections : Flag<["-"], "compress-debug-sections">, HelpText<"Compress DWARF debug sections using zlib">; def msave_temp_labels : Flag<["-"], "msave-temp-labels">, @@ -164,6 +169,8 @@ def no_implicit_float : Flag<["-"], "no-implicit-float">, HelpText<"Don't generate implicit floating point instructions">; def fdump_vtable_layouts : Flag<["-"], "fdump-vtable-layouts">, HelpText<"Dump the layouts of all vtables that will be emitted in a translation unit">; +def fmerge_functions : Flag<["-"], "fmerge-functions">, + HelpText<"Permit merging of identical functions when optimizing.">; def femit_coverage_notes : Flag<["-"], "femit-coverage-notes">, HelpText<"Emit a gcov coverage notes file when compiling.">; def femit_coverage_data: Flag<["-"], "femit-coverage-data">, @@ -179,6 +186,8 @@ def coverage_version_EQ : Joined<["-"], "coverage-version=">, HelpText<"Four-byte version string for gcov files.">; def test_coverage : Flag<["-"], "test-coverage">, HelpText<"Do not generate coverage files or remove coverage changes from IR">; +def dump_coverage_mapping : Flag<["-"], "dump-coverage-mapping">, + HelpText<"Dump the coverage mapping records, for testing">; def fuse_register_sized_bitfield_access: Flag<["-"], "fuse-register-sized-bitfield-access">, HelpText<"Use register sized accesses to bit-fields, when possible.">; def relaxed_aliasing : Flag<["-"], "relaxed-aliasing">, @@ -270,6 +279,8 @@ def ftemplate_backtrace_limit : Separate<["-"], "ftemplate-backtrace-limit">, Me HelpText<"Set the maximum number of entries to print in a template instantiation backtrace (0 = no limit).">; def fconstexpr_backtrace_limit : Separate<["-"], "fconstexpr-backtrace-limit">, MetaVarName<"<N>">, HelpText<"Set the maximum number of entries to print in a constexpr evaluation backtrace (0 = no limit).">; +def fspell_checking_limit : Separate<["-"], "fspell-checking-limit">, MetaVarName<"<N>">, + HelpText<"Set the maximum number of times to perform spell checking on unrecognized identifiers (0 = no limit).">; def fmessage_length : Separate<["-"], "fmessage-length">, MetaVarName<"<N>">, HelpText<"Format message diagnostics so that they fit within N columns or fewer, when possible.">; def verify : Flag<["-"], "verify">, @@ -321,12 +332,16 @@ def ast_dump_filter : Separate<["-"], "ast-dump-filter">, HelpText<"Use with -ast-dump or -ast-print to dump/print only AST declaration" " nodes having a certain substring in a qualified name. Use" " -ast-list to list all filterable declaration node names.">; -def ast_dump_lookups : Flag<["-"], "ast-dump-lookups">, - HelpText<"Include name lookup table dumps in AST dumps">; def fno_modules_global_index : Flag<["-"], "fno-modules-global-index">, HelpText<"Do not automatically generate or update the global module index">; def fno_modules_error_recovery : Flag<["-"], "fno-modules-error-recovery">, HelpText<"Do not automatically import modules for error recovery">; +def fmodule_implementation_of : Separate<["-"], "fmodule-implementation-of">, + MetaVarName<"<name>">, + HelpText<"Specify the name of the module whose implementation file this is">; +def fmodule_map_file_home_is_cwd : Flag<["-"], "fmodule-map-file-home-is-cwd">, + HelpText<"Use the current working directory as the home directory of " + "module maps specified by -fmodule-map-file=<FILE>">; let Group = Action_Group in { @@ -355,6 +370,8 @@ def ast_list : Flag<["-"], "ast-list">, HelpText<"Build ASTs and print the list of declaration node qualified names">; def ast_dump : Flag<["-"], "ast-dump">, HelpText<"Build ASTs and then debug dump them">; +def ast_dump_lookups : Flag<["-"], "ast-dump-lookups">, + HelpText<"Build ASTs and then debug dump their name lookup tables">; def ast_view : Flag<["-"], "ast-view">, HelpText<"Build ASTs and view them with GraphViz">; def print_decl_contexts : Flag<["-"], "print-decl-contexts">, @@ -497,13 +514,15 @@ def fdeprecated_macro : Flag<["-"], "fdeprecated-macro">, def fno_deprecated_macro : Flag<["-"], "fno-deprecated-macro">, HelpText<"Undefines the __DEPRECATED macro">; def fsized_deallocation : Flag<["-"], "fsized-deallocation">, - HelpText<"Enable C++1y sized global deallocation functions">; + HelpText<"Enable C++14 sized global deallocation functions">; def fobjc_subscripting_legacy_runtime : Flag<["-"], "fobjc-subscripting-legacy-runtime">, HelpText<"Allow Objective-C array and dictionary subscripting in legacy runtime">; def vtordisp_mode_EQ : Joined<["-"], "vtordisp-mode=">, HelpText<"Control vtordisp placement on win32 targets">; def fno_rtti_data : Flag<["-"], "fno-rtti-data">, HelpText<"Control emission of RTTI data">; +def fallow_half_arguments_and_returns : Flag<["-"], "fallow-half-arguments-and-returns">, + HelpText<"Allow function arguments and returns of type half">; //===----------------------------------------------------------------------===// // Header Search Options @@ -561,6 +580,8 @@ def cl_finite_math_only : Flag<["-"], "cl-finite-math-only">, HelpText<"OpenCL only. Allow floating-point optimizations that assume arguments and results are not NaNs or +-Inf.">; def cl_kernel_arg_info : Flag<["-"], "cl-kernel-arg-info">, HelpText<"OpenCL only. Generate kernel argument metadata.">; +def cl_no_signed_zeros : Flag<["-"], "cl-no-signed-zeros">, + HelpText<"OpenCL only. Allow optimizations to ignore the signedness of the floating-point zero.">; def cl_unsafe_math_optimizations : Flag<["-"], "cl-unsafe-math-optimizations">, HelpText<"OpenCL only. Allow unsafe floating-point optimizations. Also implies -cl-no-signed-zeros and -cl-mad-enable">; def cl_fast_relaxed_math : Flag<["-"], "cl-fast-relaxed-math">, @@ -569,6 +590,8 @@ def cl_mad_enable : Flag<["-"], "cl-mad-enable">, HelpText<"OpenCL only. Enable less precise MAD instructions to be generated.">; def cl_std_EQ : Joined<["-"], "cl-std=">, HelpText<"OpenCL language standard to compile for">; +def cl_denorms_are_zero : Flag<["-"], "cl-denorms-are-zero">, + HelpText<"OpenCL only. Allow denormals to be flushed to zero">; //===----------------------------------------------------------------------===// // CUDA Options diff --git a/include/clang/Driver/CLCompatOptions.td b/include/clang/Driver/CLCompatOptions.td index 7278bf868355..363dd4933c10 100644 --- a/include/clang/Driver/CLCompatOptions.td +++ b/include/clang/Driver/CLCompatOptions.td @@ -129,9 +129,22 @@ def _SLASH_wd4005 : CLFlag<"wd4005">, Alias<W_Joined>, AliasArgs<["no-macro-redefined"]>; def _SLASH_vd : CLJoined<"vd">, HelpText<"Control vtordisp placement">, Alias<vtordisp_mode_EQ>; +def _SLASH_Zc_strictStrings : CLFlag<"Zc:strictStrings">, + HelpText<"Treat string literals as const">, Alias<W_Joined>, + AliasArgs<["error=c++11-compat-deprecated-writable-strings"]>; +def _SLASH_Zc_trigraphs : CLFlag<"Zc:trigraphs">, + HelpText<"Enable trigraphs">, Alias<ftrigraphs>; +def _SLASH_Zc_trigraphs_off : CLFlag<"Zc:trigraphs-">, + HelpText<"Disable trigraphs (default)">, Alias<fno_trigraphs>; def _SLASH_Z7 : CLFlag<"Z7">, Alias<gline_tables_only>; def _SLASH_Zi : CLFlag<"Zi">, HelpText<"Enable debug information">, Alias<gline_tables_only>; +def _SLASH_Zp : CLJoined<"Zp">, + HelpText<"Specify the default maximum struct packing alignment">, + Alias<fpack_struct_EQ>; +def _SLASH_Zp_flag : CLFlag<"Zp">, + HelpText<"Set the default maximum struct packing alignment to 1">, + Alias<fpack_struct_EQ>, AliasArgs<["1"]>; def _SLASH_Zs : CLFlag<"Zs">, HelpText<"Syntax-check only">, Alias<fsyntax_only>; @@ -176,6 +189,9 @@ def _SLASH_MT : Option<["/", "-"], "MT", KIND_FLAG>, Group<_SLASH_M_Group>, Flags<[CLOption, DriverOption]>, HelpText<"Use static run-time">; def _SLASH_MTd : Option<["/", "-"], "MTd", KIND_FLAG>, Group<_SLASH_M_Group>, Flags<[CLOption, DriverOption]>, HelpText<"Use static debug run-time">; +def _SLASH_o : CLJoinedOrSeparate<"o">, + HelpText<"Set output file or directory (ends in / or \\)">, + MetaVarName<"<file or directory>">; def _SLASH_P : CLFlag<"P">, HelpText<"Preprocess to file">; def _SLASH_Tc : CLCompileJoinedOrSeparate<"Tc">, HelpText<"Specify a C source file">, MetaVarName<"<filename>">; @@ -188,8 +204,11 @@ def _SLASH_TP : CLCompileFlag<"TP">, HelpText<"Treat all source files as C++">; // Ignored: def _SLASH_analyze_ : CLIgnoredFlag<"analyze-">; +def _SLASH_cgthreads : CLIgnoredJoined<"cgthreads">; +def _SLASH_d2Zi_PLUS : CLIgnoredFlag<"d2Zi+">; def _SLASH_errorReport : CLIgnoredJoined<"errorReport">; def _SLASH_FS : CLIgnoredFlag<"FS">, HelpText<"Force synchronous PDB writes">; +def _SLASH_Gd : CLIgnoredFlag<"Gd">; def _SLASH_GF : CLIgnoredFlag<"GF">; def _SLASH_GS_ : CLIgnoredFlag<"GS-">; def _SLASH_kernel_ : CLIgnoredFlag<"kernel-">; @@ -199,12 +218,16 @@ def _SLASH_Ob2 : CLIgnoredFlag<"Ob2">; def _SLASH_RTC : CLIgnoredJoined<"RTC">; def _SLASH_sdl : CLIgnoredFlag<"sdl">; def _SLASH_sdl_ : CLIgnoredFlag<"sdl-">; +def _SLASH_volatile_iso : CLIgnoredFlag<"volatile:iso">; def _SLASH_w : CLIgnoredJoined<"w">; +def _SLASH_Zc_auto : CLIgnoredFlag<"Zc:auto">; def _SLASH_Zc_forScope : CLIgnoredFlag<"Zc:forScope">; def _SLASH_Zc_inline : CLIgnoredFlag<"Zc:inline">; def _SLASH_Zc_rvalueCast : CLIgnoredFlag<"Zc:rvalueCast">; def _SLASH_Zc_wchar_t : CLIgnoredFlag<"Zc:wchar_t">; def _SLASH_Zm : CLIgnoredJoined<"Zm">; +def _SLASH_Zo : CLIgnoredFlag<"Zo">; +def _SLASH_Zo_ : CLIgnoredFlag<"Zo-">; // Unsupported: @@ -212,7 +235,6 @@ def _SLASH_Zm : CLIgnoredJoined<"Zm">; def _SLASH_AI : CLJoined<"AI">; def _SLASH_bigobj : CLFlag<"bigobj">; def _SLASH_clr : CLJoined<"clr">; -def _SLASH_d2Zi_PLUS : CLFlag<"d2Zi+">; def _SLASH_doc : CLJoined<"doc">; def _SLASH_FA_joined : CLJoined<"FA">; def _SLASH_favor : CLJoined<"favor">; @@ -229,7 +251,6 @@ def _SLASH_Fx : CLFlag<"Fx">; def _SLASH_G1 : CLFlag<"G1">; def _SLASH_G2 : CLFlag<"G2">; def _SLASH_GA : CLFlag<"GA">; -def _SLASH_Gd : CLFlag<"Gd">; def _SLASH_Ge : CLFlag<"Ge">; def _SLASH_Gh : CLFlag<"Gh">; def _SLASH_GH : CLFlag<"GH">; @@ -242,6 +263,7 @@ def _SLASH_GS : CLFlag<"GS">; def _SLASH_Gs : CLJoined<"Gs">; def _SLASH_GT : CLFlag<"GT">; def _SLASH_GX : CLFlag<"GX">; +def _SLASH_Gv : CLFlag<"Gv">; def _SLASH_Gz : CLFlag<"Gz">; def _SLASH_GZ : CLFlag<"GZ">; def _SLASH_H : CLFlag<"H">; @@ -250,7 +272,6 @@ def _SLASH_hotpatch : CLFlag<"hotpatch">; def _SLASH_kernel : CLFlag<"kernel">; def _SLASH_LN : CLFlag<"LN">; def _SLASH_MP : CLJoined<"MP">; -def _SLASH_o : CLJoinedOrSeparate<"o">; def _SLASH_openmp : CLFlag<"openmp">; def _SLASH_Qfast_transcendentals : CLFlag<"Qfast_transcendentals">; def _SLASH_QIfist : CLFlag<"QIfist">; @@ -259,7 +280,7 @@ def _SLASH_Qpar : CLFlag<"Qpar">; def _SLASH_Qvec_report : CLJoined<"Qvec-report">; def _SLASH_u : CLFlag<"u">; def _SLASH_V : CLFlag<"V">; -def _SLASH_volatile : CLFlag<"volatile">; +def _SLASH_volatile_ms : CLFlag<"volatile:ms">; def _SLASH_WL : CLFlag<"WL">; def _SLASH_Wp64 : CLFlag<"Wp64">; def _SLASH_X : CLFlag<"X">; @@ -274,5 +295,4 @@ def _SLASH_Ze : CLFlag<"Ze">; def _SLASH_Zg : CLFlag<"Zg">; def _SLASH_ZI : CLFlag<"ZI">; def _SLASH_Zl : CLFlag<"Zl">; -def _SLASH_Zp : CLJoined<"Zp">; def _SLASH_ZW : CLJoined<"ZW">; diff --git a/include/clang/Driver/Compilation.h b/include/clang/Driver/Compilation.h index c1c0f4326d76..5574e2ca0533 100644 --- a/include/clang/Driver/Compilation.h +++ b/include/clang/Driver/Compilation.h @@ -7,8 +7,8 @@ // //===----------------------------------------------------------------------===// -#ifndef CLANG_DRIVER_COMPILATION_H_ -#define CLANG_DRIVER_COMPILATION_H_ +#ifndef LLVM_CLANG_DRIVER_COMPILATION_H +#define LLVM_CLANG_DRIVER_COMPILATION_H #include "clang/Driver/Job.h" #include "clang/Driver/Util.h" @@ -94,7 +94,7 @@ public: JobList &getJobs() { return Jobs; } const JobList &getJobs() const { return Jobs; } - void addCommand(Command *C) { Jobs.addJob(C); } + void addCommand(std::unique_ptr<Command> C) { Jobs.addJob(std::move(C)); } const llvm::opt::ArgStringList &getTempFiles() const { return TempFiles; } diff --git a/include/clang/Driver/Driver.h b/include/clang/Driver/Driver.h index df974ad1d760..67d67c3074d7 100644 --- a/include/clang/Driver/Driver.h +++ b/include/clang/Driver/Driver.h @@ -7,8 +7,8 @@ // //===----------------------------------------------------------------------===// -#ifndef CLANG_DRIVER_DRIVER_H_ -#define CLANG_DRIVER_DRIVER_H_ +#ifndef LLVM_CLANG_DRIVER_DRIVER_H +#define LLVM_CLANG_DRIVER_DRIVER_H #include "clang/Basic/Diagnostic.h" #include "clang/Basic/LLVM.h" @@ -42,6 +42,7 @@ namespace driver { class Command; class Compilation; class InputInfo; + class Job; class JobAction; class SanitizerArgs; class ToolChain; @@ -103,9 +104,6 @@ public: /// Default target triple. std::string DefaultTargetTriple; - /// Default name for linked images (e.g., "a.out"). - std::string DefaultImageName; - /// Driver title to use with help. std::string DriverTitle; @@ -190,6 +188,12 @@ private: phases::ID getFinalPhase(const llvm::opt::DerivedArgList &DAL, llvm::opt::Arg **FinalPhaseArg = nullptr) const; + // Before executing jobs, sets up response files for commands that need them. + void setUpResponseFiles(Compilation &C, Job &J); + + void generatePrefixedToolNames(const char *Tool, const ToolChain &TC, + SmallVectorImpl<std::string> &Names) const; + public: Driver(StringRef _ClangExecutable, StringRef _DefaultTargetTriple, @@ -291,16 +295,16 @@ public: /// arguments and return an appropriate exit code. /// /// This routine handles additional processing that must be done in addition - /// to just running the subprocesses, for example reporting errors, removing - /// temporary files, etc. - int ExecuteCompilation(const Compilation &C, - SmallVectorImpl< std::pair<int, const Command *> > &FailingCommands) const; + /// to just running the subprocesses, for example reporting errors, setting + /// up response files, removing temporary files, etc. + int ExecuteCompilation(Compilation &C, + SmallVectorImpl< std::pair<int, const Command *> > &FailingCommands); /// generateCompilationDiagnostics - Generate diagnostics information /// including preprocessed source file(s). /// void generateCompilationDiagnostics(Compilation &C, - const Command *FailingCommand); + const Command &FailingCommand); /// @} /// @name Helper Methods @@ -343,8 +347,9 @@ public: /// ConstructAction - Construct the appropriate action to do for /// \p Phase on the \p Input, taking in to account arguments /// like -fsyntax-only or --analyze. - Action *ConstructPhaseAction(const llvm::opt::ArgList &Args, phases::ID Phase, - Action *Input) const; + std::unique_ptr<Action> + ConstructPhaseAction(const llvm::opt::ArgList &Args, phases::ID Phase, + std::unique_ptr<Action> Input) const; /// BuildJobsForAction - Construct the jobs to perform for the /// action \p A. @@ -357,6 +362,9 @@ public: const char *LinkingOutput, InputInfo &Result) const; + /// Returns the default name for linked images (e.g., "a.out"). + const char *getDefaultImageName() const; + /// GetNamedOutputPath - Return the name to use for the output of /// the action \p JA. The result is appended to the compilation's /// list of temporary or result files, as appropriate. diff --git a/include/clang/Driver/DriverDiagnostic.h b/include/clang/Driver/DriverDiagnostic.h index f3c33aeccb42..680338a2ea7a 100644 --- a/include/clang/Driver/DriverDiagnostic.h +++ b/include/clang/Driver/DriverDiagnostic.h @@ -7,8 +7,8 @@ // //===----------------------------------------------------------------------===// -#ifndef LLVM_CLANG_DRIVERDIAGNOSTIC_H -#define LLVM_CLANG_DRIVERDIAGNOSTIC_H +#ifndef LLVM_CLANG_DRIVER_DRIVERDIAGNOSTIC_H +#define LLVM_CLANG_DRIVER_DRIVERDIAGNOSTIC_H #include "clang/Basic/Diagnostic.h" diff --git a/include/clang/Driver/Job.h b/include/clang/Driver/Job.h index 5b19efeddeea..b510676c09a7 100644 --- a/include/clang/Driver/Job.h +++ b/include/clang/Driver/Job.h @@ -7,11 +7,12 @@ // //===----------------------------------------------------------------------===// -#ifndef CLANG_DRIVER_JOB_H_ -#define CLANG_DRIVER_JOB_H_ +#ifndef LLVM_CLANG_DRIVER_JOB_H +#define LLVM_CLANG_DRIVER_JOB_H #include "clang/Basic/LLVM.h" #include "llvm/ADT/SmallVector.h" +#include "llvm/ADT/iterator.h" #include "llvm/Option/Option.h" #include <memory> @@ -28,6 +29,14 @@ class Tool; // Re-export this as clang::driver::ArgStringList. using llvm::opt::ArgStringList; +struct CrashReportInfo { + StringRef Filename; + StringRef VFSPath; + + CrashReportInfo(StringRef Filename, StringRef VFSPath) + : Filename(Filename), VFSPath(VFSPath) {} +}; + class Job { public: enum JobClass { @@ -51,9 +60,9 @@ public: /// \param OS - The stream to print on. /// \param Terminator - A string to print at the end of the line. /// \param Quote - Should separate arguments be quoted. - /// \param CrashReport - Whether to print for inclusion in a crash report. - virtual void Print(llvm::raw_ostream &OS, const char *Terminator, - bool Quote, bool CrashReport = false) const = 0; + /// \param CrashInfo - Details for inclusion in a crash report. + virtual void Print(llvm::raw_ostream &OS, const char *Terminator, bool Quote, + CrashReportInfo *CrashInfo = nullptr) const = 0; }; /// Command - An executable path/name and argument vector to @@ -72,12 +81,36 @@ class Command : public Job { /// argument, which will be the executable). llvm::opt::ArgStringList Arguments; + /// Response file name, if this command is set to use one, or nullptr + /// otherwise + const char *ResponseFile; + + /// The input file list in case we need to emit a file list instead of a + /// proper response file + llvm::opt::ArgStringList InputFileList; + + /// String storage if we need to create a new argument to specify a response + /// file + std::string ResponseFileFlag; + + /// When a response file is needed, we try to put most arguments in an + /// exclusive file, while others remains as regular command line arguments. + /// This functions fills a vector with the regular command line arguments, + /// argv, excluding the ones passed in a response file. + void buildArgvForResponseFile(llvm::SmallVectorImpl<const char *> &Out) const; + + /// Encodes an array of C strings into a single string separated by whitespace. + /// This function will also put in quotes arguments that have whitespaces and + /// will escape the regular backslashes (used in Windows paths) and quotes. + /// The results are the contents of a response file, written into a raw_ostream. + void writeResponseFile(raw_ostream &OS) const; + public: Command(const Action &_Source, const Tool &_Creator, const char *_Executable, const llvm::opt::ArgStringList &_Arguments); void Print(llvm::raw_ostream &OS, const char *Terminator, bool Quote, - bool CrashReport = false) const override; + CrashReportInfo *CrashInfo = nullptr) const override; virtual int Execute(const StringRef **Redirects, std::string *ErrMsg, bool *ExecutionFailed) const; @@ -88,6 +121,15 @@ public: /// getCreator - Return the Tool which caused the creation of this job. const Tool &getCreator() const { return Creator; } + /// Set to pass arguments via a response file when launching the command + void setResponseFile(const char *FileName); + + /// Set an input file list, necessary if we need to use a response file but + /// the tool being called only supports input files lists. + void setInputFileList(llvm::opt::ArgStringList List) { + InputFileList = std::move(List); + } + const char *getExecutable() const { return Executable; } const llvm::opt::ArgStringList &getArguments() const { return Arguments; } @@ -104,10 +146,10 @@ class FallbackCommand : public Command { public: FallbackCommand(const Action &Source_, const Tool &Creator_, const char *Executable_, const ArgStringList &Arguments_, - Command *Fallback_); + std::unique_ptr<Command> Fallback_); void Print(llvm::raw_ostream &OS, const char *Terminator, bool Quote, - bool CrashReport = false) const override; + CrashReportInfo *CrashInfo = nullptr) const override; int Execute(const StringRef **Redirects, std::string *ErrMsg, bool *ExecutionFailed) const override; @@ -123,23 +165,23 @@ private: /// JobList - A sequence of jobs to perform. class JobList : public Job { public: - typedef SmallVector<Job*, 4> list_type; + typedef SmallVector<std::unique_ptr<Job>, 4> list_type; typedef list_type::size_type size_type; - typedef list_type::iterator iterator; - typedef list_type::const_iterator const_iterator; + typedef llvm::pointee_iterator<list_type::iterator> iterator; + typedef llvm::pointee_iterator<list_type::const_iterator> const_iterator; private: list_type Jobs; public: JobList(); - virtual ~JobList(); + virtual ~JobList() {} void Print(llvm::raw_ostream &OS, const char *Terminator, - bool Quote, bool CrashReport = false) const override; + bool Quote, CrashReportInfo *CrashInfo = nullptr) const override; /// Add a job to the list (taking ownership). - void addJob(Job *J) { Jobs.push_back(J); } + void addJob(std::unique_ptr<Job> J) { Jobs.push_back(std::move(J)); } /// Clear the job list. void clear(); diff --git a/include/clang/Driver/Multilib.h b/include/clang/Driver/Multilib.h index 6c3738a9cc03..dcf609ab99c6 100644 --- a/include/clang/Driver/Multilib.h +++ b/include/clang/Driver/Multilib.h @@ -7,12 +7,13 @@ // //===----------------------------------------------------------------------===// -#ifndef CLANG_LIB_DRIVER_MULTILIB_H_ -#define CLANG_LIB_DRIVER_MULTILIB_H_ +#ifndef LLVM_CLANG_DRIVER_MULTILIB_H +#define LLVM_CLANG_DRIVER_MULTILIB_H #include "clang/Basic/LLVM.h" #include "llvm/ADT/Triple.h" #include "llvm/Option/Option.h" +#include <functional> #include <string> #include <vector> @@ -97,6 +98,10 @@ public: typedef multilib_list::iterator iterator; typedef multilib_list::const_iterator const_iterator; + typedef std::function<std::vector<std::string>( + StringRef InstallDir, StringRef Triple, const Multilib &M)> + IncludeDirsFunc; + struct FilterCallback { virtual ~FilterCallback() {}; /// \return true iff the filter should remove the Multilib from the set @@ -105,6 +110,7 @@ public: private: multilib_list Multilibs; + IncludeDirsFunc IncludeCallback; public: MultilibSet() {} @@ -150,6 +156,12 @@ public: void print(raw_ostream &OS) const; + MultilibSet &setIncludeDirsCallback(IncludeDirsFunc F) { + IncludeCallback = F; + return *this; + } + IncludeDirsFunc includeDirsCallback() const { return IncludeCallback; } + private: /// Apply the filter to Multilibs and return the subset that remains static multilib_list filterCopy(const FilterCallback &F, diff --git a/include/clang/Driver/Options.h b/include/clang/Driver/Options.h index cee705deac63..2716fa9ae85e 100644 --- a/include/clang/Driver/Options.h +++ b/include/clang/Driver/Options.h @@ -7,8 +7,8 @@ // //===----------------------------------------------------------------------===// -#ifndef CLANG_DRIVER_OPTIONS_H -#define CLANG_DRIVER_OPTIONS_H +#ifndef LLVM_CLANG_DRIVER_OPTIONS_H +#define LLVM_CLANG_DRIVER_OPTIONS_H namespace llvm { namespace opt { diff --git a/include/clang/Driver/Options.td b/include/clang/Driver/Options.td index 9d4fdad46ade..4daddba332d7 100644 --- a/include/clang/Driver/Options.td +++ b/include/clang/Driver/Options.td @@ -80,6 +80,7 @@ def m_hexagon_Features_Group : OptionGroup<"<m hexagon features group>">, Group def m_arm_Features_Group : OptionGroup<"<m arm features group>">, Group<m_Group>; def m_aarch64_Features_Group : OptionGroup<"<m aarch64 features group>">, Group<m_Group>; def m_ppc_Features_Group : OptionGroup<"<m ppc features group>">, Group<m_Group>; +def m_libc_Group : OptionGroup<"<m libc group>">, Group<m_Group>; def u_Group : OptionGroup<"<u group>">; def pedantic_Group : OptionGroup<"<pedantic group>">, @@ -180,6 +181,8 @@ def objcmt_migrate_readonly_property : Flag<["-"], "objcmt-migrate-readonly-prop HelpText<"Enable migration to modern ObjC readonly property">; def objcmt_migrate_readwrite_property : Flag<["-"], "objcmt-migrate-readwrite-property">, Flags<[CC1Option]>, HelpText<"Enable migration to modern ObjC readwrite property">; +def objcmt_migrate_property_dot_syntax : Flag<["-"], "objcmt-migrate-property-dot-syntax">, Flags<[CC1Option]>, + HelpText<"Enable migration of setter/getter messages to property-dot syntax">; def objcmt_migrate_annotation : Flag<["-"], "objcmt-migrate-annotation">, Flags<[CC1Option]>, HelpText<"Enable migration to property and method annotations">; def objcmt_migrate_instancetype : Flag<["-"], "objcmt-migrate-instancetype">, Flags<[CC1Option]>, @@ -413,6 +416,9 @@ def fprofile_instr_use : Flag<["-"], "fprofile-instr-use">, Group<f_Group>; def fprofile_instr_use_EQ : Joined<["-"], "fprofile-instr-use=">, Group<f_Group>, Flags<[CC1Option]>, HelpText<"Use instrumentation data for profile-guided optimization">; +def fcoverage_mapping : Flag<["-"], "fcoverage-mapping">, + Group<f_Group>, Flags<[CC1Option]>, + HelpText<"Generate coverage mapping to enable code coverage analysis">; def fblocks : Flag<["-"], "fblocks">, Group<f_Group>, Flags<[CC1Option]>, HelpText<"Enable the 'blocks' language feature">; @@ -480,6 +486,8 @@ def fencoding_EQ : Joined<["-"], "fencoding=">, Group<f_Group>; def ferror_limit_EQ : Joined<["-"], "ferror-limit=">, Group<f_Group>, Flags<[CoreOption]>; def fexceptions : Flag<["-"], "fexceptions">, Group<f_Group>, Flags<[CC1Option]>, HelpText<"Enable support for exception handling">; +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>; def : Flag<["-"], "fno-expensive-optimizations">, Group<clang_ignored_gcc_optimization_f_Group>; def fextdirs_EQ : Joined<["-"], "fextdirs=">, Group<f_Group>; @@ -501,9 +509,8 @@ def fsignaling_math : Flag<["-"], "fsignaling-math">, Group<f_Group>; def fno_signaling_math : Flag<["-"], "fno-signaling-math">, Group<f_Group>; def fsanitize_EQ : CommaJoined<["-"], "fsanitize=">, Group<f_clang_Group>, Flags<[CC1Option, CoreOption]>, MetaVarName<"<check>">, - HelpText<"Enable runtime instrumentation for bug detection: " - "address (memory errors) | thread (race detection) | " - "undefined (miscellaneous undefined behavior)">; + HelpText<"Turn on runtime checks for various forms of undefined " + "or suspicious behavior. See user manual for available checks ">; def fno_sanitize_EQ : CommaJoined<["-"], "fno-sanitize=">, Group<f_clang_Group>; def fsanitize_blacklist : Joined<["-"], "fsanitize-blacklist=">, Group<f_clang_Group>, Flags<[CC1Option, CoreOption]>, @@ -511,6 +518,9 @@ def fsanitize_blacklist : Joined<["-"], "fsanitize-blacklist=">, def fno_sanitize_blacklist : Flag<["-"], "fno-sanitize-blacklist">, Group<f_clang_Group>, HelpText<"Don't use blacklist file for sanitizers">; +def fsanitize_coverage : Joined<["-"], "fsanitize-coverage=">, + Group<f_clang_Group>, Flags<[CC1Option]>, + HelpText<"Enable coverage instrumentation for Sanitizers">; def fsanitize_memory_track_origins_EQ : Joined<["-"], "fsanitize-memory-track-origins=">, Group<f_clang_Group>, Flags<[CC1Option]>, HelpText<"Enable origins tracking in MemorySanitizer">; @@ -520,15 +530,26 @@ def fsanitize_memory_track_origins : Flag<["-"], "fsanitize-memory-track-origins def fno_sanitize_memory_track_origins : Flag<["-"], "fno-sanitize-memory-track-origins">, Group<f_clang_Group>, Flags<[CC1Option]>, HelpText<"Disable origins tracking in MemorySanitizer">; -def fsanitize_recover : Flag<["-"], "fsanitize-recover">, - Group<f_clang_Group>; +def fsanitize_address_field_padding : Joined<["-"], "fsanitize-address-field-padding=">, + Group<f_clang_Group>, Flags<[CC1Option]>, + HelpText<"Level of field padding for AddressSanitizer">; +def fsanitize_recover : Flag<["-"], "fsanitize-recover">, Group<f_clang_Group>; def fno_sanitize_recover : Flag<["-"], "fno-sanitize-recover">, - Group<f_clang_Group>, Flags<[CC1Option]>, - HelpText<"Disable sanitizer check recovery">; + Group<f_clang_Group>; +def fsanitize_recover_EQ : CommaJoined<["-"], "fsanitize-recover=">, + Group<f_clang_Group>, + Flags<[CC1Option]>, + HelpText<"Enable recovery for specified sanitizers">; +def fno_sanitize_recover_EQ + : CommaJoined<["-"], "fno-sanitize-recover=">, + Group<f_clang_Group>, + HelpText<"Disable recovery for specified sanitizers">; def fsanitize_undefined_trap_on_error : Flag<["-"], "fsanitize-undefined-trap-on-error">, Group<f_clang_Group>, Flags<[CC1Option]>; def fno_sanitize_undefined_trap_on_error : Flag<["-"], "fno-sanitize-undefined-trap-on-error">, Group<f_clang_Group>; +def fsanitize_link_cxx_runtime : Flag<["-"], "fsanitize-link-c++-runtime">, + Group<f_clang_Group>; def funsafe_math_optimizations : Flag<["-"], "funsafe-math-optimizations">, Group<f_Group>; def fno_unsafe_math_optimizations : Flag<["-"], "fno-unsafe-math-optimizations">, @@ -561,6 +582,13 @@ def frewrite_includes : Flag<["-"], "frewrite-includes">, Group<f_Group>, Flags<[CC1Option]>; def fno_rewrite_includes : Flag<["-"], "fno-rewrite-includes">, Group<f_Group>; +def frewrite_map_file : Separate<["-"], "frewrite-map-file">, + Group<f_Group>, + Flags<[ DriverOption, CC1Option ]>; +def frewrite_map_file_EQ : Joined<["-"], "frewrite-map-file=">, + Group<f_Group>, + Flags<[DriverOption]>; + def ffreestanding : Flag<["-"], "ffreestanding">, Group<f_Group>, Flags<[CC1Option]>, HelpText<"Assert that the compilation takes place in a freestanding environment">; def fgnu_keywords : Flag<["-"], "fgnu-keywords">, Group<f_Group>, Flags<[CC1Option]>, @@ -576,11 +604,13 @@ def : Flag<["-"], "findirect-virtual-calls">, Alias<fapple_kext>; def finline_functions : Flag<["-"], "finline-functions">, Group<clang_ignored_gcc_optimization_f_Group>; def finline : Flag<["-"], "finline">, Group<clang_ignored_f_Group>; def finput_charset_EQ : Joined<["-"], "finput-charset=">, Group<f_Group>; +def fexec_charset_EQ : Joined<["-"], "fexec-charset=">, Group<f_Group>; def finstrument_functions : Flag<["-"], "finstrument-functions">, Group<f_Group>, Flags<[CC1Option]>, HelpText<"Generate calls to instrument function entry and exit">; def flat__namespace : Flag<["-"], "flat_namespace">; def flax_vector_conversions : Flag<["-"], "flax-vector-conversions">, Group<f_Group>; def flimited_precision_EQ : Joined<["-"], "flimited-precision=">, Group<f_Group>; +def flto_EQ : Joined<["-"], "flto=">, Group<clang_ignored_gcc_optimization_f_Group>; def flto : Flag<["-"], "flto">, Group<f_Group>; def fno_lto : Flag<["-"], "fno-lto">, Group<f_Group>; def fmacro_backtrace_limit_EQ : Joined<["-"], "fmacro-backtrace-limit=">, @@ -622,10 +652,13 @@ def fmodules_search_all : Flag <["-"], "fmodules-search-all">, Group<f_Group>, def fbuild_session_timestamp : Joined<["-"], "fbuild-session-timestamp=">, Group<i_Group>, Flags<[CC1Option]>, MetaVarName<"<time since Epoch in seconds>">, HelpText<"Time when the current build session started">; +def fbuild_session_file : Joined<["-"], "fbuild-session-file=">, + Group<i_Group>, MetaVarName<"<file>">, + HelpText<"Use the last modification time of <file> as the build session timestamp">; def fmodules_validate_once_per_build_session : Flag<["-"], "fmodules-validate-once-per-build-session">, Group<i_Group>, Flags<[CC1Option]>, HelpText<"Don't verify input files for the modules if the module has been " - "successfully validate or loaded during this build session">; + "successfully validated or loaded during this build session">; def fmodules_validate_system_headers : Flag<["-"], "fmodules-validate-system-headers">, Group<i_Group>, Flags<[CC1Option]>, HelpText<"Validate the system headers that a module depends on when loading the module">; @@ -638,9 +671,12 @@ def fmodule_maps : Flag <["-"], "fmodule-maps">, Group<f_Group>, def fmodule_name : JoinedOrSeparate<["-"], "fmodule-name=">, Group<f_Group>, Flags<[DriverOption,CC1Option]>, MetaVarName<"<name>">, HelpText<"Specify the name of the module to build">; -def fmodule_map_file : JoinedOrSeparate<["-"], "fmodule-map-file=">, +def fmodule_map_file : Joined<["-"], "fmodule-map-file=">, Group<f_Group>, Flags<[DriverOption,CC1Option]>, MetaVarName<"<file>">, HelpText<"Load this module map file">; +def fmodule_file : Joined<["-"], "fmodule-file=">, + Group<f_Group>, Flags<[DriverOption,CC1Option]>, + HelpText<"Load this precompiled module file">, MetaVarName<"<file>">; def fmodules_ignore_macro : Joined<["-"], "fmodules-ignore-macro=">, Group<f_Group>, Flags<[CC1Option]>, HelpText<"Ignore the definition of the given macro when building and loading modules">; def fmodules_decluse : Flag <["-"], "fmodules-decluse">, Group<f_Group>, @@ -651,6 +687,12 @@ def fmodules_strict_decluse : Flag <["-"], "fmodules-strict-decluse">, Group<f_G HelpText<"Like -fmodules-decluse but requires all headers to be in modules">; def fno_modules_search_all : Flag <["-"], "fno-modules-search-all">, Group<f_Group>, Flags<[DriverOption, CC1Option]>; +def fmodules_implicit_maps : + Flag <["-"], "fmodules-implicit-maps">, + Group<f_Group>, Flags<[DriverOption, CC1Option]>; +def fno_modules_implicit_maps : + Flag <["-"], "fno-modules-implicit-maps">, + Group<f_Group>, Flags<[DriverOption, CC1Option]>; def fretain_comments_from_system_headers : Flag<["-"], "fretain-comments-from-system-headers">, Group<f_Group>, Flags<[CC1Option]>; def fmudflapth : Flag<["-"], "fmudflapth">, Group<f_Group>; @@ -793,11 +835,15 @@ def foptimize_sibling_calls : Flag<["-"], "foptimize-sibling-calls">, Group<f_Gr def force__cpusubtype__ALL : Flag<["-"], "force_cpusubtype_ALL">; def force__flat__namespace : Flag<["-"], "force_flat_namespace">; def force__load : Separate<["-"], "force_load">; +def force_addr : Joined<["-"], "fforce-addr">, Group<clang_ignored_f_Group>; def foutput_class_dir_EQ : Joined<["-"], "foutput-class-dir=">, Group<f_Group>; def fpack_struct : Flag<["-"], "fpack-struct">, Group<f_Group>; def fno_pack_struct : Flag<["-"], "fno-pack-struct">, Group<f_Group>; def fpack_struct_EQ : Joined<["-"], "fpack-struct=">, Group<f_Group>, Flags<[CC1Option]>, HelpText<"Specify the default maximum struct packing alignment">; +def fmax_type_align_EQ : Joined<["-"], "fmax-type-align=">, Group<f_Group>, Flags<[CC1Option]>, + HelpText<"Specify the maximum alignment to enforce on pointers lacking an explicit alignment">; +def fno_max_type_align : Flag<["-"], "fno-max-type-align">, Group<f_Group>; def fpascal_strings : Flag<["-"], "fpascal-strings">, Group<f_Group>, Flags<[CC1Option]>, HelpText<"Recognize and construct Pascal-style string literals">; def fpcc_struct_return : Flag<["-"], "fpcc-struct-return">, Group<f_Group>, Flags<[CC1Option]>, @@ -808,6 +854,7 @@ def fno_pic : Flag<["-"], "fno-pic">, Group<f_Group>; def fpie : Flag<["-"], "fpie">, Group<f_Group>; def fno_pie : Flag<["-"], "fno-pie">, Group<f_Group>; def fprofile_arcs : Flag<["-"], "fprofile-arcs">, Group<f_Group>; +def fno_profile_arcs : Flag<["-"], "fno-profile-arcs">, Group<f_Group>; def fprofile_generate : Flag<["-"], "fprofile-generate">, Group<f_Group>; def framework : Separate<["-"], "framework">, Flags<[LinkerInput]>; def frandom_seed_EQ : Joined<["-"], "frandom-seed=">, Group<clang_ignored_f_Group>; @@ -817,7 +864,6 @@ def frtti : Flag<["-"], "frtti">, Group<f_Group>; def : Flag<["-"], "fsched-interblock">, Group<clang_ignored_f_Group>; def fshort_enums : Flag<["-"], "fshort-enums">, Group<f_Group>, Flags<[CC1Option]>, HelpText<"Allocate to an enum type only as many bytes as it needs for the declared range of possible values">; -def : Flag<["-"], "freorder-blocks">, Group<clang_ignored_gcc_optimization_f_Group>; def fshort_wchar : Flag<["-"], "fshort-wchar">, Group<f_Group>, Flags<[CC1Option]>, HelpText<"Force wchar_t to be a short unsigned int">; def fno_short_wchar : Flag<["-"], "fno-short-wchar">, Group<f_Group>, Flags<[CC1Option]>, @@ -828,6 +874,7 @@ def fshow_overloads_EQ : Joined<["-"], "fshow-overloads=">, Group<f_Group>, Flag def fshow_column : Flag<["-"], "fshow-column">, Group<f_Group>, Flags<[CC1Option]>; def fshow_source_location : Flag<["-"], "fshow-source-location">, Group<f_Group>; def fspell_checking : Flag<["-"], "fspell-checking">, Group<f_Group>; +def fspell_checking_limit_EQ : Joined<["-"], "fspell-checking-limit=">, Group<f_Group>; def fsigned_bitfields : Flag<["-"], "fsigned-bitfields">, Group<f_Group>; def fsigned_char : Flag<["-"], "fsigned-char">, Group<f_Group>; def fno_signed_char : Flag<["-"], "fno-signed-char">, Flags<[CC1Option]>, @@ -905,6 +952,10 @@ def freroll_loops : Flag<["-"], "freroll-loops">, Group<f_Group>, HelpText<"Turn on loop reroller">, Flags<[CC1Option]>; def fno_reroll_loops : Flag<["-"], "fno-reroll-loops">, Group<f_Group>, HelpText<"Turn off loop reroller">; +def ftrigraphs : Flag<["-"], "ftrigraphs">, Group<f_Group>, + HelpText<"Process trigraph sequences">, Flags<[CC1Option]>; +def fno_trigraphs : Flag<["-"], "fno-trigraphs">, Group<f_Group>, + HelpText<"Do not process trigraph sequences">, Flags<[CC1Option]>; def funsigned_bitfields : Flag<["-"], "funsigned-bitfields">, Group<f_Group>; def funsigned_char : Flag<["-"], "funsigned-char">, Group<f_Group>; def fno_unsigned_char : Flag<["-"], "fno-unsigned-char">, Group<clang_ignored_f_Group>; @@ -912,8 +963,7 @@ def funwind_tables : Flag<["-"], "funwind-tables">, Group<f_Group>; def fuse_cxa_atexit : Flag<["-"], "fuse-cxa-atexit">, Group<f_Group>; def fuse_init_array : Flag<["-"], "fuse-init-array">, Group<f_Group>, Flags<[CC1Option]>, HelpText<"Use .init_array instead of .ctors">; -def fno_var_tracking : Flag<["-"], "fno-var-tracking">, - Group<clang_ignored_f_Group>; +def fno_var_tracking : Flag<["-"], "fno-var-tracking">, Group<clang_ignored_f_Group>; def fverbose_asm : Flag<["-"], "fverbose-asm">, Group<f_Group>; def fvisibility_EQ : Joined<["-"], "fvisibility=">, Group<f_Group>, HelpText<"Set the default symbol visibility for all global declarations">; @@ -1037,6 +1087,10 @@ def m3dnow : Flag<["-"], "m3dnow">, Group<m_x86_Features_Group>; def m64 : Flag<["-"], "m64">, Group<m_Group>, Flags<[DriverOption, CoreOption]>; def mx32 : Flag<["-"], "mx32">, Group<m_Group>, Flags<[DriverOption, CoreOption]>; def mabi_EQ : Joined<["-"], "mabi=">, Group<m_Group>; +def malign_functions_EQ : Joined<["-"], "malign-functions=">, Group<clang_ignored_m_Group>; +def malign_loops_EQ : Joined<["-"], "malign-loops=">, Group<clang_ignored_m_Group>; +def malign_jumps_EQ : Joined<["-"], "malign-jumps=">, Group<clang_ignored_m_Group>; +def mfancy_math_387 : Flag<["-"], "mfancy-math-387">, Group<clang_ignored_m_Group>; def march_EQ : Joined<["-"], "march=">, Group<m_Group>; def masm_EQ : Joined<["-"], "masm=">, Group<m_Group>, Flags<[DriverOption]>; def mcmodel_EQ : Joined<["-"], "mcmodel=">, Group<m_Group>; @@ -1054,20 +1108,25 @@ def mhwdiv_EQ : Joined<["-"], "mhwdiv=">, Group<m_Group>; def mglobal_merge : Flag<["-"], "mglobal-merge">, Group<m_Group>; def mhard_float : Flag<["-"], "mhard-float">, Group<m_Group>; def miphoneos_version_min_EQ : Joined<["-"], "miphoneos-version-min=">, Group<m_Group>; -def mios_version_min_EQ : Joined<["-"], "mios-version-min=">, Alias<miphoneos_version_min_EQ>; -def mios_simulator_version_min_EQ : Joined<["-"], "mios-simulator-version-min=">, Group<m_Group>; +def mios_version_min_EQ : Joined<["-"], "mios-version-min=">, + Alias<miphoneos_version_min_EQ>, HelpText<"Set iOS deployment target">; +def mios_simulator_version_min_EQ : Joined<["-"], "mios-simulator-version-min=">, Alias<miphoneos_version_min_EQ>; def mkernel : Flag<["-"], "mkernel">, Group<m_Group>; def mlinker_version_EQ : Joined<["-"], "mlinker-version=">, Flags<[DriverOption]>; def mllvm : Separate<["-"], "mllvm">, Flags<[CC1Option,CC1AsOption,CoreOption]>, HelpText<"Additional arguments to forward to LLVM's option processing">; -def mmacosx_version_min_EQ : Joined<["-"], "mmacosx-version-min=">, Group<m_Group>; +def mmacosx_version_min_EQ : Joined<["-"], "mmacosx-version-min=">, + Group<m_Group>, HelpText<"Set Mac OS X deployment target">; def mms_bitfields : Flag<["-"], "mms-bitfields">, Group<m_Group>, Flags<[CC1Option]>, HelpText<"Set the default structure layout to be compatible with the Microsoft compiler standard">; def mstackrealign : Flag<["-"], "mstackrealign">, Group<m_Group>, Flags<[CC1Option]>, HelpText<"Force realign the stack at entry to every function">; def mstack_alignment : Joined<["-"], "mstack-alignment=">, Group<m_Group>, Flags<[CC1Option]>, HelpText<"Set the stack alignment">; +def mthread_model : Separate<["-"], "mthread-model">, Group<m_Group>, Flags<[CC1Option]>, + HelpText<"The thread model to use, e.g. posix, single (posix by default)">; + def mmmx : Flag<["-"], "mmmx">, Group<m_x86_Features_Group>; def mno_3dnowa : Flag<["-"], "mno-3dnowa">, Group<m_x86_Features_Group>; def mno_3dnow : Flag<["-"], "mno-3dnow">, Group<m_x86_Features_Group>; @@ -1097,9 +1156,13 @@ def mno_avx512f : Flag<["-"], "mno-avx512f">, Group<m_x86_Features_Group>; def mno_avx512cd : Flag<["-"], "mno-avx512cd">, Group<m_x86_Features_Group>; def mno_avx512er : Flag<["-"], "mno-avx512er">, Group<m_x86_Features_Group>; def mno_avx512pf : Flag<["-"], "mno-avx512pf">, Group<m_x86_Features_Group>; +def mno_avx512dq : Flag<["-"], "mno-avx512dq">, Group<m_x86_Features_Group>; +def mno_avx512bw : Flag<["-"], "mno-avx512bw">, Group<m_x86_Features_Group>; +def mno_avx512vl : Flag<["-"], "mno-avx512vl">, Group<m_x86_Features_Group>; def mno_pclmul : Flag<["-"], "mno-pclmul">, Group<m_x86_Features_Group>; def mno_lzcnt : Flag<["-"], "mno-lzcnt">, Group<m_x86_Features_Group>; def mno_rdrnd : Flag<["-"], "mno-rdrnd">, Group<m_x86_Features_Group>; +def mno_fsgsbase : Flag<["-"], "mno-fsgsbase">, Group<m_x86_Features_Group>; def mno_bmi : Flag<["-"], "mno-bmi">, Group<m_x86_Features_Group>; def mno_bmi2 : Flag<["-"], "mno-bmi2">, Group<m_x86_Features_Group>; def mno_popcnt : Flag<["-"], "mno-popcnt">, Group<m_x86_Features_Group>; @@ -1111,6 +1174,7 @@ def mno_f16c : Flag<["-"], "mno-f16c">, Group<m_x86_Features_Group>; def mno_rtm : Flag<["-"], "mno-rtm">, Group<m_x86_Features_Group>; def mno_prfchw : Flag<["-"], "mno-prfchw">, Group<m_x86_Features_Group>; def mno_rdseed : Flag<["-"], "mno-rdseed">, Group<m_x86_Features_Group>; +def mno_adx : Flag<["-"], "mno-adx">, Group<m_x86_Features_Group>; def mno_sha : Flag<["-"], "mno-sha">, Group<m_x86_Features_Group>; def munaligned_access : Flag<["-"], "munaligned-access">, Group<m_arm_Features_Group>, @@ -1118,7 +1182,7 @@ def munaligned_access : Flag<["-"], "munaligned-access">, Group<m_arm_Features_G def mno_unaligned_access : Flag<["-"], "mno-unaligned-access">, Group<m_arm_Features_Group>, HelpText<"Force all memory accesses to be aligned (AArch32/AArch64 only)">; def mstrict_align : Flag<["-"], "mstrict-align">, Alias<mno_unaligned_access>, Flags<[CC1Option,HelpHidden]>, - HelpText<"Force all memory accesses to be aligned (AArch64 only, same as mno-unaligned-access)">; + HelpText<"Force all memory accesses to be aligned (same as mno-unaligned-access)">; def mno_thumb : Flag<["-"], "mno-thumb">, Group<m_arm_Features_Group>; def mrestrict_it: Flag<["-"], "mrestrict-it">, Group<m_arm_Features_Group>, HelpText<"Disallow generation of deprecated IT blocks for ARMv8. It is on by default for ARMv8 Thumb mode.">; @@ -1139,10 +1203,23 @@ def mno_long_calls : Flag<["-"], "mno-long-calls">, Group<m_arm_Features_Group>, def mgeneral_regs_only : Flag<["-"], "mgeneral-regs-only">, Group<m_aarch64_Features_Group>, HelpText<"Generate code which only uses the general purpose registers (AArch64 only)">; +def mfix_cortex_a53_835769 : Flag<["-"], "mfix-cortex-a53-835769">, + Group<m_aarch64_Features_Group>, + HelpText<"Workaround Cortex-A53 erratum 835769 (AArch64 only)">; +def mno_fix_cortex_a53_835769 : Flag<["-"], "mno-fix-cortex-a53-835769">, + Group<m_aarch64_Features_Group>, + HelpText<"Don't workaround Cortex-A53 erratum 835769 (AArch64 only)">; + def mvsx : Flag<["-"], "mvsx">, Group<m_ppc_Features_Group>; def mno_vsx : Flag<["-"], "mno-vsx">, Group<m_ppc_Features_Group>; +def mpower8_vector : Flag<["-"], "mpower8-vector">, + Group<m_ppc_Features_Group>; +def mno_power8_vector : Flag<["-"], "mno-power8-vector">, + Group<m_ppc_Features_Group>; def mfprnd : Flag<["-"], "mfprnd">, Group<m_ppc_Features_Group>; def mno_fprnd : Flag<["-"], "mno-fprnd">, Group<m_ppc_Features_Group>; +def mcmpb : Flag<["-"], "mcmpb">, Group<m_ppc_Features_Group>; +def mno_cmpb : Flag<["-"], "mno-cmpb">, Group<m_ppc_Features_Group>; def mmfcrf : Flag<["-"], "mmfcrf">, Group<m_ppc_Features_Group>; def mno_mfcrf : Flag<["-"], "mno-mfcrf">, Group<m_ppc_Features_Group>; def mpopcntd : Flag<["-"], "mpopcntd">, Group<m_ppc_Features_Group>; @@ -1191,9 +1268,13 @@ def mavx512f : Flag<["-"], "mavx512f">, Group<m_x86_Features_Group>; def mavx512cd : Flag<["-"], "mavx512cd">, Group<m_x86_Features_Group>; def mavx512er : Flag<["-"], "mavx512er">, Group<m_x86_Features_Group>; def mavx512pf : Flag<["-"], "mavx512pf">, Group<m_x86_Features_Group>; +def mavx512dq : Flag<["-"], "mavx512dq">, Group<m_x86_Features_Group>; +def mavx512bw : Flag<["-"], "mavx512bw">, Group<m_x86_Features_Group>; +def mavx512vl : Flag<["-"], "mavx512vl">, Group<m_x86_Features_Group>; def mpclmul : Flag<["-"], "mpclmul">, Group<m_x86_Features_Group>; def mlzcnt : Flag<["-"], "mlzcnt">, Group<m_x86_Features_Group>; def mrdrnd : Flag<["-"], "mrdrnd">, Group<m_x86_Features_Group>; +def mfsgsbase : Flag<["-"], "mfsgsbase">, Group<m_x86_Features_Group>; def mbmi : Flag<["-"], "mbmi">, Group<m_x86_Features_Group>; def mbmi2 : Flag<["-"], "mbmi2">, Group<m_x86_Features_Group>; def mpopcnt : Flag<["-"], "mpopcnt">, Group<m_x86_Features_Group>; @@ -1205,6 +1286,7 @@ def mf16c : Flag<["-"], "mf16c">, Group<m_x86_Features_Group>; def mrtm : Flag<["-"], "mrtm">, Group<m_x86_Features_Group>; def mprfchw : Flag<["-"], "mprfchw">, Group<m_x86_Features_Group>; def mrdseed : Flag<["-"], "mrdseed">, Group<m_x86_Features_Group>; +def madx : Flag<["-"], "madx">, Group<m_x86_Features_Group>; def msha : Flag<["-"], "msha">, Group<m_x86_Features_Group>; def mcx16 : Flag<["-"], "mcx16">, Group<m_x86_Features_Group>; def mips16 : Flag<["-"], "mips16">, Group<m_Group>; @@ -1233,6 +1315,10 @@ def mfp64 : Flag<["-"], "mfp64">, Group<m_Group>, def mfp32 : Flag<["-"], "mfp32">, Group<m_Group>, HelpText<"Use 32-bit floating point registers (MIPS only)">; def mnan_EQ : Joined<["-"], "mnan=">, Group<m_Group>; +def mabicalls : Flag<["-"], "mabicalls">, Group<m_Group>, + HelpText<"Enable SVR4-style position-independent code (Mips only)">; +def mno_abicalls : Flag<["-"], "mno-abicalls">, Group<m_Group>, + HelpText<"Disable SVR4-style position-independent code (Mips only)">; def mips1 : Flag<["-"], "mips1">, Alias<march_EQ>, AliasArgs<["mips1"]>, HelpText<"Equivalent to -march=mips1">, Flags<[HelpHidden]>; @@ -1275,6 +1361,8 @@ def modd_spreg : Flag<["-"], "modd-spreg">, Group<m_Group>, def mno_odd_spreg : Flag<["-"], "mno-odd-spreg">, Group<m_Group>, HelpText<"Disable odd single-precision floating point registers">, Flags<[HelpHidden]>; +def mglibc : Flag<["-"], "mglibc">, Group<m_libc_Group>, Flags<[HelpHidden]>; +def muclibc : Flag<["-"], "muclibc">, Group<m_libc_Group>, Flags<[HelpHidden]>; def module_file_info : Flag<["-"], "module-file-info">, Flags<[DriverOption,CC1Option]>, Group<Action_Group>; def mthumb : Flag<["-"], "mthumb">, Group<m_Group>; def mtune_EQ : Joined<["-"], "mtune=">, Group<m_Group>; @@ -1403,7 +1491,7 @@ def time : Flag<["-"], "time">, def traditional_cpp : Flag<["-", "--"], "traditional-cpp">, Flags<[CC1Option]>, HelpText<"Enable some traditional CPP emulation">; def traditional : Flag<["-", "--"], "traditional">; -def trigraphs : Flag<["-", "--"], "trigraphs">, Flags<[CC1Option]>, +def trigraphs : Flag<["-", "--"], "trigraphs">, Alias<ftrigraphs>, HelpText<"Process trigraph sequences">; def twolevel__namespace__hints : Flag<["-"], "twolevel_namespace_hints">; def twolevel__namespace : Flag<["-"], "twolevel_namespace">; @@ -1455,7 +1543,7 @@ 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]>; -def _analyze : Flag<["--"], "analyze">, Flags<[DriverOption]>, +def _analyze : Flag<["--"], "analyze">, Flags<[DriverOption, CoreOption]>, HelpText<"Run the static analyzer">; def _assemble : Flag<["--"], "assemble">, Alias<S>; def _assert_EQ : Joined<["--"], "assert=">, Alias<A>; @@ -1591,7 +1679,7 @@ multiclass BooleanFFlag<string name> { def _fno : Flag<["-"], "fno-"#name>; } -defm : BooleanFFlag<"no-keep-inline-functions">, Group<clang_ignored_gcc_optimization_f_Group>; +defm : BooleanFFlag<"keep-inline-functions">, Group<clang_ignored_gcc_optimization_f_Group>; def fprofile_dir : Joined<["-"], "fprofile-dir=">, Group<clang_ignored_gcc_optimization_f_Group>; @@ -1601,22 +1689,52 @@ def fuse_ld_EQ : Joined<["-"], "fuse-ld=">, Group<f_Group>; defm align_functions : BooleanFFlag<"align-functions">, Group<clang_ignored_gcc_optimization_f_Group>; def falign_functions_EQ : Joined<["-"], "falign-functions=">, Group<clang_ignored_gcc_optimization_f_Group>; +defm align_labels : BooleanFFlag<"align-labels">, Group<clang_ignored_gcc_optimization_f_Group>; +def falign_labels_EQ : Joined<["-"], "falign-labels=">, Group<clang_ignored_gcc_optimization_f_Group>; +defm align_loops : BooleanFFlag<"align-loops">, Group<clang_ignored_gcc_optimization_f_Group>; +def falign_loops_EQ : Joined<["-"], "falign-loops=">, Group<clang_ignored_gcc_optimization_f_Group>; +defm align_jumps : BooleanFFlag<"align-jumps">, Group<clang_ignored_gcc_optimization_f_Group>; +def falign_jumps_EQ : Joined<["-"], "falign-jumps=">, Group<clang_ignored_gcc_optimization_f_Group>; // FIXME: This option should be supported and wired up to our diognostics, but // ignore it for now to avoid breaking builds that use it. def fdiagnostics_show_location_EQ : Joined<["-"], "fdiagnostics-show-location=">, Group<clang_ignored_f_Group>; +defm fcheck_new : BooleanFFlag<"check-new">, Group<clang_ignored_f_Group>; +defm caller_saves : BooleanFFlag<"caller-saves">, Group<clang_ignored_gcc_optimization_f_Group>; +defm reorder_blocks : BooleanFFlag<"reorder-blocks">, Group<clang_ignored_gcc_optimization_f_Group>; defm eliminate_unused_debug_types : BooleanFFlag<"eliminate-unused-debug-types">, Group<clang_ignored_f_Group>; +defm branch_count_reg : BooleanFFlag<"branch-count-reg">, Group<clang_ignored_gcc_optimization_f_Group>; +defm default_inline : BooleanFFlag<"default-inline">, Group<clang_ignored_gcc_optimization_f_Group>; +defm delete_null_pointer_checks : BooleanFFlag<"delete-null-pointer-checks">, + Group<clang_ignored_gcc_optimization_f_Group>; +defm fat_lto_objects : BooleanFFlag<"fat-lto-objects">, Group<clang_ignored_gcc_optimization_f_Group>; defm float_store : BooleanFFlag<"float-store">, Group<clang_ignored_gcc_optimization_f_Group>; +defm friend_injection : BooleanFFlag<"friend-injection">, Group<clang_ignored_f_Group>; defm function_attribute_list : BooleanFFlag<"function-attribute-list">, Group<clang_ignored_f_Group>; defm gcse : BooleanFFlag<"gcse">, Group<clang_ignored_gcc_optimization_f_Group>; +defm gcse_after_reload: BooleanFFlag<"gcse-after-reload">, Group<clang_ignored_gcc_optimization_f_Group>; +defm gcse_las: BooleanFFlag<"gcse-las">, Group<clang_ignored_gcc_optimization_f_Group>; +defm gcse_sm: BooleanFFlag<"gcse-sm">, Group<clang_ignored_gcc_optimization_f_Group>; defm gnu : BooleanFFlag<"gnu">, Group<clang_ignored_f_Group>; defm ident : BooleanFFlag<"ident">, Group<clang_ignored_f_Group>; defm implicit_templates : BooleanFFlag<"implicit-templates">, Group<clang_ignored_f_Group>; +defm implement_inlines : BooleanFFlag<"implement-inlines">, Group<clang_ignored_f_Group>; +defm merge_constants : BooleanFFlag<"merge-constants">, Group<clang_ignored_gcc_optimization_f_Group>; +defm modulo_sched : BooleanFFlag<"modulo-sched">, Group<clang_ignored_gcc_optimization_f_Group>; +defm modulo_sched_allow_regmoves : BooleanFFlag<"modulo-sched-allow-regmoves">, + Group<clang_ignored_gcc_optimization_f_Group>; +defm inline_functions_called_once : BooleanFFlag<"inline-functions-called-once">, + Group<clang_ignored_gcc_optimization_f_Group>; def finline_limit_EQ : Joined<["-"], "finline-limit=">, Group<clang_ignored_gcc_optimization_f_Group>; defm finline_limit : BooleanFFlag<"inline-limit">, Group<clang_ignored_gcc_optimization_f_Group>; +defm inline_small_functions : BooleanFFlag<"inline-small-functions">, + Group<clang_ignored_gcc_optimization_f_Group>; +defm ipa_cp : BooleanFFlag<"ipa-cp">, + Group<clang_ignored_gcc_optimization_f_Group>; defm ivopts : BooleanFFlag<"ivopts">, Group<clang_ignored_gcc_optimization_f_Group>; defm non_call_exceptions : BooleanFFlag<"non-call-exceptions">, Group<clang_ignored_f_Group>; +defm peel_loops : BooleanFFlag<"peel-loops">, Group<clang_ignored_gcc_optimization_f_Group>; defm permissive : BooleanFFlag<"permissive">, Group<clang_ignored_f_Group>; defm prefetch_loop_arrays : BooleanFFlag<"prefetch-loop-arrays">, Group<clang_ignored_gcc_optimization_f_Group>; defm printf : BooleanFFlag<"printf">, Group<clang_ignored_f_Group>; @@ -1626,21 +1744,42 @@ defm profile_generate_sampling : BooleanFFlag<"profile-generate-sampling">, Grou defm profile_reusedist : BooleanFFlag<"profile-reusedist">, Group<clang_ignored_f_Group>; defm profile_values : BooleanFFlag<"profile-values">, Group<clang_ignored_gcc_optimization_f_Group>; defm regs_graph : BooleanFFlag<"regs-graph">, Group<clang_ignored_f_Group>; +defm rename_registers : BooleanFFlag<"rename-registers">, Group<clang_ignored_gcc_optimization_f_Group>; defm ripa : BooleanFFlag<"ripa">, Group<clang_ignored_f_Group>; defm rounding_math : BooleanFFlag<"rounding-math">, Group<clang_ignored_gcc_optimization_f_Group>; defm schedule_insns : BooleanFFlag<"schedule-insns">, Group<clang_ignored_gcc_optimization_f_Group>; +defm schedule_insns2 : BooleanFFlag<"schedule-insns2">, Group<clang_ignored_gcc_optimization_f_Group>; defm see : BooleanFFlag<"see">, Group<clang_ignored_f_Group>; defm signaling_nans : BooleanFFlag<"signaling-nans">, Group<clang_ignored_gcc_optimization_f_Group>; +defm single_precision_constant : BooleanFFlag<"single-precision-constant">, + Group<clang_ignored_gcc_optimization_f_Group>; defm spec_constr_count : BooleanFFlag<"spec-constr-count">, Group<clang_ignored_f_Group>; +defm stack_check : BooleanFFlag<"stack-check">, Group<clang_ignored_f_Group>; defm strength_reduce : BooleanFFlag<"strength-reduce">, Group<clang_ignored_gcc_optimization_f_Group>; defm tls_model : BooleanFFlag<"tls-model">, Group<clang_ignored_f_Group>; defm tracer : BooleanFFlag<"tracer">, Group<clang_ignored_gcc_optimization_f_Group>; +defm tree_dce : BooleanFFlag<"tree-dce">, Group<clang_ignored_gcc_optimization_f_Group>; +defm tree_loop_im : BooleanFFlag<"tree_loop_im">, Group<clang_ignored_gcc_optimization_f_Group>; +defm tree_loop_ivcanon : BooleanFFlag<"tree_loop_ivcanon">, Group<clang_ignored_gcc_optimization_f_Group>; +defm tree_loop_linear : BooleanFFlag<"tree_loop_linear">, Group<clang_ignored_gcc_optimization_f_Group>; defm tree_salias : BooleanFFlag<"tree-salias">, Group<clang_ignored_f_Group>; +defm tree_ter : BooleanFFlag<"tree-ter">, Group<clang_ignored_gcc_optimization_f_Group>; defm tree_vectorizer_verbose : BooleanFFlag<"tree-vectorizer-verbose">, Group<clang_ignored_f_Group>; +defm tree_vrp : BooleanFFlag<"tree-vrp">, Group<clang_ignored_gcc_optimization_f_Group>; defm unroll_all_loops : BooleanFFlag<"unroll-all-loops">, Group<clang_ignored_gcc_optimization_f_Group>; +defm unsafe_loop_optimizations : BooleanFFlag<"unsafe-loop-optimizations">, + Group<clang_ignored_gcc_optimization_f_Group>; defm unswitch_loops : BooleanFFlag<"unswitch-loops">, Group<clang_ignored_gcc_optimization_f_Group>; - +defm use_linker_plugin : BooleanFFlag<"use-linker-plugin">, Group<clang_ignored_gcc_optimization_f_Group>; +defm vect_cost_model : BooleanFFlag<"vect-cost-model">, Group<clang_ignored_gcc_optimization_f_Group>; +defm variable_expansion_in_unroller : BooleanFFlag<"variable-expansion-in-unroller">, + Group<clang_ignored_gcc_optimization_f_Group>; +defm web : BooleanFFlag<"web">, Group<clang_ignored_gcc_optimization_f_Group>; +defm whole_program : BooleanFFlag<"whole-program">, Group<clang_ignored_gcc_optimization_f_Group>; +defm devirtualize : BooleanFFlag<"devirtualize">, Group<clang_ignored_gcc_optimization_f_Group>; +defm devirtualize_speculatively : BooleanFFlag<"devirtualize-speculatively">, + Group<clang_ignored_gcc_optimization_f_Group>; // gfortran options that we recognize in the driver and pass along when // invoking GCC to compile Fortran code. diff --git a/include/clang/Driver/Phases.h b/include/clang/Driver/Phases.h index 4e0f40c17dff..cd6b5b5c9f05 100644 --- a/include/clang/Driver/Phases.h +++ b/include/clang/Driver/Phases.h @@ -7,8 +7,8 @@ // //===----------------------------------------------------------------------===// -#ifndef CLANG_DRIVER_PHASES_H_ -#define CLANG_DRIVER_PHASES_H_ +#ifndef LLVM_CLANG_DRIVER_PHASES_H +#define LLVM_CLANG_DRIVER_PHASES_H namespace clang { namespace driver { @@ -19,6 +19,7 @@ namespace phases { Preprocess, Precompile, Compile, + Backend, Assemble, Link }; diff --git a/include/clang/Driver/SanitizerArgs.h b/include/clang/Driver/SanitizerArgs.h index c79c4714f4f9..3524da0e7ffe 100644 --- a/include/clang/Driver/SanitizerArgs.h +++ b/include/clang/Driver/SanitizerArgs.h @@ -6,9 +6,10 @@ // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// -#ifndef CLANG_LIB_DRIVER_SANITIZERARGS_H_ -#define CLANG_LIB_DRIVER_SANITIZERARGS_H_ +#ifndef LLVM_CLANG_DRIVER_SANITIZERARGS_H +#define LLVM_CLANG_DRIVER_SANITIZERARGS_H +#include "clang/Basic/Sanitizers.h" #include "llvm/Option/Arg.h" #include "llvm/Option/ArgList.h" #include <string> @@ -20,131 +21,46 @@ class Driver; class ToolChain; class SanitizerArgs { - /// Assign ordinals to sanitizer flags. We'll use the ordinal values as - /// bit positions within \c Kind. - enum SanitizeOrdinal { -#define SANITIZER(NAME, ID) SO_##ID, -#define SANITIZER_GROUP(NAME, ID, ALIAS) SO_##ID##Group, -#include "clang/Basic/Sanitizers.def" - SO_Count - }; - - /// Bugs to catch at runtime. - enum SanitizeKind { -#define SANITIZER(NAME, ID) ID = 1 << SO_##ID, -#define SANITIZER_GROUP(NAME, ID, ALIAS) \ - ID = ALIAS, ID##Group = 1 << SO_##ID##Group, -#include "clang/Basic/Sanitizers.def" - NeedsAsanRt = Address, - NeedsTsanRt = Thread, - NeedsMsanRt = Memory, - NeedsDfsanRt = DataFlow, - NeedsLeakDetection = Leak, - NeedsUbsanRt = Undefined | Integer, - NotAllowedWithTrap = Vptr, - HasZeroBaseShadow = Thread | Memory | DataFlow, - NeedsUnwindTables = Address | Thread | Memory | DataFlow - }; - unsigned Kind; + SanitizerSet Sanitizers; + SanitizerSet RecoverableSanitizers; std::string BlacklistFile; + int SanitizeCoverage; int MsanTrackOrigins; + int AsanFieldPadding; bool AsanZeroBaseShadow; bool UbsanTrapOnError; bool AsanSharedRuntime; + bool LinkCXXRuntimes; public: - SanitizerArgs(); /// Parses the sanitizer arguments from an argument list. SanitizerArgs(const ToolChain &TC, const llvm::opt::ArgList &Args); - bool needsAsanRt() const { return Kind & NeedsAsanRt; } + bool needsAsanRt() const { return Sanitizers.has(SanitizerKind::Address); } bool needsSharedAsanRt() const { return AsanSharedRuntime; } - bool needsTsanRt() const { return Kind & NeedsTsanRt; } - bool needsMsanRt() const { return Kind & NeedsMsanRt; } - bool needsLeakDetection() const { return Kind & NeedsLeakDetection; } + bool needsTsanRt() const { return Sanitizers.has(SanitizerKind::Thread); } + bool needsMsanRt() const { return Sanitizers.has(SanitizerKind::Memory); } bool needsLsanRt() const { - return needsLeakDetection() && !needsAsanRt(); - } - bool needsUbsanRt() const { - return !UbsanTrapOnError && (Kind & NeedsUbsanRt); + return Sanitizers.has(SanitizerKind::Leak) && + !Sanitizers.has(SanitizerKind::Address); } - bool needsDfsanRt() const { return Kind & NeedsDfsanRt; } + bool needsUbsanRt() const; + bool needsDfsanRt() const { return Sanitizers.has(SanitizerKind::DataFlow); } - bool sanitizesVptr() const { return Kind & Vptr; } - bool notAllowedWithTrap() const { return Kind & NotAllowedWithTrap; } - bool hasZeroBaseShadow() const { - return (Kind & HasZeroBaseShadow) || AsanZeroBaseShadow; - } - bool needsUnwindTables() const { return Kind & NeedsUnwindTables; } + bool sanitizesVptr() const { return Sanitizers.has(SanitizerKind::Vptr); } + bool requiresPIE() const; + bool needsUnwindTables() const; + bool linkCXXRuntimes() const { return LinkCXXRuntimes; } void addArgs(const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs) const; private: void clear(); - - /// Parse a single value from a -fsanitize= or -fno-sanitize= value list. - /// Returns OR of members of the \c SanitizeKind enumeration, or \c 0 - /// if \p Value is not known. - static unsigned parse(const char *Value); - - /// Parse a -fsanitize= or -fno-sanitize= argument's values, diagnosing any - /// invalid components. - static unsigned parse(const Driver &D, const llvm::opt::Arg *A, - bool DiagnoseErrors); - - /// Parse a single flag of the form -f[no]sanitize=, or - /// -f*-sanitizer. Sets the masks defining required change of Kind value. - /// Returns true if the flag was parsed successfully. - static bool parse(const Driver &D, const llvm::opt::ArgList &Args, - const llvm::opt::Arg *A, unsigned &Add, unsigned &Remove, - bool DiagnoseErrors); - - /// Produce an argument string from ArgList \p Args, which shows how it - /// provides a sanitizer kind in \p Mask. For example, the argument list - /// "-fsanitize=thread,vptr -fsanitize=address" with mask \c NeedsUbsanRt - /// would produce "-fsanitize=vptr". - static std::string lastArgumentForKind(const Driver &D, - const llvm::opt::ArgList &Args, - unsigned Kind); - - /// Produce an argument string from argument \p A, which shows how it provides - /// a value in \p Mask. For instance, the argument - /// "-fsanitize=address,alignment" with mask \c NeedsUbsanRt would produce - /// "-fsanitize=alignment". - static std::string describeSanitizeArg(const llvm::opt::ArgList &Args, - const llvm::opt::Arg *A, - unsigned Mask); - - static bool getDefaultBlacklistForKind(const Driver &D, unsigned Kind, - std::string &BLPath); - - /// Return the smallest superset of sanitizer set \p Kinds such that each - /// member of each group whose flag is set in \p Kinds has its flag set in the - /// result. - static unsigned expandGroups(unsigned Kinds); - - /// Return the subset of \p Kinds supported by toolchain \p TC. If - /// \p DiagnoseErrors is true, produce an error diagnostic for each sanitizer - /// removed from \p Kinds. - static unsigned filterUnsupportedKinds(const ToolChain &TC, unsigned Kinds, - const llvm::opt::ArgList &Args, - const llvm::opt::Arg *A, - bool DiagnoseErrors, - unsigned &DiagnosedKinds); - - /// The flags in \p Mask are unsupported by \p TC. If present in \p Kinds, - /// remove them and produce an error diagnostic referring to \p A if - /// \p DiagnoseErrors is true. - static void filterUnsupportedMask(const ToolChain &TC, unsigned &Kinds, - unsigned Mask, - const llvm::opt::ArgList &Args, - const llvm::opt::Arg *A, - bool DiagnoseErrors, - unsigned &DiagnosedKinds); + bool getDefaultBlacklist(const Driver &D, std::string &BLPath); }; } // namespace driver } // namespace clang -#endif // CLANG_LIB_DRIVER_SANITIZERARGS_H_ +#endif diff --git a/include/clang/Driver/Tool.h b/include/clang/Driver/Tool.h index 015dcf513e0a..b9eac1cad65d 100644 --- a/include/clang/Driver/Tool.h +++ b/include/clang/Driver/Tool.h @@ -7,10 +7,11 @@ // //===----------------------------------------------------------------------===// -#ifndef CLANG_DRIVER_TOOL_H_ -#define CLANG_DRIVER_TOOL_H_ +#ifndef LLVM_CLANG_DRIVER_TOOL_H +#define LLVM_CLANG_DRIVER_TOOL_H #include "clang/Basic/LLVM.h" +#include "llvm/Support/Program.h" namespace llvm { namespace opt { @@ -31,6 +32,24 @@ namespace driver { /// Tool - Information on a specific compilation tool. class Tool { +public: + // Documents the level of support for response files in this tool. + // Response files are necessary if the command line gets too large, + // requiring the arguments to be transfered to a file. + enum ResponseFileSupport { + // Provides full support for response files, which means we can transfer + // all tool input arguments to a file. E.g.: clang, gcc, binutils and MSVC + // tools. + RF_Full, + // Input file names can live in a file, but flags can't. E.g.: ld64 (Mac + // OS X linker). + RF_FileList, + // Does not support response files: all arguments must be passed via + // command line. + RF_None + }; + +private: /// The tool name (for debugging). const char *Name; @@ -40,9 +59,20 @@ class Tool { /// The tool chain this tool is a part of. const ToolChain &TheToolChain; + /// The level of support for response files seen in this tool + const ResponseFileSupport ResponseSupport; + + /// The encoding to use when writing response files for this tool on Windows + const llvm::sys::WindowsEncodingMethod ResponseEncoding; + + /// The flag used to pass a response file via command line to this tool + const char *const ResponseFlag; + public: - Tool(const char *Name, const char *ShortName, - const ToolChain &TC); + Tool(const char *Name, const char *ShortName, const ToolChain &TC, + ResponseFileSupport ResponseSupport = RF_None, + llvm::sys::WindowsEncodingMethod ResponseEncoding = llvm::sys::WEM_UTF8, + const char *ResponseFlag = "@"); public: virtual ~Tool(); @@ -54,9 +84,33 @@ public: const ToolChain &getToolChain() const { return TheToolChain; } virtual bool hasIntegratedAssembler() const { return false; } + virtual bool canEmitIR() const { return false; } virtual bool hasIntegratedCPP() const = 0; virtual bool isLinkJob() const { return false; } virtual bool isDsymutilJob() const { return false; } + /// \brief Returns the level of support for response files of this tool, + /// whether it accepts arguments to be passed via a file on disk. + ResponseFileSupport getResponseFilesSupport() const { + return ResponseSupport; + } + /// \brief Returns which encoding the response file should use. This is only + /// relevant on Windows platforms where there are different encodings being + /// accepted for different tools. On UNIX, UTF8 is universal. + /// + /// Windows use cases: - GCC and Binutils on mingw only accept ANSI response + /// files encoded with the system current code page. + /// - MSVC's CL.exe and LINK.exe accept UTF16 on Windows. + /// - Clang accepts both UTF8 and UTF16. + /// + /// FIXME: When GNU tools learn how to parse UTF16 on Windows, we should + /// always use UTF16 for Windows, which is the Windows official encoding for + /// international characters. + llvm::sys::WindowsEncodingMethod getResponseFileEncoding() const { + return ResponseEncoding; + } + /// \brief Returns which prefix to use when passing the name of a response + /// file as a parameter to this tool. + const char *getResponseFileFlag() const { return ResponseFlag; } /// \brief Does this tool have "good" standardized diagnostics, or should the /// driver add an additional "command failed" diagnostic on failures. diff --git a/include/clang/Driver/ToolChain.h b/include/clang/Driver/ToolChain.h index 550e4dfc60c3..3092e81b95b5 100644 --- a/include/clang/Driver/ToolChain.h +++ b/include/clang/Driver/ToolChain.h @@ -7,8 +7,8 @@ // //===----------------------------------------------------------------------===// -#ifndef CLANG_DRIVER_TOOLCHAIN_H_ -#define CLANG_DRIVER_TOOLCHAIN_H_ +#ifndef LLVM_CLANG_DRIVER_TOOLCHAIN_H +#define LLVM_CLANG_DRIVER_TOOLCHAIN_H #include "clang/Driver/Action.h" #include "clang/Driver/Multilib.h" @@ -41,7 +41,7 @@ namespace driver { /// ToolChain - Access to tools for a single platform. class ToolChain { public: - typedef SmallVector<std::string, 4> path_list; + typedef SmallVector<std::string, 16> path_list; enum CXXStdlibType { CST_Libcxx, @@ -118,7 +118,7 @@ public: /// \brief Provide the default architecture name (as expected by -arch) for /// this toolchain. Note t - std::string getDefaultUniversalArchName() const; + StringRef getDefaultUniversalArchName() const; std::string getTripleString() const { return Triple.getTriple(); @@ -248,6 +248,12 @@ public: /// UseSjLjExceptions - Does this tool chain use SjLj exceptions. virtual bool UseSjLjExceptions() const { return false; } + /// getThreadModel() - Which thread model does this target use? + virtual std::string getThreadModel() const { return "posix"; } + + /// isThreadModelSupported() - Does this target support a thread model? + virtual bool isThreadModelSupported(const StringRef Model) const; + /// ComputeLLVMTriple - Return the LLVM target triple to use, after taking /// command line arguments into account. virtual std::string diff --git a/include/clang/Driver/Types.h b/include/clang/Driver/Types.h index cca576a054aa..34442eb6379f 100644 --- a/include/clang/Driver/Types.h +++ b/include/clang/Driver/Types.h @@ -7,8 +7,8 @@ // //===----------------------------------------------------------------------===// -#ifndef CLANG_DRIVER_TYPES_H_ -#define CLANG_DRIVER_TYPES_H_ +#ifndef LLVM_CLANG_DRIVER_TYPES_H +#define LLVM_CLANG_DRIVER_TYPES_H #include "clang/Driver/Phases.h" #include "llvm/ADT/SmallVector.h" diff --git a/include/clang/Driver/Util.h b/include/clang/Driver/Util.h index b24b9904f2b5..07495a18508c 100644 --- a/include/clang/Driver/Util.h +++ b/include/clang/Driver/Util.h @@ -7,8 +7,8 @@ // //===----------------------------------------------------------------------===// -#ifndef CLANG_DRIVER_UTIL_H_ -#define CLANG_DRIVER_UTIL_H_ +#ifndef LLVM_CLANG_DRIVER_UTIL_H +#define LLVM_CLANG_DRIVER_UTIL_H #include "clang/Basic/LLVM.h" #include "llvm/ADT/DenseMap.h" |