Revert r227148 & r227154 which added a test which infinitely loops.
authorRichard Trieu <rtrieu@google.com>
Tue, 27 Jan 2015 03:03:47 +0000 (03:03 +0000)
committerRichard Trieu <rtrieu@google.com>
Tue, 27 Jan 2015 03:03:47 +0000 (03:03 +0000)
r227148 added test CommandLineTest.HideUnrelatedOptionsMulti which repeatedly
outputs two following lines:

-tool: CommandLine Error: Option 'test-option-1' registered more than once!
-tool: CommandLine Error: Option 'test-option-2' registered more than once!

r227154 depends on changes from r227148

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

include/llvm/Support/CommandLine.h
lib/Support/CommandLine.cpp
unittests/Support/CommandLineTest.cpp

index efa17219585b5a5b3b473360c52fe86347d578c5..e53ac06a3cde85dd606a76f4e8aebaed7ee88f66 100644 (file)
@@ -20,7 +20,6 @@
 #ifndef LLVM_SUPPORT_COMMANDLINE_H
 #define LLVM_SUPPORT_COMMANDLINE_H
 
-#include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringMap.h"
 #include "llvm/ADT/Twine.h"
@@ -1939,7 +1938,7 @@ void HideUnrelatedOptions(cl::OptionCategory &Category);
 /// Some tools (like clang-format) like to be able to hide all options that are
 /// not specific to the tool. This function allows a tool to specify a single
 /// option category to display in the -help output.
-void HideUnrelatedOptions(ArrayRef<const cl::OptionCategory *> Categories);
+void HideUnrelatedOptions(SmallVectorImpl<cl::OptionCategory *> &Categories);
 
 } // End namespace cl
 
index 35c49be02ced7f95a8cc9552d1b70359a8b8c775..4cd6f0c5f0a398fd398bca744b06f61201044174 100644 (file)
@@ -1861,7 +1861,8 @@ void cl::HideUnrelatedOptions(cl::OptionCategory &Category) {
   }
 }
 
-void cl::HideUnrelatedOptions(ArrayRef<const cl::OptionCategory *> Categories) {
+void cl::HideUnrelatedOptions(
+    SmallVectorImpl<cl::OptionCategory *> &Categories) {
   auto CategoriesBegin = Categories.begin();
   auto CategoriesEnd = Categories.end();
   StringMap<cl::Option *> Options;
index 8e84bd93072352fdd10a17703501224363b0e1a9..4fa14e252fbbf9d9cbd40d538798e781b8c36e32 100644 (file)
@@ -247,29 +247,4 @@ TEST(CommandLineTest, HideUnrelatedOptions) {
       << "Hid default option that should be visable.";
 }
 
-cl::OptionCategory TestCategory2("Test Options set 2", "Description");
-
-TEST(CommandLineTest, HideUnrelatedOptionsMulti) {
-  cl::opt<int> TestOption1("test-option-1");
-  cl::opt<int> TestOption2("test-option-2", cl::cat(TestCategory));
-  cl::opt<int> TestOption3("test-option-3", cl::cat(TestCategory2));
-
-  const cl::OptionCategory *VisibleCategories[] = {&TestCategory,
-                                                   &TestCategory2};
-
-  cl::HideUnrelatedOptions(makeArrayRef(VisibleCategories));
-
-  ASSERT_EQ(cl::ReallyHidden, TestOption1.getOptionHiddenFlag())
-      << "Failed to hide extra option.";
-  ASSERT_EQ(cl::NotHidden, TestOption2.getOptionHiddenFlag())
-      << "Hid extra option that should be visable.";
-  ASSERT_EQ(cl::NotHidden, TestOption3.getOptionHiddenFlag())
-      << "Hid extra option that should be visable.";
-
-  StringMap<cl::Option *> Map;
-  cl::getRegisteredOptions(Map);
-  ASSERT_EQ(cl::NotHidden, Map["help"]->getOptionHiddenFlag())
-      << "Hid default option that should be visable.";
-}
-
 }  // anonymous namespace