summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2016-09-13 04:11:57 +0000
committerZachary Turner <zturner@google.com>2016-09-13 04:11:57 +0000
commitd97d5a2cee684e6e03006bb87a58a9acefe36375 (patch)
tree270d19ff2e7e161a477b8bebaa0eb175c52394dd
parente1489bde3bd85d9c5337fa371fe8f4d5d6d09336 (diff)
downloadbcm5719-llvm-d97d5a2cee684e6e03006bb87a58a9acefe36375.tar.gz
bcm5719-llvm-d97d5a2cee684e6e03006bb87a58a9acefe36375.zip
Revert "[Support][CommandLine] Add cl::getRegisteredSubcommands()"
This reverts r281290, as it breaks unit tests. http://lab.llvm.org:8011/builders/clang-x86-windows-msvc2015/builds/303 llvm-svn: 281292
-rw-r--r--llvm/include/llvm/Support/CommandLine.h22
-rw-r--r--llvm/lib/Support/CommandLine.cpp11
-rw-r--r--llvm/unittests/Support/CommandLineTest.cpp23
3 files changed, 0 insertions, 56 deletions
diff --git a/llvm/include/llvm/Support/CommandLine.h b/llvm/include/llvm/Support/CommandLine.h
index 092dc945a37..a0ec2622b03 100644
--- a/llvm/include/llvm/Support/CommandLine.h
+++ b/llvm/include/llvm/Support/CommandLine.h
@@ -1736,28 +1736,6 @@ void PrintHelpMessage(bool Hidden = false, bool Categorized = false);
/// than just handing around a global list.
StringMap<Option *> &getRegisteredOptions(SubCommand &Sub = *TopLevelSubCommand);
-/// \brief Use this to get all registered SubCommands from the provided parser.
-///
-/// \return A range of all SubCommand pointers registered with the parser.
-///
-/// Typical usage:
-/// \code
-/// main(int argc, char* argv[]) {
-/// llvm::cl::ParseCommandLineOptions(argc, argv);
-/// for (auto* S : llvm::cl::getRegisteredSubcommands()) {
-/// if (*S) {
-/// std::cout << "Executing subcommand: " << S->getName() << std::endl;
-/// // Execute some function based on the name...
-/// }
-/// }
-/// }
-/// \endcode
-///
-/// This interface is useful for defining subcommands in libraries and
-/// the dispatch from a single point (like in the main function).
-iterator_range<typename SmallPtrSet<SubCommand *, 4>::iterator>
-getRegisteredSubcommands();
-
//===----------------------------------------------------------------------===//
// Standalone command line processing utilities.
//
diff --git a/llvm/lib/Support/CommandLine.cpp b/llvm/lib/Support/CommandLine.cpp
index dcf833aafe5..551cdefcbe4 100644
--- a/llvm/lib/Support/CommandLine.cpp
+++ b/llvm/lib/Support/CommandLine.cpp
@@ -309,12 +309,6 @@ public:
RegisteredSubCommands.erase(sub);
}
- iterator_range<typename SmallPtrSet<SubCommand *, 4>::iterator>
- getRegisteredSubcommands() {
- return make_range(RegisteredSubCommands.begin(),
- RegisteredSubCommands.end());
- }
-
void reset() {
ActiveSubCommand = nullptr;
ProgramName.clear();
@@ -2111,11 +2105,6 @@ StringMap<Option *> &cl::getRegisteredOptions(SubCommand &Sub) {
return Sub.OptionsMap;
}
-iterator_range<typename SmallPtrSet<SubCommand *, 4>::iterator>
-cl::getRegisteredSubcommands() {
- return GlobalParser->getRegisteredSubcommands();
-}
-
void cl::HideUnrelatedOptions(cl::OptionCategory &Category, SubCommand &Sub) {
for (auto &I : Sub.OptionsMap) {
if (I.second->Category != &Category &&
diff --git a/llvm/unittests/Support/CommandLineTest.cpp b/llvm/unittests/Support/CommandLineTest.cpp
index bc4fb5ab122..9b24c1e40bc 100644
--- a/llvm/unittests/Support/CommandLineTest.cpp
+++ b/llvm/unittests/Support/CommandLineTest.cpp
@@ -476,27 +476,4 @@ TEST(CommandLineTest, RemoveFromAllSubCommands) {
EXPECT_FALSE(cl::ParseCommandLineOptions(3, args2, nullptr, true));
}
-TEST(CommandLineTest, GetRegisteredSubcommands) {
- cl::ResetCommandLineParser();
-
- StackSubCommand SC1("sc1", "First Subcommand");
- StackSubCommand SC2("sc2", "Second subcommand");
-
- const char *args0[] = {"prog", "sc1"};
- const char *args1[] = {"prog", "sc2"};
-
- EXPECT_TRUE(cl::ParseCommandLineOptions(2, args0, nullptr, true));
- for (auto *S : cl::getRegisteredSubcommands()) {
- if (*S)
- EXPECT_STREQ("sc1", S->getName());
- }
-
- cl::ResetAllOptionOccurrences();
- EXPECT_TRUE(cl::ParseCommandLineOptions(2, args1, nullptr, true));
- for (auto *S : cl::getRegisteredSubcommands()) {
- if (*S)
- EXPECT_STREQ("sc2", S->getName());
- }
-}
-
} // anonymous namespace
OpenPOWER on IntegriCloud