Options: explicit handling of --
authorHans Wennborg <hans@hanshq.net>
Tue, 13 Aug 2013 22:23:05 +0000 (22:23 +0000)
committerHans Wennborg <hans@hanshq.net>
Tue, 13 Aug 2013 22:23:05 +0000 (22:23 +0000)
Clients of the option parsing library should handle it explicitly
using a KIND_REMAINING_ARGS option.

Clang and lld have been updated in r188316 and r188318, respectively.

Also fix -Wsign-compare warning in the option parsing test.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@188323 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Option/OptTable.cpp
unittests/Option/OptionParsingTest.cpp

index 650aec8a678644e06cad353f1dab4bdec3064ce4..8f21a4ff24cf1ba17a3d05d75e404ac20f208657 100644 (file)
@@ -259,22 +259,6 @@ InputArgList *OptTable::ParseArgs(const char *const *ArgBegin,
       continue;
     }
 
-    // FIXME: Remove once clients are updated to use a KIND_REMAINING_ARGS
-    // option to handle this explicitly instead.
-    if (Str == "--") {
-      // Everything after -- is a filename.
-      ++Index;
-
-      assert(TheInputOptionID != 0 && "Invalid input option ID.");
-      while (Index < End) {
-        Args->append(new Arg(getOption(TheInputOptionID),
-                             Args->getArgString(Index), Index,
-                             Args->getArgString(Index)));
-        ++Index;
-      }
-      break;
-    }
-
     unsigned Prev = Index;
     Arg *A = ParseOneArg(*Args, Index, FlagsToInclude, FlagsToExclude);
     assert(Index > Prev && "Parser failed to consume argument.");
index 4a7b7b1106dde9c4d747ec9f72961f574c4404fb..86286d11bd25ccc5dfe128fbfec6e34d10a5bd0c 100644 (file)
@@ -157,19 +157,6 @@ TEST(Option, AliasArgs) {
   EXPECT_EQ(AL->getAllArgValues(OPT_B)[1], "bar");
 }
 
-TEST(Option, DashDash) {
-  TestOptTable T;
-  unsigned MAI, MAC;
-
-  const char *MyArgs[] = { "-A", "--", "-B", "--" };
-  OwningPtr<InputArgList> AL(T.ParseArgs(MyArgs, array_endof(MyArgs), MAI, MAC));
-  EXPECT_TRUE(AL->hasArg(OPT_A));
-  EXPECT_FALSE(AL->hasArg(OPT_B));
-  EXPECT_EQ(AL->getAllArgValues(OPT_INPUT).size(), 2U);
-  EXPECT_EQ(AL->getAllArgValues(OPT_INPUT)[0], "-B");
-  EXPECT_EQ(AL->getAllArgValues(OPT_INPUT)[1], "--");
-}
-
 TEST(Option, SlurpEmpty) {
   TestOptTable T;
   unsigned MAI, MAC;
@@ -178,7 +165,7 @@ TEST(Option, SlurpEmpty) {
   OwningPtr<InputArgList> AL(T.ParseArgs(MyArgs, array_endof(MyArgs), MAI, MAC));
   EXPECT_TRUE(AL->hasArg(OPT_A));
   EXPECT_TRUE(AL->hasArg(OPT_Slurp));
-  EXPECT_EQ(AL->getAllArgValues(OPT_Slurp).size(), 0);
+  EXPECT_EQ(AL->getAllArgValues(OPT_Slurp).size(), 0U);
 }
 
 TEST(Option, Slurp) {