summaryrefslogtreecommitdiffstats
path: root/unittests/Option
diff options
context:
space:
mode:
authorHans Wennborg <hans@hanshq.net>2013-07-22 16:18:13 +0000
committerHans Wennborg <hans@hanshq.net>2013-07-22 16:18:13 +0000
commit6c7e78746e059916892f1df279b681d962a70954 (patch)
treea75b151dd9ef8e34a4b176d442e7f9b378a38294 /unittests/Option
parent02265382929b0275d7b7b334eab5e2fd34e1b9fe (diff)
downloadexternal_llvm-6c7e78746e059916892f1df279b681d962a70954.zip
external_llvm-6c7e78746e059916892f1df279b681d962a70954.tar.gz
external_llvm-6c7e78746e059916892f1df279b681d962a70954.tar.bz2
Option parsing: allow aliases in groups
Option aliases in option groups were previously disallowed by an assert. As far as I can tell, there was no technical reason for this, and I would like to be able to put cl.exe compatible options in their own group for Clang, so let's change the assert. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186838 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests/Option')
-rw-r--r--unittests/Option/OptionParsingTest.cpp9
-rw-r--r--unittests/Option/Opts.td3
2 files changed, 12 insertions, 0 deletions
diff --git a/unittests/Option/OptionParsingTest.cpp b/unittests/Option/OptionParsingTest.cpp
index 8bfa99b..2c4fdcf 100644
--- a/unittests/Option/OptionParsingTest.cpp
+++ b/unittests/Option/OptionParsingTest.cpp
@@ -136,3 +136,12 @@ TEST(Option, ParseWithFlagExclusions) {
EXPECT_EQ(AL->getLastArgValue(OPT_SLASH_C), "foo");
EXPECT_EQ(AL->getLastArgValue(OPT_C), "bar");
}
+
+TEST(Option, ParseAliasInGroup) {
+ TestOptTable T;
+ unsigned MAI, MAC;
+
+ const char *MyArgs[] = { "-I" };
+ OwningPtr<InputArgList> AL(T.ParseArgs(MyArgs, array_endof(MyArgs), MAI, MAC));
+ EXPECT_TRUE(AL->hasArg(OPT_H));
+}
diff --git a/unittests/Option/Opts.td b/unittests/Option/Opts.td
index ccb377f..8e33ba8 100644
--- a/unittests/Option/Opts.td
+++ b/unittests/Option/Opts.td
@@ -16,3 +16,6 @@ def G : JoinedAndSeparate<["-"], "G">, HelpText<"The G option">, MetaVarName<"G"
def Ceq : Joined<["-", "--"], "C=">, Alias<C>, Flags<[OptFlag1]>;
def H : Flag<["-"], "H">, Flags<[HelpHidden]>;
+
+def my_group : OptionGroup<"my group">;
+def I : Flag<["-"], "I">, Alias<H>, Group<my_group>;