diff options
author | Chris Bieneman <beanz@apple.com> | 2015-01-21 22:45:52 +0000 |
---|---|---|
committer | Chris Bieneman <beanz@apple.com> | 2015-01-21 22:45:52 +0000 |
commit | 9e13af7ac377f682d55b3bb3edd3471d247cbd36 (patch) | |
tree | 04068061e56256d8ff5321bc39b92059c107b916 /llvm/unittests/Support/CommandLineTest.cpp | |
parent | b16b09b154f2a8468dcfaa9a8eb5297d59cbd7cd (diff) | |
download | llvm-9e13af7ac377f682d55b3bb3edd3471d247cbd36.zip llvm-9e13af7ac377f682d55b3bb3edd3471d247cbd36.tar.gz llvm-9e13af7ac377f682d55b3bb3edd3471d247cbd36.tar.bz2 |
Adding a new cl::HideUnrelatedOptions API to allow clang to migrate off cl::getRegisteredOptions.
Summary: cl::getRegisteredOptions really exposes some of the innards of how command line parsing is implemented. Exposing new APIs that allow us to disentangle client code from implementation details will allow us to make more extensive changes to command line parsing.
Reviewers: chandlerc, dexonsmith, beanz
Reviewed By: dexonsmith
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D7100
llvm-svn: 226729
Diffstat (limited to 'llvm/unittests/Support/CommandLineTest.cpp')
-rw-r--r-- | llvm/unittests/Support/CommandLineTest.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/llvm/unittests/Support/CommandLineTest.cpp b/llvm/unittests/Support/CommandLineTest.cpp index ac8d3d8..0defe6f 100644 --- a/llvm/unittests/Support/CommandLineTest.cpp +++ b/llvm/unittests/Support/CommandLineTest.cpp @@ -230,5 +230,16 @@ TEST(CommandLineTest, AliasRequired) { testAliasRequired(array_lengthof(opts2), opts2); } +TEST(CommandLineTest, HideUnrelatedOptions) { + cl::opt<int> TestOption1("test-option-1"); + cl::opt<int> TestOption2("test-option-2", cl::cat(TestCategory)); + + cl::HideUnrelatedOptions(TestCategory); + + ASSERT_EQ(cl::ReallyHidden, TestOption1.getOptionHiddenFlag()) + << "Failed to hide extra option."; + ASSERT_EQ(cl::NotHidden, TestOption2.getOptionHiddenFlag()) + << "Hid extra option that should be visable."; +} } // anonymous namespace |