mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-28 06:24:57 +00:00
Option parsing: properly handle flag aliases for joined options (PR23394)
A joined option always needs to have an argument, even if it's an empty one. Clang would previously assert when trying to use --extra-warnings, which is a flag alias for -W, which is a joined option. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236434 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -209,3 +209,17 @@ TEST(Option, Slurp) {
|
||||
EXPECT_EQ(AL->getAllArgValues(OPT_Slurp)[1], "--");
|
||||
EXPECT_EQ(AL->getAllArgValues(OPT_Slurp)[2], "foo");
|
||||
}
|
||||
|
||||
TEST(Option, FlagAliasToJoined) {
|
||||
TestOptTable T;
|
||||
unsigned MAI, MAC;
|
||||
|
||||
// Check that a flag alias provides an empty argument to a joined option.
|
||||
const char *MyArgs[] = { "-K" };
|
||||
std::unique_ptr<InputArgList> AL(
|
||||
T.ParseArgs(std::begin(MyArgs), std::end(MyArgs), MAI, MAC));
|
||||
EXPECT_EQ(AL->size(), 1U);
|
||||
EXPECT_TRUE(AL->hasArg(OPT_B));
|
||||
EXPECT_EQ(AL->getAllArgValues(OPT_B).size(), 1U);
|
||||
EXPECT_EQ(AL->getAllArgValues(OPT_B)[0], "");
|
||||
}
|
||||
|
Reference in New Issue
Block a user