diff options
author | Roman Divacky <rdivacky@FreeBSD.org> | 2010-07-13 17:21:42 +0000 |
---|---|---|
committer | Roman Divacky <rdivacky@FreeBSD.org> | 2010-07-13 17:21:42 +0000 |
commit | 4ba675006b5a8edfc48b6a9bd3dcf54a70cc08f2 (patch) | |
tree | 48b44512b5db8ced345df4a1a56b5065cf2a14d9 /include/clang/Driver | |
parent | d7279c4c177bca357ef96ff1379fd9bc420bfe83 (diff) |
Diffstat (limited to 'include/clang/Driver')
-rw-r--r-- | include/clang/Driver/Action.h | 13 | ||||
-rw-r--r-- | include/clang/Driver/Arg.h | 181 | ||||
-rw-r--r-- | include/clang/Driver/ArgList.h | 97 | ||||
-rw-r--r-- | include/clang/Driver/CC1Options.td | 24 | ||||
-rw-r--r-- | include/clang/Driver/Compilation.h | 13 | ||||
-rw-r--r-- | include/clang/Driver/Driver.h | 6 | ||||
-rw-r--r-- | include/clang/Driver/HostInfo.h | 2 | ||||
-rw-r--r-- | include/clang/Driver/Makefile | 4 | ||||
-rw-r--r-- | include/clang/Driver/OptTable.h | 3 | ||||
-rw-r--r-- | include/clang/Driver/Option.h | 49 | ||||
-rw-r--r-- | include/clang/Driver/Options.td | 104 | ||||
-rw-r--r-- | include/clang/Driver/ToolChain.h | 9 | ||||
-rw-r--r-- | include/clang/Driver/Types.def | 10 | ||||
-rw-r--r-- | include/clang/Driver/Types.h | 4 |
14 files changed, 270 insertions, 249 deletions
diff --git a/include/clang/Driver/Action.h b/include/clang/Driver/Action.h index ab3162a04707..4b45c98313c4 100644 --- a/include/clang/Driver/Action.h +++ b/include/clang/Driver/Action.h @@ -51,9 +51,10 @@ public: AssembleJobClass, LinkJobClass, LipoJobClass, + DsymutilJobClass, JobClassFirst=PreprocessJobClass, - JobClassLast=LipoJobClass + JobClassLast=DsymutilJobClass }; static const char *getClassName(ActionClass AC); @@ -211,6 +212,16 @@ public: static bool classof(const LipoJobAction *) { return true; } }; +class DsymutilJobAction : public JobAction { +public: + DsymutilJobAction(ActionList &Inputs, types::ID Type); + + static bool classof(const Action *A) { + return A->getKind() == DsymutilJobClass; + } + static bool classof(const DsymutilJobAction *) { return true; } +}; + } // end namespace driver } // end namespace clang diff --git a/include/clang/Driver/Arg.h b/include/clang/Driver/Arg.h index ebf40d45de4c..a52789e69929 100644 --- a/include/clang/Driver/Arg.h +++ b/include/clang/Driver/Arg.h @@ -10,14 +10,9 @@ #ifndef CLANG_DRIVER_ARG_H_ #define CLANG_DRIVER_ARG_H_ -#include "llvm/Support/Casting.h" -using llvm::isa; -using llvm::cast; -using llvm::cast_or_null; -using llvm::dyn_cast; -using llvm::dyn_cast_or_null; - #include "Util.h" +#include "llvm/ADT/SmallVector.h" +#include "llvm/ADT/StringRef.h" #include <vector> #include <string> @@ -34,19 +29,10 @@ namespace driver { /// ArgList to provide efficient iteration over all instances of a /// particular option. class Arg { - public: - enum ArgClass { - FlagClass = 0, - PositionalClass, - JoinedClass, - SeparateClass, - CommaJoinedClass, - JoinedAndSeparateClass - }; + Arg(const Arg &); // DO NOT IMPLEMENT + void operator=(const Arg &); // DO NOT IMPLEMENT private: - ArgClass Kind; - /// The option this argument is an instance of. const Option *Opt; @@ -58,20 +44,24 @@ namespace driver { /// ArgList. unsigned Index; - /// Flag indicating whether this argument was used to effect - /// compilation; used for generating "argument unused" - /// diagnostics. - mutable bool Claimed; + /// Was this argument used to effect compilation; used for generating + /// "argument unused" diagnostics. + mutable unsigned Claimed : 1; + + /// Does this argument own its values. + mutable unsigned OwnsValues : 1; - protected: - Arg(ArgClass Kind, const Option *Opt, unsigned Index, - const Arg *BaseArg = 0); + /// The argument values, as C strings. + llvm::SmallVector<const char *, 2> Values; public: - Arg(const Arg &); - virtual ~Arg(); + Arg(const Option *Opt, unsigned Index, const Arg *BaseArg = 0); + Arg(const Option *Opt, unsigned Index, + const char *Value0, const Arg *BaseArg = 0); + Arg(const Option *Opt, unsigned Index, + const char *Value0, const char *Value1, const Arg *BaseArg = 0); + ~Arg(); - ArgClass getKind() const { return Kind; } const Option &getOption() const { return *Opt; } unsigned getIndex() const { return Index; } @@ -85,19 +75,32 @@ namespace driver { BaseArg = _BaseArg; } + bool getOwnsValues() const { return OwnsValues; } + void setOwnsValues(bool Value) const { OwnsValues = Value; } + bool isClaimed() const { return getBaseArg().Claimed; } /// claim - Set the Arg claimed bit. - - // FIXME: We need to deal with derived arguments and set the bit - // in the original argument; not the derived one. void claim() const { getBaseArg().Claimed = true; } - virtual unsigned getNumValues() const = 0; - virtual const char *getValue(const ArgList &Args, unsigned N=0) const = 0; + unsigned getNumValues() const { return Values.size(); } + const char *getValue(const ArgList &Args, unsigned N=0) const { + return Values[N]; + } + + llvm::SmallVectorImpl<const char*> &getValues() { + return Values; + } + + bool containsValue(llvm::StringRef Value) const { + for (unsigned i = 0, e = getNumValues(); i != e; ++i) + if (Values[i] == Value) + return true; + return false; + } /// render - Append the argument onto the given array as strings. - virtual void render(const ArgList &Args, ArgStringList &Output) const = 0; + void render(const ArgList &Args, ArgStringList &Output) const; /// renderAsInput - Append the argument, render as an input, onto /// the given array as strings. The distinction is that some @@ -114,116 +117,6 @@ namespace driver { std::string getAsString(const ArgList &Args) const; }; - /// FlagArg - An argument with no value. - class FlagArg : public Arg { - public: - FlagArg(const Option *Opt, unsigned Index, const Arg *BaseArg = 0); - - virtual void render(const ArgList &Args, ArgStringList &Output) const; - - virtual unsigned getNumValues() const { return 0; } - virtual const char *getValue(const ArgList &Args, unsigned N=0) const; - - static bool classof(const Arg *A) { - return A->getKind() == Arg::FlagClass; - } - static bool classof(const FlagArg *) { return true; } - }; - - /// PositionalArg - A simple positional argument. - class PositionalArg : public Arg { - public: - PositionalArg(const Option *Opt, unsigned Index, const Arg *BaseArg = 0); - - virtual void render(const ArgList &Args, ArgStringList &Output) const; - - virtual unsigned getNumValues() const { return 1; } - virtual const char *getValue(const ArgList &Args, unsigned N=0) const; - - static bool classof(const Arg *A) { - return A->getKind() == Arg::PositionalClass; - } - static bool classof(const PositionalArg *) { return true; } - }; - - /// JoinedArg - A single value argument where the value is joined - /// (suffixed) to the option. - class JoinedArg : public Arg { - public: - JoinedArg(const Option *Opt, unsigned Index, const Arg *BaseArg = 0); - - virtual void render(const ArgList &Args, ArgStringList &Output) const; - - virtual unsigned getNumValues() const { return 1; } - virtual const char *getValue(const ArgList &Args, unsigned N=0) const; - - static bool classof(const Arg *A) { - return A->getKind() == Arg::JoinedClass; - } - static bool classof(const JoinedArg *) { return true; } - }; - - /// SeparateArg - An argument where one or more values follow the - /// option specifier immediately in the argument vector. - class SeparateArg : public Arg { - unsigned NumValues; - - public: - SeparateArg(const Option *Opt, unsigned Index, unsigned NumValues, - const Arg *BaseArg = 0); - - virtual void render(const ArgList &Args, ArgStringList &Output) const; - - virtual unsigned getNumValues() const { return NumValues; } - virtual const char *getValue(const ArgList &Args, unsigned N=0) const; - - static bool classof(const Arg *A) { - return A->getKind() == Arg::SeparateClass; - } - static bool classof(const SeparateArg *) { return true; } - }; - - /// CommaJoinedArg - An argument with multiple values joined by - /// commas and joined (suffixed) to the option specifier. - /// - /// The key point of this arg is that it renders its values into - /// separate arguments, which allows it to be used as a generic - /// mechanism for passing arguments through to tools. - class CommaJoinedArg : public Arg { - std::vector<std::string> Values; - - public: - CommaJoinedArg(const Option *Opt, unsigned Index, const char *Str, - const Arg *BaseArg = 0); - - virtual void render(const ArgList &Args, ArgStringList &Output) const; - - virtual unsigned getNumValues() const { return Values.size(); } - virtual const char *getValue(const ArgList &Args, unsigned N=0) const; - - static bool classof(const Arg *A) { - return A->getKind() == Arg::CommaJoinedClass; - } - static bool classof(const CommaJoinedArg *) { return true; } - }; - - /// JoinedAndSeparateArg - An argument with both joined and separate - /// values. - class JoinedAndSeparateArg : public Arg { - public: - JoinedAndSeparateArg(const Option *Opt, unsigned Index, - const Arg *BaseArg = 0); - - virtual void render(const ArgList &Args, ArgStringList &Output) const; - - virtual unsigned getNumValues() const { return 2; } - virtual const char *getValue(const ArgList &Args, unsigned N=0) const; - - static bool classof(const Arg *A) { - return A->getKind() == Arg::JoinedAndSeparateClass; - } - static bool classof(const JoinedAndSeparateArg *) { return true; } - }; } // end namespace driver } // end namespace clang diff --git a/include/clang/Driver/ArgList.h b/include/clang/Driver/ArgList.h index 7a14ae84d466..16396daa60ef 100644 --- a/include/clang/Driver/ArgList.h +++ b/include/clang/Driver/ArgList.h @@ -52,9 +52,9 @@ namespace driver { void SkipToNextArg(); public: - typedef const Arg* value_type; - typedef const Arg* reference; - typedef const Arg* pointer; + typedef Arg * const * value_type; + typedef Arg * const & reference; + typedef Arg * const * pointer; typedef std::forward_iterator_tag iterator_category; typedef std::ptrdiff_t difference_type; @@ -67,7 +67,7 @@ namespace driver { operator const Arg*() { return *Current; } reference operator*() const { return *Current; } - pointer operator->() const { return *Current; } + pointer operator->() const { return Current; } arg_iterator &operator++() { ++Current; @@ -96,6 +96,10 @@ namespace driver { /// check for the presence of Arg instances for a particular Option /// and to iterate over groups of arguments. class ArgList { + private: + ArgList(const ArgList &); // DO NOT IMPLEMENT + void operator=(const ArgList &); // DO NOT IMPLEMENT + public: typedef llvm::SmallVector<Arg*, 16> arglist_type; typedef arglist_type::iterator iterator; @@ -104,11 +108,11 @@ namespace driver { typedef arglist_type::const_reverse_iterator const_reverse_iterator; private: - /// The full list of arguments. - arglist_type &Args; + /// The internal list of arguments. + arglist_type Args; protected: - ArgList(arglist_type &Args); + ArgList(); public: virtual ~ArgList(); @@ -179,6 +183,11 @@ namespace driver { /// getArgString - Return the input argument string at \arg Index. virtual const char *getArgString(unsigned Index) const = 0; + /// getNumInputArgStrings - Return the number of original argument strings, + /// which are guaranteed to be the first strings in the argument string + /// list. + virtual unsigned getNumInputArgStrings() const = 0; + /// @} /// @name Argument Lookup Utilities /// @{ @@ -249,14 +258,16 @@ namespace driver { } const char *MakeArgString(const llvm::Twine &Str) const; + /// \brief Create an arg string for (\arg LHS + \arg RHS), reusing the + /// string at \arg Index if possible. + const char *GetOrMakeJoinedArgString(unsigned Index, llvm::StringRef LHS, + llvm::StringRef RHS) const; + /// @} }; class InputArgList : public ArgList { private: - /// The internal list of arguments. - arglist_type ActualArgs; - /// List of argument strings used by the contained Args. /// /// This is mutable since we treat the ArgList as being the list @@ -276,16 +287,15 @@ namespace driver { public: InputArgList(const char **ArgBegin, const char **ArgEnd); - InputArgList(const ArgList &); ~InputArgList(); virtual const char *getArgString(unsigned Index) const { return ArgStrings[Index]; } - /// getNumInputArgStrings - Return the number of original input - /// argument strings. - unsigned getNumInputArgStrings() const { return NumInputArgStrings; } + virtual unsigned getNumInputArgStrings() const { + return NumInputArgStrings; + } /// @name Arg Synthesis /// @{ @@ -303,34 +313,71 @@ namespace driver { /// DerivedArgList - An ordered collection of driver arguments, /// whose storage may be in another argument list. class DerivedArgList : public ArgList { - InputArgList &BaseArgs; - - /// The internal list of arguments. - arglist_type ActualArgs; + const InputArgList &BaseArgs; /// The list of arguments we synthesized. mutable arglist_type SynthesizedArgs; - /// Is this only a proxy for the base ArgList? - bool OnlyProxy; - public: /// Construct a new derived arg list from \arg BaseArgs. - /// - /// \param OnlyProxy - If true, this is only a proxy for the base - /// list (to adapt the type), and it's Args list is unused. - DerivedArgList(InputArgList &BaseArgs, bool OnlyProxy); + DerivedArgList(const InputArgList &BaseArgs); ~DerivedArgList(); virtual const char *getArgString(unsigned Index) const { return BaseArgs.getArgString(Index); } + virtual unsigned getNumInputArgStrings() const { + return BaseArgs.getNumInputArgStrings(); + } + + const InputArgList &getBaseArgs() const { + return BaseArgs; + } + /// @name Arg Synthesis /// @{ + /// AddSynthesizedArg - Add a argument to the list of synthesized arguments + /// (to be freed). + void AddSynthesizedArg(Arg *A) { + SynthesizedArgs.push_back(A); + } + virtual const char *MakeArgString(llvm::StringRef Str) const; + /// AddFlagArg - Construct a new FlagArg for the given option \arg Id and + /// append it to the argument list. + void AddFlagArg(const Arg *BaseArg, const Option *Opt) { + append(MakeFlagArg(BaseArg, Opt)); + } + + /// AddPositionalArg - Construct a new Positional arg for the given option + /// \arg Id, with the provided \arg Value and append it to the argument + /// list. + void AddPositionalArg(const Arg *BaseArg, const Option *Opt, + llvm::StringRef Value) { + append(MakePositionalArg(BaseArg, Opt, Value)); + } + + + /// AddSeparateArg - Construct a new Positional arg for the given option + /// \arg Id, with the provided \arg Value and append it to the argument + /// list. + void AddSeparateArg(const Arg *BaseArg, const Option *Opt, + llvm::StringRef Value) { + append(MakeSeparateArg(BaseArg, Opt, Value)); + } + + + /// AddJoinedArg - Construct a new Positional arg for the given option \arg + /// Id, with the provided \arg Value and append it to the argument list. + void AddJoinedArg(const Arg *BaseArg, const Option *Opt, + llvm::StringRef Value) { + append(MakeJoinedArg(BaseArg, Opt, Value)); + } + + /// MakeFlagArg - Construct a new FlagArg for the given option /// \arg Id. Arg *MakeFlagArg(const Arg *BaseArg, const Option *Opt) const; diff --git a/include/clang/Driver/CC1Options.td b/include/clang/Driver/CC1Options.td index fd8322b84370..7076f30995d0 100644 --- a/include/clang/Driver/CC1Options.td +++ b/include/clang/Driver/CC1Options.td @@ -18,6 +18,8 @@ include "OptParser.td" // Target Options //===----------------------------------------------------------------------===// +def cxx_abi : Separate<"-cxx-abi">, + HelpText<"Target a particular C++ ABI type">; def target_abi : Separate<"-target-abi">, HelpText<"Target a particular ABI type">; def target_cpu : Separate<"-target-cpu">, @@ -79,6 +81,8 @@ def analyzer_display_progress : Flag<"-analyzer-display-progress">, HelpText<"Emit verbose output about the analyzer's progress">; def analyzer_experimental_checks : Flag<"-analyzer-experimental-checks">, HelpText<"Use experimental path-sensitive checks">; +def analyzer_idempotent_operation : Flag<"-analyzer-idempotent-operation">, + HelpText<"Use experimental path-sensitive idempotent operation checker">; def analyzer_experimental_internal_checks : Flag<"-analyzer-experimental-internal-checks">, HelpText<"Use new default path-sensitive checks currently in testing">; @@ -121,6 +125,8 @@ def fno_common : Flag<"-fno-common">, HelpText<"Compile common globals like normal definitions">; def no_implicit_float : Flag<"-no-implicit-float">, HelpText<"Don't generate implicit floating point instructions (x86-only)">; +def finstrument_functions : Flag<"-finstrument-functions">, + HelpText<"Generate calls to instrument function entry and exit">; def fno_merge_all_constants : Flag<"-fno-merge-all-constants">, HelpText<"Disallow merging of constants.">; def fno_threadsafe_statics : Flag<"-fno-threadsafe-statics">, @@ -145,6 +151,8 @@ def mlimit_float_precision : Separate<"-mlimit-float-precision">, HelpText<"Limit float precision to the given value">; def mno_zero_initialized_in_bss : Flag<"-mno-zero-initialized-in-bss">, HelpText<"Do not put zero initialized data in the BSS">; +def momit_leaf_frame_pointer : Flag<"-momit-leaf-frame-pointer">, + HelpText<"Omit frame pointer setup for leaf functions.">; def msoft_float : Flag<"-msoft-float">, HelpText<"Use software floating point">; def mrelax_all : Flag<"-mrelax-all">, @@ -182,6 +190,9 @@ def fno_show_column : Flag<"-fno-show-column">, HelpText<"Do not include column number on diagnostics">; def fno_show_source_location : Flag<"-fno-show-source-location">, HelpText<"Do not include source location information with diagnostics">; +def fshow_overloads_EQ : Joined<"-fshow-overloads=">, + HelpText<"Which overload candidates to show when overload resolution fails: " + "best|all; defaults to all">; def fno_caret_diagnostics : Flag<"-fno-caret-diagnostics">, HelpText<"Do not include source line and caret with diagnostics">; def fno_diagnostics_fixit_info : Flag<"-fno-diagnostics-fixit-info">, @@ -259,8 +270,11 @@ def cxx_inheritance_view : Separate<"-cxx-inheritance-view">, def o : Separate<"-o">, MetaVarName<"<path>">, HelpText<"Specify output file">; def load : Separate<"-load">, MetaVarName<"<dsopath>">, HelpText<"Load the named plugin (dynamic shared object)">; -def plugin : Separate<"-plugin">, +def plugin : Separate<"-plugin">, MetaVarName<"<name>">, HelpText<"Use the named plugin action (use \"help\" to list available options)">; +def plugin_arg : JoinedAndSeparate<"-plugin-arg-">, + MetaVarName<"<name> <arg>">, + HelpText<"Pass <arg> to plugin <name>">; def resource_dir : Separate<"-resource-dir">, HelpText<"The directory which holds the compiler resource files">; def version : Flag<"-version">, @@ -333,6 +347,8 @@ def rewrite_macros : Flag<"-rewrite-macros">, def relocatable_pch : Flag<"-relocatable-pch">, HelpText<"Whether to build a relocatable precompiled header">; +def chained_pch : Flag<"-chained-pch">, + HelpText<"Whether to chain the new precompiled header to the old one.">; def print_stats : Flag<"-print-stats">, HelpText<"Print performance metrics and statistics">; def ftime_report : Flag<"-ftime-report">, @@ -395,6 +411,8 @@ def fno_operator_names : Flag<"-fno-operator-names">, HelpText<"Do not treat C++ operator name keywords as synonyms for operators">; def fno_signed_char : Flag<"-fno-signed-char">, HelpText<"Char is unsigned">; +def fno_spell_checking : Flag<"-fno-spell-checking">, + HelpText<"Disable spell-checking">; def fno_use_cxa_atexit : Flag<"-fno-use-cxa-atexit">, HelpText<"Don't use __cxa_atexit for calling destructors">; def fconstant_string_class : Separate<"-fconstant-string-class">, @@ -416,6 +434,8 @@ def fobjc_nonfragile_abi2 : Flag<"-fobjc-nonfragile-abi2">, HelpText<"enable objective-c's enhanced nonfragile abi">; def ftrapv : Flag<"-ftrapv">, HelpText<"Trap on integer overflow">; +def fwrapv : Flag<"-fwrapv">, + HelpText<"Treat signed integer overflow as two's complement">; def pic_level : Separate<"-pic-level">, HelpText<"Value for __PIC__">; def pthread : Flag<"-pthread">, @@ -432,6 +452,8 @@ def stack_protector : Separate<"-stack-protector">, HelpText<"Enable stack protectors">; def fvisibility : Separate<"-fvisibility">, HelpText<"Default symbol visibility">; +def fvisibility_inlines_hidden : Flag<"-fvisibility-inlines-hidden">, + HelpText<"Give inline C++ member functions default visibility by default">; def ftemplate_depth : Separate<"-ftemplate-depth">, HelpText<"Maximum depth of recursive template instantiation">; def trigraphs : Flag<"-trigraphs">, diff --git a/include/clang/Driver/Compilation.h b/include/clang/Driver/Compilation.h index 56786a7ae2a3..5f062a121c6d 100644 --- a/include/clang/Driver/Compilation.h +++ b/include/clang/Driver/Compilation.h @@ -40,13 +40,18 @@ class Compilation { /// The original (untranslated) input argument list. InputArgList *Args; + /// The driver translated arguments. Note that toolchains may perform their + /// own argument translation. + DerivedArgList *TranslatedArgs; + /// The list of actions. ActionList Actions; /// The root list of jobs. JobList Jobs; - /// Cache of translated arguments for a particular tool chain. + /// Cache of translated arguments for a particular tool chain and bound + /// architecture. llvm::DenseMap<std::pair<const ToolChain*, const char*>, DerivedArgList*> TCArgs; @@ -58,14 +63,16 @@ class Compilation { public: Compilation(const Driver &D, const ToolChain &DefaultToolChain, - InputArgList *Args); + InputArgList *Args, DerivedArgList *TranslatedArgs); ~Compilation(); const Driver &getDriver() const { return TheDriver; } const ToolChain &getDefaultToolChain() const { return DefaultToolChain; } - const InputArgList &getArgs() const { return *Args; } + const InputArgList &getInputArgs() const { return *Args; } + + const DerivedArgList &getArgs() const { return *TranslatedArgs; } ActionList &getActions() { return Actions; } const ActionList &getActions() const { return Actions; } diff --git a/include/clang/Driver/Driver.h b/include/clang/Driver/Driver.h index 90c3a0dcdc18..153981f842d3 100644 --- a/include/clang/Driver/Driver.h +++ b/include/clang/Driver/Driver.h @@ -31,6 +31,7 @@ namespace driver { class Action; class ArgList; class Compilation; + class DerivedArgList; class HostInfo; class InputArgList; class InputInfo; @@ -135,6 +136,11 @@ private: std::list<std::string> TempFiles; std::list<std::string> ResultFiles; +private: + /// TranslateInputArgs - Create a new derived argument list from the input + /// arguments, after applying the standard argument translations. + DerivedArgList *TranslateInputArgs(const InputArgList &Args) const; + public: Driver(llvm::StringRef _Name, llvm::StringRef _Dir, llvm::StringRef _DefaultHostTriple, diff --git a/include/clang/Driver/HostInfo.h b/include/clang/Driver/HostInfo.h index ca1ee9aa7766..1b99a4459d16 100644 --- a/include/clang/Driver/HostInfo.h +++ b/include/clang/Driver/HostInfo.h @@ -76,6 +76,8 @@ const HostInfo *createOpenBSDHostInfo(const Driver &D, const llvm::Triple& Triple); const HostInfo *createFreeBSDHostInfo(const Driver &D, const llvm::Triple& Triple); +const HostInfo *createMinixHostInfo(const Driver &D, + const llvm::Triple& Triple); const HostInfo *createDragonFlyHostInfo(const Driver &D, const llvm::Triple& Triple); const HostInfo *createLinuxHostInfo(const Driver &D, diff --git a/include/clang/Driver/Makefile b/include/clang/Driver/Makefile index b462aaa24bc9..d8291662a563 100644 --- a/include/clang/Driver/Makefile +++ b/include/clang/Driver/Makefile @@ -1,9 +1,9 @@ -LEVEL = ../../../../.. +CLANG_LEVEL := ../../.. BUILT_SOURCES = Options.inc CC1Options.inc CC1AsOptions.inc TABLEGEN_INC_FILES_COMMON = 1 -include $(LEVEL)/Makefile.common +include $(CLANG_LEVEL)/Makefile $(ObjDir)/Options.inc.tmp : Options.td OptParser.td $(TBLGEN) $(ObjDir)/.dir $(Echo) "Building Clang Driver Option tables with tblgen" diff --git a/include/clang/Driver/OptTable.h b/include/clang/Driver/OptTable.h index edae75c9f057..e4a2eba578b8 100644 --- a/include/clang/Driver/OptTable.h +++ b/include/clang/Driver/OptTable.h @@ -33,6 +33,7 @@ namespace options { } class Arg; + class ArgList; class InputArgList; class Option; @@ -150,7 +151,7 @@ namespace options { /// \return - The parsed argument, or 0 if the argument is missing values /// (in which case Index still points at the conceptual next argument string /// to parse). - Arg *ParseOneArg(const InputArgList &Args, unsigned &Index) const; + Arg *ParseOneArg(const ArgList &Args, unsigned &Index) const; /// ParseArgs - Parse an list of arguments into an InputArgList. /// diff --git a/include/clang/Driver/Option.h b/include/clang/Driver/Option.h index 08b94b1d797d..0864382cb3a6 100644 --- a/include/clang/Driver/Option.h +++ b/include/clang/Driver/Option.h @@ -21,7 +21,7 @@ using llvm::dyn_cast_or_null; namespace clang { namespace driver { class Arg; - class InputArgList; + class ArgList; class OptionGroup; /// Option - Abstract representation for a single form of driver @@ -50,6 +50,13 @@ namespace driver { JoinedAndSeparateClass }; + enum RenderStyleKind { + RenderCommaJoinedStyle, + RenderJoinedStyle, + RenderSeparateStyle, + RenderValuesStyle + }; + private: OptionClass Kind; @@ -65,7 +72,7 @@ namespace driver { /// Option that this is an alias for, if any. const Option *Alias; - /// Unsupported options will not be rejected. + /// Unsupported options will be rejected. bool Unsupported : 1; /// Treat this option like a linker input? @@ -76,11 +83,8 @@ namespace driver { // FIXME: We should ditch the render/renderAsInput distinction. bool NoOptAsInput : 1; - /// Always render this option as separate form its value. - bool ForceSeparateRender : 1; - - /// Always render this option joined with its value. - bool ForceJoinedRender : 1; + /// The style to using when rendering arguments parsed by this option. + unsigned RenderStyle : 2; /// This option is only consumed by the driver. bool DriverOption : 1; @@ -109,11 +113,10 @@ namespace driver { bool hasNoOptAsInput() const { return NoOptAsInput; } void setNoOptAsInput(bool Value) { NoOptAsInput = Value; } - bool hasForceSeparateRender() const { return ForceSeparateRender; } - void setForceSeparateRender(bool Value) { ForceSeparateRender = Value; } - - bool hasForceJoinedRender() const { return ForceJoinedRender; } - void setForceJoinedRender(bool Value) { ForceJoinedRender = Value; } + RenderStyleKind getRenderStyle() const { + return RenderStyleKind(RenderStyle); + } + void setRenderStyle(RenderStyleKind Value) { RenderStyle = Value; } bool isDriverOption() const { return DriverOption; } void setDriverOption(bool Value) { DriverOption = Value; } @@ -151,7 +154,7 @@ namespace driver { /// If the option accepts the current argument, accept() sets /// Index to the position where argument parsing should resume /// (even if the argument is missing values). - virtual Arg *accept(const InputArgList &Args, unsigned &Index) const = 0; + virtual Arg *accept(const ArgList &Args, unsigned &Index) const = 0; void dump() const; @@ -164,7 +167,7 @@ namespace driver { public: OptionGroup(OptSpecifier ID, const char *Name, const OptionGroup *Group); - virtual Arg *accept(const InputArgList &Args, unsigned &Index) const; + virtual Arg *accept(const ArgList &Args, unsigned &Index) const; static bool classof(const Option *O) { return O->getKind() == Option::GroupClass; @@ -179,7 +182,7 @@ namespace driver { public: InputOption(OptSpecifier ID); - virtual Arg *accept(const InputArgList &Args, unsigned &Index) const; + virtual Arg *accept(const ArgList &Args, unsigned &Index) const; static bool classof(const Option *O) { return O->getKind() == Option::InputClass; @@ -192,7 +195,7 @@ namespace driver { public: UnknownOption(OptSpecifier ID); - virtual Arg *accept(const InputArgList &Args, unsigned &Index) const; + virtual Arg *accept(const ArgList &Args, unsigned &Index) const; static bool classof(const Option *O) { return O->getKind() == Option::UnknownClass; @@ -207,7 +210,7 @@ namespace driver { FlagOption(OptSpecifier ID, const char *Name, const OptionGroup *Group, const Option *Alias); - virtual Arg *accept(const InputArgList &Args, unsigned &Index) const; + virtual Arg *accept(const ArgList &Args, unsigned &Index) const; static bool classof(const Option *O) { return O->getKind() == Option::FlagClass; @@ -220,7 +223,7 @@ namespace driver { JoinedOption(OptSpecifier ID, const char *Name, const OptionGroup *Group, const Option *Alias); - virtual Arg *accept(const InputArgList &Args, unsigned &Index) const; + virtual Arg *accept(const ArgList &Args, unsigned &Index) const; static bool classof(const Option *O) { return O->getKind() == Option::JoinedClass; @@ -233,7 +236,7 @@ namespace driver { SeparateOption(OptSpecifier ID, const char *Name, const OptionGroup *Group, const Option *Alias); - virtual Arg *accept(const InputArgList &Args, unsigned &Index) const; + virtual Arg *accept(const ArgList &Args, unsigned &Index) const; static bool classof(const Option *O) { return O->getKind() == Option::SeparateClass; @@ -246,7 +249,7 @@ namespace driver { CommaJoinedOption(OptSpecifier ID, const char *Name, const OptionGroup *Group, const Option *Alias); - virtual Arg *accept(const InputArgList &Args, unsigned &Index) const; + virtual Arg *accept(const ArgList &Args, unsigned &Index) const; static bool classof(const Option *O) { return O->getKind() == Option::CommaJoinedClass; @@ -267,7 +270,7 @@ namespace driver { unsigned getNumArgs() const { return NumArgs; } - virtual Arg *accept(const InputArgList &Args, unsigned &Index) const; + virtual Arg *accept(const ArgList &Args, unsigned &Index) const; static bool classof(const Option *O) { return O->getKind() == Option::MultiArgClass; @@ -282,7 +285,7 @@ namespace driver { JoinedOrSeparateOption(OptSpecifier ID, const char *Name, const OptionGroup *Group, const Option *Alias); - virtual Arg *accept(const InputArgList &Args, unsigned &Index) const; + virtual Arg *accept(const ArgList &Args, unsigned &Index) const; static bool classof(const Option *O) { return O->getKind() == Option::JoinedOrSeparateClass; @@ -297,7 +300,7 @@ namespace driver { JoinedAndSeparateOption(OptSpecifier ID, const char *Name, const OptionGroup *Group, const Option *Alias); - virtual Arg *accept(const InputArgList &Args, unsigned &Index) const; + virtual Arg *accept(const ArgList &Args, unsigned &Index) const; static bool classof(const Option *O) { return O->getKind() == Option::JoinedAndSeparateClass; diff --git a/include/clang/Driver/Options.td b/include/clang/Driver/Options.td index a9a52c01f45b..96ec12215b40 100644 --- a/include/clang/Driver/Options.td +++ b/include/clang/Driver/Options.td @@ -124,11 +124,11 @@ def C : Flag<"-C">; def D : JoinedOrSeparate<"-D">, Group<CompileOnly_Group>; def E : Flag<"-E">, Flags<[DriverOption]>, HelpText<"Only run the preprocessor">; -def F : JoinedOrSeparate<"-F">; +def F : JoinedOrSeparate<"-F">, Flags<[RenderJoined]>; def H : Flag<"-H">; def I_ : Flag<"-I-">, Group<I_Group>; def I : JoinedOrSeparate<"-I">, Group<I_Group>; -def L : JoinedOrSeparate<"-L">; +def L : JoinedOrSeparate<"-L">, Flags<[RenderJoined]>; def MD : Flag<"-MD">, Group<M_Group>; def MF : JoinedOrSeparate<"-MF">, Group<M_Group>; def MG : Flag<"-MG">, Group<M_Group>; @@ -244,6 +244,7 @@ def fbootclasspath_EQ : Joined<"-fbootclasspath=">, Group<f_Group>; def fbuiltin_strcat : Flag<"-fbuiltin-strcat">, Group<f_Group>; def fbuiltin_strcpy : Flag<"-fbuiltin-strcpy">, Group<f_Group>; def fbuiltin : Flag<"-fbuiltin">, Group<f_Group>; +def fcaret_diagnostics : Flag<"-fcaret-diagnostics">, Group<f_Group>; def fcatch_undefined_behavior : Flag<"-fcatch-undefined-behavior">, Group<f_Group>, HelpText<"Generate runtime checks for undefined behavior.">; def fclasspath_EQ : Joined<"-fclasspath=">, Group<f_Group>; @@ -267,6 +268,8 @@ def fencoding_EQ : Joined<"-fencoding=">, Group<f_Group>; def fexceptions : Flag<"-fexceptions">, Group<f_Group>; def fextdirs_EQ : Joined<"-fextdirs=">, Group<f_Group>; def fhosted : Flag<"-fhosted">, Group<f_Group>; +def ffast_math : Flag<"-ffast-math">, Group<clang_ignored_f_Group>; +def ffinite_math_only : Flag<"-ffinite-math-only">, Group<clang_ignored_f_Group>; def ffreestanding : Flag<"-ffreestanding">, Group<f_Group>; def fgnu_keywords : Flag<"-fgnu-keywords">, Group<f_Group>; def fgnu_runtime : Flag<"-fgnu-runtime">, Group<f_Group>; @@ -275,6 +278,7 @@ def filelist : Separate<"-filelist">, Flags<[LinkerInput]>; def findirect_virtual_calls : Flag<"-findirect-virtual-calls">, Group<f_Group>; def finline_functions : Flag<"-finline-functions">, Group<clang_ignored_f_Group>; def finline : Flag<"-finline">, Group<clang_ignored_f_Group>; +def finstrument_functions : Flag<"-finstrument-functions">, Group<f_Group>; def fkeep_inline_functions : Flag<"-fkeep-inline-functions">, Group<clang_ignored_f_Group>; def flat__namespace : Flag<"-flat_namespace">; def flax_vector_conversions : Flag<"-flax-vector-conversions">, Group<f_Group>; @@ -307,6 +311,7 @@ def fno_diagnostics_show_option : Flag<"-fno-diagnostics-show-option">, Group<f_ def fno_dollars_in_identifiers : Flag<"-fno-dollars-in-identifiers">, Group<f_Group>; def fno_eliminate_unused_debug_symbols : Flag<"-fno-eliminate-unused-debug-symbols">, Group<f_Group>; def fno_exceptions : Flag<"-fno-exceptions">, Group<f_Group>; +def fno_finite_math_only : Flag<"-fno-finite-math-only">, Group<clang_ignored_f_Group>; def fno_gnu_keywords : Flag<"-fno-gnu-keywords">, Group<f_Group>; def fno_inline_functions : Flag<"-fno-inline-functions">, Group<clang_ignored_f_Group>; def fno_inline : Flag<"-fno-inline">, Group<clang_ignored_f_Group>; @@ -321,6 +326,7 @@ def fno_pascal_strings : Flag<"-fno-pascal-strings">, Group<f_Group>; def fno_rtti : Flag<"-fno-rtti">, Group<f_Group>; def fno_show_column : Flag<"-fno-show-column">, Group<f_Group>; def fno_show_source_location : Flag<"-fno-show-source-location">, Group<f_Group>; +def fno_spell_checking : Flag<"-fno-spell-checking">, Group<f_Group>; def fno_stack_protector : Flag<"-fno-stack-protector">, Group<f_Group>; def fno_strict_aliasing : Flag<"-fno-strict-aliasing">, Group<clang_ignored_f_Group>; def fno_threadsafe_statics : Flag<"-fno-threadsafe-statics">, Group<f_Group>; @@ -358,7 +364,9 @@ def fsched_interblock : Flag<"-fsched-interblock">, Group<clang_ignored_f_Group> def fshort_enums : Flag<"-fshort-enums">, Group<clang_ignored_f_Group>; def freorder_blocks : Flag<"-freorder-blocks">, Group<clang_ignored_f_Group>; def fshort_wchar : Flag<"-fshort-wchar">, Group<f_Group>; +def fshow_overloads_EQ : Joined<"-fshow-overloads=">, Group<f_Group>; def fshow_source_location : Flag<"-fshow-source-location">, Group<f_Group>; +def fspell_checking : Flag<"-fspell-checking">, Group<f_Group>; def fsigned_bitfields : Flag<"-fsigned-bitfields">, Group<f_Group>; def fsigned_char : Flag<"-fsigned-char">, Group<f_Group>; def fstack_protector_all : Flag<"-fstack-protector-all">, Group<f_Group>; @@ -381,6 +389,8 @@ def funwind_tables : Flag<"-funwind-tables">, Group<f_Group>; def fuse_cxa_atexit : Flag<"-fuse-cxa-atexit">, Group<f_Group>; def fverbose_asm : Flag<"-fverbose-asm">, Group<f_Group>; def fvisibility_EQ : Joined<"-fvisibility=">, Group<f_Group>; +def fvisibility_inlines_hidden : Flag<"-fvisibility-inlines-hidden">, Group<f_Group>; +def fwrapv : Flag<"-fwrapv">, Group<f_Group>; def fwritable_strings : Flag<"-fwritable-strings">, Group<f_Group>; def fzero_initialized_in_bss : Flag<"-fzero-initialized-in-bss">, Group<f_Group>; def ffunction_sections: Flag <"-ffunction-sections">, Group<f_Group>; @@ -427,6 +437,7 @@ def mfloat_abi_EQ : Joined<"-mfloat-abi=">, Group<m_Group>; def mfpu_EQ : Joined<"-mfpu=">, Group<m_Group>; def mhard_float : Flag<"-mhard-float">, Group<m_Group>; def miphoneos_version_min_EQ : Joined<"-miphoneos-version-min=">, Group<m_Group>, Flags<[DriverOption]>; +def mios_version_min_EQ : Joined<"-mios-version-min=">, Alias<miphoneos_version_min_EQ>; def mkernel : Flag<"-mkernel">, Group<m_Group>; def mllvm : Separate<"-mllvm">; def mmacosx_version_min_EQ : Joined<"-mmacosx-version-min=">, Group<m_Group>, Flags<[DriverOption]>; @@ -453,6 +464,8 @@ def mno_thumb : Flag<"-mno-thumb">, Group<m_Group>; def marm : Flag<"-marm">, Alias<mno_thumb>; 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<f_Group>; +def momit_leaf_frame_pointer : Flag<"-momit-leaf-frame-pointer">, Group<f_Group>; def mpascal_strings : Flag<"-mpascal-strings">, Group<m_Group>; def mred_zone : Flag<"-mred-zone">, Group<m_Group>; def mrelax_all : Flag<"-mrelax-all">, Group<m_Group>; @@ -585,7 +598,7 @@ def y : Joined<"-y">; // options. def _CLASSPATH_EQ : Joined<"--CLASSPATH=">, Alias<fclasspath_EQ>; -def _CLASSPATH : Separate<"--CLASSPATH">, Alias<fclasspath_EQ>, Flags<[RenderJoined]>; +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]>; @@ -594,80 +607,80 @@ def _analyze : Flag<"--analyze">, Flags<[DriverOption]>, HelpText<"Run the static analyzer">; def _ansi : Flag<"--ansi">, Alias<ansi>; def _assemble : Flag<"--assemble">, Alias<S>; -def _assert_EQ : Joined<"--assert=">, Alias<A>, Flags<[RenderSeparate]>; +def _assert_EQ : Joined<"--assert=">, Alias<A>; def _assert : Separate<"--assert">, Alias<A>; def _bootclasspath_EQ : Joined<"--bootclasspath=">, Alias<fbootclasspath_EQ>; -def _bootclasspath : Separate<"--bootclasspath">, Alias<fbootclasspath_EQ>, Flags<[RenderJoined]>; +def _bootclasspath : Separate<"--bootclasspath">, Alias<fbootclasspath_EQ>; def _classpath_EQ : Joined<"--classpath=">, Alias<fclasspath_EQ>; -def _classpath : Separate<"--classpath">, Alias<fclasspath_EQ>, Flags<[RenderJoined]>; -def _combine : Flag<"--combine">, Alias<combine>, Flags<[Unsupported]>; +def _classpath : Separate<"--classpath">, Alias<fclasspath_EQ>; +def _combine : Flag<"--combine">, Alias<combine>; def _comments_in_macros : Flag<"--comments-in-macros">, Alias<CC>; def _comments : Flag<"--comments">, Alias<C>; def _compile : Flag<"--compile">, Alias<c>; def _constant_cfstrings : Flag<"--constant-cfstrings">; def _coverage : Flag<"--coverage">, Alias<coverage>; -def _debug_EQ : Joined<"--debug=">, Alias<g_Flag>, Flags<[Unsupported]>; -def _debug : Flag<"--debug">, Alias<g_Flag>, Flags<[Unsupported]>; +def _debug_EQ : Joined<"--debug=">, Alias<g_Flag>; +def _debug : Flag<"--debug">, Alias<g_Flag>; def _define_macro_EQ : Joined<"--define-macro=">, Alias<D>; -def _define_macro : Separate<"--define-macro">, Alias<D>, Flags<[RenderJoined]>; +def _define_macro : Separate<"--define-macro">, Alias<D>; def _dependencies : Flag<"--dependencies">, Alias<M>; def _encoding_EQ : Joined<"--encoding=">, Alias<fencoding_EQ>; -def _encoding : Separate<"--encoding">, Alias<fencoding_EQ>, Flags<[RenderJoined]>; +def _encoding : Separate<"--encoding">, Alias<fencoding_EQ>; def _entry : Flag<"--entry">, Alias<e>; def _extdirs_EQ : Joined<"--extdirs=">, Alias<fextdirs_EQ>; -def _extdirs : Separate<"--extdirs">, Alias<fextdirs_EQ>, Flags<[RenderJoined]>; +def _extdirs : Separate<"--extdirs">, Alias<fextdirs_EQ>; def _extra_warnings : Flag<"--extra-warnings">, Alias<W_Joined>; -def _for_linker_EQ : Joined<"--for-linker=">, Alias<Xlinker>, Flags<[LinkerInput, RenderAsInput, RenderSeparate]>; -def _for_linker : Separate<"--for-linker">, Alias<Xlinker>, Flags<[LinkerInput, RenderAsInput]>; -def _force_link_EQ : Joined<"--force-link=">, Alias<u>, Flags<[RenderSeparate]>; +def _for_linker_EQ : Joined<"--for-linker=">, Alias<Xlinker>; +def _for_linker : Separate<"--for-linker">, Alias<Xlinker>; +def _force_link_EQ : Joined<"--force-link=">, Alias<u>; def _force_link : Separate<"--force-link">, Alias<u>; def _help_hidden : Flag<"--help-hidden">; def _help : Flag<"--help">, HelpText<"Display available options">; -def _imacros_EQ : Joined<"--imacros=">, Alias<imacros>, Flags<[RenderSeparate]>; +def _imacros_EQ : Joined<"--imacros=">, Alias<imacros>; def _imacros : Separate<"--imacros">, Alias<imacros>; def _include_barrier : Flag<"--include-barrier">, Alias<I_>; -def _include_directory_after_EQ : Joined<"--include-directory-after=">, Alias<idirafter>, Flags<[RenderSeparate]>; +def _include_directory_after_EQ : Joined<"--include-directory-after=">, Alias<idirafter>; def _include_directory_after : Separate<"--include-directory-after">, Alias<idirafter>; def _include_directory_EQ : Joined<"--include-directory=">, Alias<I>; -def _include_directory : Separate<"--include-directory">, Alias<I>, Flags<[RenderJoined]>; -def _include_prefix_EQ : Joined<"--include-prefix=">, Alias<iprefix>, Flags<[RenderSeparate]>; +def _include_directory : Separate<"--include-directory">, Alias<I>; +def _include_prefix_EQ : Joined<"--include-prefix=">, Alias<iprefix>; def _include_prefix : Separate<"--include-prefix">, Alias<iprefix>; -def _include_with_prefix_after_EQ : Joined<"--include-with-prefix-after=">, Alias<iwithprefix>, Flags<[RenderSeparate]>; +def _include_with_prefix_after_EQ : Joined<"--include-with-prefix-after=">, Alias<iwithprefix>; def _include_with_prefix_after : Separate<"--include-with-prefix-after">, Alias<iwithprefix>; -def _include_with_prefix_before_EQ : Joined<"--include-with-prefix-before=">, Alias<iwithprefixbefore>, Flags<[RenderSeparate]>; +def _include_with_prefix_before_EQ : Joined<"--include-with-prefix-before=">, Alias<iwithprefixbefore>; def _include_with_prefix_before : Separate<"--include-with-prefix-before">, Alias<iwithprefixbefore>; -def _include_with_prefix_EQ : Joined<"--include-with-prefix=">, Alias<iwithprefix>, Flags<[RenderSeparate]>; +def _include_with_prefix_EQ : Joined<"--include-with-prefix=">, Alias<iwithprefix>; def _include_with_prefix : Separate<"--include-with-prefix">, Alias<iwithprefix>; -def _include_EQ : Joined<"--include=">, Alias<include_>, Flags<[RenderSeparate]>; +def _include_EQ : Joined<"--include=">, Alias<include_>; def _include : Separate<"--include">, Alias<include_>; -def _language_EQ : Joined<"--language=">, Alias<x>, Flags<[RenderSeparate]>; +def _language_EQ : Joined<"--language=">, Alias<x>; def _language : Separate<"--language">, Alias<x>; -def _library_directory_EQ : Joined<"--library-directory=">, Alias<L>, Flags<[RenderSeparate]>; +def _library_directory_EQ : Joined<"--library-directory=">, Alias<L>; def _library_directory : Separate<"--library-directory">, Alias<L>; -def _machine__EQ : Joined<"--machine-=">, Alias<m_Joined>, Flags<[Unsupported]>; -def _machine_ : Joined<"--machine-">, Alias<m_Joined>, Flags<[Unsupported]>; +def _machine__EQ : Joined<"--machine-=">, Alias<m_Joined>; +def _machine_ : Joined<"--machine-">, Alias<m_Joined>; def _machine_EQ : Joined<"--machine=">, Alias<m_Joined>; -def _machine : Separate<"--machine">, Alias<m_Joined>, Flags<[RenderJoined]>; +def _machine : Separate<"--machine">, Alias<m_Joined>; def _no_integrated_cpp : Flag<"--no-integrated-cpp">, Alias<no_integrated_cpp>; def _no_line_commands : Flag<"--no-line-commands">, Alias<P>; def _no_standard_includes : Flag<"--no-standard-includes">, Alias<nostdinc>; def _no_standard_libraries : Flag<"--no-standard-libraries">, Alias<nostdlib>; def _no_undefined : Flag<"--no-undefined">, Flags<[LinkerInput]>; def _no_warnings : Flag<"--no-warnings">, Alias<w>; -def _optimize_EQ : Joined<"--optimize=">, Alias<O>, Flags<[Unsupported]>; -def _optimize : Flag<"--optimize">, Alias<O>, Flags<[Unsupported]>; +def _optimize_EQ : Joined<"--optimize=">, Alias<O>; +def _optimize : Flag<"--optimize">, Alias<O>; def _output_class_directory_EQ : Joined<"--output-class-directory=">, Alias<foutput_class_dir_EQ>; -def _output_class_directory : Separate<"--output-class-directory">, Alias<foutput_class_dir_EQ>, Flags<[RenderJoined]>; -def _output_EQ : Joined<"--output=">, Alias<o>, Flags<[RenderSeparate]>; +def _output_class_directory : Separate<"--output-class-directory">, Alias<foutput_class_dir_EQ>; +def _output_EQ : Joined<"--output=">, Alias<o>; def _output : Separate<"--output">, Alias<o>; def _param : Separate<"--param">; -def _param_EQ : Joined<"--param=">, Alias<_param>, Flags<[RenderSeparate]>; +def _param_EQ : Joined<"--param=">, Alias<_param>; def _pass_exit_codes : Flag<"--pass-exit-codes">, Alias<pass_exit_codes>; def _pedantic_errors : Flag<"--pedantic-errors">, Alias<pedantic_errors>; def _pedantic : Flag<"--pedantic">, Alias<pedantic>; -def _pipe : Flag<"--pipe">, Alias<pipe>, Flags<[DriverOption]>; -def _prefix_EQ : Joined<"--prefix=">, Alias<B>, Flags<[RenderSeparate]>; +def _pipe : Flag<"--pipe">, Alias<pipe>; +def _prefix_EQ : Joined<"--prefix=">, Alias<B>; def _prefix : Separate<"--prefix">, Alias<B>; def _preprocess : Flag<"--preprocess">, Alias<E>; def _print_diagnostic_categories : Flag<"--print-diagnostic-categories">; @@ -686,30 +699,33 @@ def _profile : Flag<"--profile">, Alias<p>; def _relocatable_pch : Flag<"--relocatable-pch">, HelpText<"Build a relocatable precompiled header">; def _resource_EQ : Joined<"--resource=">, Alias<fcompile_resource_EQ>; -def _resource : Separate<"--resource">, Alias<fcompile_resource_EQ>, Flags<[RenderJoined]>; +def _resource : Separate<"--resource">, Alias<fcompile_resource_EQ>; def _save_temps : Flag<"--save-temps">, Alias<save_temps>; def _shared : Flag<"--shared">, Alias<shared>; def _signed_char : Flag<"--signed-char">, Alias<fsigned_char>; -def _specs_EQ : Joined<"--specs=">, Alias<specs_EQ>, Flags<[Unsupported]>; -def _specs : Separate<"--specs">, Alias<specs_EQ>, Flags<[RenderJoined, Unsupported]>; +def _specs_EQ : Joined<"--specs=">, Alias<specs_EQ>; +def _specs : Separate<"--specs">, Alias<specs_EQ>; def _static : Flag<"--static">, Alias<static>; def _std_EQ : Joined<"--std=">, Alias<std_EQ>; -def _std : Separate<"--std">, Alias<std_EQ>, Flags<[RenderJoined]>; +def _std : Separate<"--std">, Alias<std_EQ>; def _sysroot_EQ : Joined<"--sysroot=">; -def _sysroot : Separate<"--sysroot">, Alias<_sysroot_EQ>, Flags<[RenderJoined]>; +def _sysroot : Separate<"--sysroot">, Alias<_sysroot_EQ>; def _target_help : Flag<"--target-help">; def _trace_includes : Flag<"--trace-includes">, Alias<H>; def _traditional_cpp : Flag<"--traditional-cpp">, Alias<traditional_cpp>; def _traditional : Flag<"--traditional">, Alias<traditional>; def _trigraphs : Flag<"--trigraphs">, Alias<trigraphs>; def _undefine_macro_EQ : Joined<"--undefine-macro=">, Alias<U>; -def _undefine_macro : Separate<"--undefine-macro">, Alias<U>, Flags<[RenderJoined]>; +def _undefine_macro : Separate<"--undefine-macro">, Alias<U>; def _unsigned_char : Flag<"--unsigned-char">, Alias<funsigned_char>; def _user_dependencies : Flag<"--user-dependencies">, Alias<MM>; def _verbose : Flag<"--verbose">, Alias<v>; def _version : Flag<"--version">; -def _warn__EQ : Joined<"--warn-=">, Alias<W_Joined>, Flags<[Unsupported]>; -def _warn_ : Joined<"--warn-">, Alias<W_Joined>, Flags<[Unsupported]>; +def _warn__EQ : Joined<"--warn-=">, Alias<W_Joined>; +def _warn_ : Joined<"--warn-">, Alias<W_Joined>; def _write_dependencies : Flag<"--write-dependencies">, Alias<MD>; def _write_user_dependencies : Flag<"--write-user-dependencies">, Alias<MMD>; -def _ : Joined<"--">, Alias<f>, Flags<[Unsupported]>; +def _ : Joined<"--">, Flags<[Unsupported]>; + +// Special internal option to handle -Xlinker --no-demangle. +def Z_Xlinker__no_demangle : Flag<"-Z-Xlinker-no-demangle">, Flags<[Unsupported]>; diff --git a/include/clang/Driver/ToolChain.h b/include/clang/Driver/ToolChain.h index 1a8ae7749143..2cec22a09d8b 100644 --- a/include/clang/Driver/ToolChain.h +++ b/include/clang/Driver/ToolChain.h @@ -70,11 +70,14 @@ public: // Tool access. /// TranslateArgs - Create a new derived argument list for any argument - /// translations this ToolChain may wish to perform. + /// translations this ToolChain may wish to perform, or 0 if no tool chain + /// specific translations are needed. /// /// \param BoundArch - The bound architecture name, or 0. - virtual DerivedArgList *TranslateArgs(InputArgList &Args, - const char *BoundArch) const = 0; + virtual DerivedArgList *TranslateArgs(const DerivedArgList &Args, + const char *BoundArch) const { + return 0; + } /// SelectTool - Choose a tool to use to handle the action \arg JA. virtual Tool &SelectTool(const Compilation &C, const JobAction &JA) const = 0; diff --git a/include/clang/Driver/Types.def b/include/clang/Driver/Types.def index 61a5043b34fc..d3a3d29fbc0f 100644 --- a/include/clang/Driver/Types.def +++ b/include/clang/Driver/Types.def @@ -67,15 +67,21 @@ TYPE("f95", PP_Fortran, INVALID, 0, "u") TYPE("f95-cpp-input", Fortran, PP_Fortran, 0, "u") TYPE("java", Java, INVALID, 0, "u") +// 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", "") +TYPE("ir", LLVM_BC, INVALID, "bc", "") +TYPE("lto-ir", LTO_IR, INVALID, "s", "") +TYPE("lto-bc", LTO_BC, INVALID, "o", "") + // Misc. TYPE("ast", AST, INVALID, "ast", "u") -TYPE("llvm-asm", LLVMAsm, INVALID, "s", "") -TYPE("llvm-bc", LLVMBC, INVALID, "o", "") TYPE("plist", Plist, INVALID, "plist", "") TYPE("rewritten-objc", RewrittenObjC,INVALID, "cpp", "") TYPE("precompiled-header", PCH, INVALID, "gch", "A") TYPE("object", Object, INVALID, "o", "") TYPE("treelang", Treelang, INVALID, 0, "u") TYPE("image", Image, INVALID, "out", "") +TYPE("dSYM", dSYM, INVALID, "dSYM", "A") TYPE("dependencies", Dependencies, INVALID, "d", "") TYPE("none", Nothing, INVALID, 0, "u") diff --git a/include/clang/Driver/Types.h b/include/clang/Driver/Types.h index d93323016fe3..9187529833ac 100644 --- a/include/clang/Driver/Types.h +++ b/include/clang/Driver/Types.h @@ -59,6 +59,10 @@ namespace types { /// isAcceptedByClang - Can clang handle this input type. bool isAcceptedByClang(ID Id); + /// isOnlyAcceptedByClang - Is clang the only compiler that can handle this + /// input type. + bool isOnlyAcceptedByClang(ID Id); + /// isCXX - Is this a "C++" input (C++ and Obj-C++ sources and headers). bool isCXX(ID Id); |