[PATCH] D106334: Initialize common options in `getRegisteredOptions`
Senran Zhang via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 19 19:40:36 PDT 2021
zsrkmyn added a comment.
I'm not sure if we need a test for it. I tried to add one but the test passed even without this patch, as those options were already initialized before running the test.
diff --git a/llvm/unittests/Support/CommandLineTest.cpp b/llvm/unittests/Support/CommandLineTest.cpp
index a0352bc8a4c5..c18d34ab4323 100644
--- a/llvm/unittests/Support/CommandLineTest.cpp
+++ b/llvm/unittests/Support/CommandLineTest.cpp
@@ -89,6 +89,12 @@ public:
~StackSubCommand() { unregisterSubCommand(); }
};
+TEST(CommandLineTest, RetrievePresetOptions) {
+ StringMap<cl::Option *> &Map =
+ cl::getRegisteredOptions(*cl::TopLevelSubCommand);
+
+ ASSERT_TRUE(Map.count("help") == 1) << "Could not get preset option `help`";
+}
cl::OptionCategory TestCategory("Test Options", "Description");
TEST(CommandLineTest, ModifyExisitingOption) {
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D106334/new/
https://reviews.llvm.org/D106334
More information about the llvm-commits
mailing list