diff options
author | Reid Kleckner <reid@kleckner.net> | 2013-07-19 18:04:57 +0000 |
---|---|---|
committer | Reid Kleckner <reid@kleckner.net> | 2013-07-19 18:04:57 +0000 |
commit | a2549d382789fa33b5541708b2e4cf39e8bf56c9 (patch) | |
tree | d2f24688ce4304a54925e4014780e28911fafcdc /include/llvm/Option | |
parent | ba460864440b4dd192bd2809f913babe0cf07031 (diff) | |
download | llvm-a2549d382789fa33b5541708b2e4cf39e8bf56c9.tar.gz llvm-a2549d382789fa33b5541708b2e4cf39e8bf56c9.tar.bz2 llvm-a2549d382789fa33b5541708b2e4cf39e8bf56c9.tar.xz |
[Option] Add inclusion and exclusion flags to option parsing
Summary:
This allows the clang driver to put MSVC compatible options in the same
enumerator space as its normal options but exclude them from normal
option parsing.
Also changes the standard ParseArgs() method to consider unknown
arguments with a leading slash as being inputs rather than flags.
High level discussion for clang-cl is here:
http://lists.cs.uiuc.edu/pipermail/cfe-dev/2013-June/030404.html
CC: llvm-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D1049
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186703 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Option')
-rw-r--r-- | include/llvm/Option/OptTable.h | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/include/llvm/Option/OptTable.h b/include/llvm/Option/OptTable.h index 11f489873a..8ee219d37b 100644 --- a/include/llvm/Option/OptTable.h +++ b/include/llvm/Option/OptTable.h @@ -116,11 +116,17 @@ public: /// \param [in,out] Index - The current parsing position in the argument /// string list; on return this will be the index of the next argument /// string to parse. + /// \param [in] FlagsToInclude - Only parse options with any of these flags. + /// Zero is the default which includes all flags. + /// \param [in] FlagsToExclude - Don't parse options with this flag. Zero + /// is the default and means exclude nothing. /// /// \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 ArgList &Args, unsigned &Index) const; + Arg *ParseOneArg(const ArgList &Args, unsigned &Index, + unsigned FlagsToInclude = 0, + unsigned FlagsToExclude = 0) const; /// \brief Parse an list of arguments into an InputArgList. /// @@ -136,12 +142,18 @@ public: /// \param MissingArgIndex - On error, the index of the option which could /// not be parsed. /// \param MissingArgCount - On error, the number of missing options. + /// \param FlagsToInclude - Only parse options with any of these flags. + /// Zero is the default which includes all flags. + /// \param FlagsToExclude - Don't parse options with this flag. Zero + /// is the default and means exclude nothing. /// \return An InputArgList; on error this will contain all the options /// which could be parsed. InputArgList *ParseArgs(const char* const *ArgBegin, const char* const *ArgEnd, unsigned &MissingArgIndex, - unsigned &MissingArgCount) const; + unsigned &MissingArgCount, + unsigned FlagsToInclude = 0, + unsigned FlagsToExclude = 0) const; /// \brief Render the help text for an option table. /// |