From af9e3557552c341615052a05d4eeb36d7fd5c33f Mon Sep 17 00:00:00 2001 From: Hans Wennborg Date: Tue, 13 Aug 2013 21:09:50 +0000 Subject: Options: Add new option kind that consumes remaining arguments This adds KIND_REMAINING_ARGS, a class of options that consume all remaining arguments on the command line. This will be used to support /link in clang-cl, which is used to forward all remaining arguments to the linker. It also allows us to remove the hard-coded handling of "--", allowing clients (clang and lld) to implement that functionality themselves with this new option class. Differential Revision: http://llvm-reviews.chandlerc.com/D1387 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@188314 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Option/OptParser.td | 2 ++ include/llvm/Option/Option.h | 2 ++ 2 files changed, 4 insertions(+) (limited to 'include/llvm/Option') diff --git a/include/llvm/Option/OptParser.td b/include/llvm/Option/OptParser.td index 32cc2c0..963389f 100644 --- a/include/llvm/Option/OptParser.td +++ b/include/llvm/Option/OptParser.td @@ -44,6 +44,8 @@ def KIND_JOINED_OR_SEPARATE : OptionKind<"JoinedOrSeparate">; // An option which is both joined to its (first) value, and followed by its // (second) value. def KIND_JOINED_AND_SEPARATE : OptionKind<"JoinedAndSeparate">; +// An option which consumes all remaining arguments if there are any. +def KIND_REMAINING_ARGS : OptionKind<"RemainingArgs">; // Define the option flags. diff --git a/include/llvm/Option/Option.h b/include/llvm/Option/Option.h index 47fd817..03d4774 100644 --- a/include/llvm/Option/Option.h +++ b/include/llvm/Option/Option.h @@ -50,6 +50,7 @@ public: FlagClass, JoinedClass, SeparateClass, + RemainingArgsClass, CommaJoinedClass, MultiArgClass, JoinedOrSeparateClass, @@ -149,6 +150,7 @@ public: case SeparateClass: case MultiArgClass: case JoinedOrSeparateClass: + case RemainingArgsClass: return RenderSeparateStyle; } llvm_unreachable("Unexpected kind!"); -- cgit v1.1 From 055f4e99ffb32462db6fc62f9a306f2865acacb0 Mon Sep 17 00:00:00 2001 From: Rui Ueyama Date: Tue, 27 Aug 2013 23:47:01 +0000 Subject: Option parsing: support case-insensitive option matching. Link.exe's command line options are case-insensitive. This patch adds a new attribute to OptTable to let the option parser to compare options, ignoring case. Command lines are generally case-insensitive on Windows. CL.exe is an exception. So this new attribute should be useful for other commands running on Windows. Differential Revision: http://llvm-reviews.chandlerc.com/D1485 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189416 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Option/OptTable.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'include/llvm/Option') diff --git a/include/llvm/Option/OptTable.h b/include/llvm/Option/OptTable.h index a5b59ce..5035940 100644 --- a/include/llvm/Option/OptTable.h +++ b/include/llvm/Option/OptTable.h @@ -51,6 +51,7 @@ private: /// \brief The static option information table. const Info *OptionInfos; unsigned NumOptionInfos; + bool IgnoreCase; unsigned TheInputOptionID; unsigned TheUnknownOptionID; @@ -72,7 +73,8 @@ private: } protected: - OptTable(const Info *_OptionInfos, unsigned _NumOptionInfos); + OptTable(const Info *_OptionInfos, unsigned _NumOptionInfos, + bool _IgnoreCase = false); public: ~OptTable(); -- cgit v1.1 From 1997734e37775a68182b3fd508a52e0c28ff36f8 Mon Sep 17 00:00:00 2001 From: Rui Ueyama Date: Wed, 28 Aug 2013 00:02:06 +0000 Subject: Revert "Option parsing: support case-insensitive option matching." as it broke Windows buildbot. This reverts r189416. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189424 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Option/OptTable.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'include/llvm/Option') diff --git a/include/llvm/Option/OptTable.h b/include/llvm/Option/OptTable.h index 5035940..a5b59ce 100644 --- a/include/llvm/Option/OptTable.h +++ b/include/llvm/Option/OptTable.h @@ -51,7 +51,6 @@ private: /// \brief The static option information table. const Info *OptionInfos; unsigned NumOptionInfos; - bool IgnoreCase; unsigned TheInputOptionID; unsigned TheUnknownOptionID; @@ -73,8 +72,7 @@ private: } protected: - OptTable(const Info *_OptionInfos, unsigned _NumOptionInfos, - bool _IgnoreCase = false); + OptTable(const Info *_OptionInfos, unsigned _NumOptionInfos); public: ~OptTable(); -- cgit v1.1 From 2957273b888dabe8be8e2fa5ac691e39879685c4 Mon Sep 17 00:00:00 2001 From: Rui Ueyama Date: Wed, 28 Aug 2013 20:04:31 +0000 Subject: Option parsing: support case-insensitive option matching. Re-submitting r189416 with fix for Windows build on where strcasecmp is not defined. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189501 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Option/OptTable.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'include/llvm/Option') diff --git a/include/llvm/Option/OptTable.h b/include/llvm/Option/OptTable.h index a5b59ce..5035940 100644 --- a/include/llvm/Option/OptTable.h +++ b/include/llvm/Option/OptTable.h @@ -51,6 +51,7 @@ private: /// \brief The static option information table. const Info *OptionInfos; unsigned NumOptionInfos; + bool IgnoreCase; unsigned TheInputOptionID; unsigned TheUnknownOptionID; @@ -72,7 +73,8 @@ private: } protected: - OptTable(const Info *_OptionInfos, unsigned _NumOptionInfos); + OptTable(const Info *_OptionInfos, unsigned _NumOptionInfos, + bool _IgnoreCase = false); public: ~OptTable(); -- cgit v1.1