summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Trieu <rtrieu@google.com>2015-01-27 03:03:47 +0000
committerRichard Trieu <rtrieu@google.com>2015-01-27 03:03:47 +0000
commit15ac9363a7f139ae674c99a883fbeae9a239f3ce (patch)
tree9791462294b443e08f678f4c12f14222d8160cd9
parentca84e982c89bdc3da35da369bb1ca6ba9ce8858c (diff)
downloadbcm5719-llvm-15ac9363a7f139ae674c99a883fbeae9a239f3ce.tar.gz
bcm5719-llvm-15ac9363a7f139ae674c99a883fbeae9a239f3ce.zip
Revert r227148 & r227154 which added a test which infinitely loops.
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 llvm-svn: 227167
-rw-r--r--llvm/include/llvm/Support/CommandLine.h3
-rw-r--r--llvm/lib/Support/CommandLine.cpp3
-rw-r--r--llvm/unittests/Support/CommandLineTest.cpp25
3 files changed, 3 insertions, 28 deletions
diff --git a/llvm/include/llvm/Support/CommandLine.h b/llvm/include/llvm/Support/CommandLine.h
index efa17219585..e53ac06a3cd 100644
--- a/llvm/include/llvm/Support/CommandLine.h
+++ b/llvm/include/llvm/Support/CommandLine.h
@@ -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
diff --git a/llvm/lib/Support/CommandLine.cpp b/llvm/lib/Support/CommandLine.cpp
index 35c49be02ce..4cd6f0c5f0a 100644
--- a/llvm/lib/Support/CommandLine.cpp
+++ b/llvm/lib/Support/CommandLine.cpp
@@ -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;
diff --git a/llvm/unittests/Support/CommandLineTest.cpp b/llvm/unittests/Support/CommandLineTest.cpp
index 8e84bd93072..4fa14e252fb 100644
--- a/llvm/unittests/Support/CommandLineTest.cpp
+++ b/llvm/unittests/Support/CommandLineTest.cpp
@@ -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
OpenPOWER on IntegriCloud