mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-05 12:31:33 +00:00
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
This commit is contained in:
parent
0226538292
commit
6c7e78746e
@ -22,12 +22,10 @@ using namespace llvm::opt;
|
|||||||
Option::Option(const OptTable::Info *info, const OptTable *owner)
|
Option::Option(const OptTable::Info *info, const OptTable *owner)
|
||||||
: Info(info), Owner(owner) {
|
: Info(info), Owner(owner) {
|
||||||
|
|
||||||
// Multi-level aliases are not supported, and alias options cannot
|
// Multi-level aliases are not supported. This just simplifies option
|
||||||
// have groups. This just simplifies option tracking, it is not an
|
// tracking, it is not an inherent limitation.
|
||||||
// inherent limitation.
|
assert(!Info || !getAlias().isValid() || !getAlias().getAlias().isValid() &&
|
||||||
assert((!Info || !getAlias().isValid() || (!getAlias().getAlias().isValid() &&
|
"Multi-level aliases are not supported.");
|
||||||
!getGroup().isValid())) &&
|
|
||||||
"Multi-level aliases and aliases with groups are unsupported.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Option::~Option() {
|
Option::~Option() {
|
||||||
|
@ -136,3 +136,12 @@ TEST(Option, ParseWithFlagExclusions) {
|
|||||||
EXPECT_EQ(AL->getLastArgValue(OPT_SLASH_C), "foo");
|
EXPECT_EQ(AL->getLastArgValue(OPT_SLASH_C), "foo");
|
||||||
EXPECT_EQ(AL->getLastArgValue(OPT_C), "bar");
|
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));
|
||||||
|
}
|
||||||
|
@ -16,3 +16,6 @@ def G : JoinedAndSeparate<["-"], "G">, HelpText<"The G option">, MetaVarName<"G"
|
|||||||
def Ceq : Joined<["-", "--"], "C=">, Alias<C>, Flags<[OptFlag1]>;
|
def Ceq : Joined<["-", "--"], "C=">, Alias<C>, Flags<[OptFlag1]>;
|
||||||
|
|
||||||
def H : Flag<["-"], "H">, Flags<[HelpHidden]>;
|
def H : Flag<["-"], "H">, Flags<[HelpHidden]>;
|
||||||
|
|
||||||
|
def my_group : OptionGroup<"my group">;
|
||||||
|
def I : Flag<["-"], "I">, Alias<H>, Group<my_group>;
|
||||||
|
Loading…
Reference in New Issue
Block a user