Lines Matching refs:cl
49 class StackOption : public cl::opt<T> {
50 typedef cl::opt<T> Base;
77 class StackSubCommand : public cl::SubCommand {
89 cl::OptionCategory TestCategory("Test Options", "Description");
91 StackOption<int> TestOption("test-option", cl::desc("old description")); in TEST()
97 StringMap<cl::Option *> &Map = in TEST()
98 cl::getRegisteredOptions(*cl::TopLevelSubCommand); in TEST()
103 cl::Option *Retrieved = Map["test-option"]; in TEST()
106 ASSERT_EQ(&cl::GeneralCategory,Retrieved->Category) << in TEST()
125 Retrieved->setHiddenFlag(cl::Hidden); in TEST()
126 ASSERT_EQ(cl::Hidden, TestOption.getOptionHiddenFlag()) << in TEST()
133 cl::opt<std::string> EnvironmentTestOption("env-test-opt");
137 cl::ParseEnvironmentOptions("CommandLineTest", test_env_var); in TEST()
154 cl::ParseEnvironmentOptions("CommandLineTest", test_env_var); in TEST()
161 StackOption<int> TestOption2("test-option", cl::cat(TestCategory)); in TEST()
191 testCommandLineTokenizer(cl::TokenizeGNUCommandLine, Input, Output, in TEST()
200 testCommandLineTokenizer(cl::TokenizeWindowsCommandLine, Input, Output, in TEST()
216 StackOption<std::string> Input(cl::Positional); in TEST()
218 cl::alias Alias("alias", llvm::cl::aliasopt(Actual)); in TEST()
220 cl::ParseCommandLineOptions(ARGC, Inputs[i]); in TEST()
229 StackOption<std::string> Option("option", cl::Required); in testAliasRequired()
230 cl::alias Alias("o", llvm::cl::aliasopt(Option)); in testAliasRequired()
232 cl::ParseCommandLineOptions(argc, argv); in testAliasRequired()
248 StackOption<int> TestOption2("hide-option-2", cl::cat(TestCategory)); in TEST()
250 cl::HideUnrelatedOptions(TestCategory); in TEST()
252 ASSERT_EQ(cl::ReallyHidden, TestOption1.getOptionHiddenFlag()) in TEST()
254 ASSERT_EQ(cl::NotHidden, TestOption2.getOptionHiddenFlag()) in TEST()
257 StringMap<cl::Option *> &Map = in TEST()
258 cl::getRegisteredOptions(*cl::TopLevelSubCommand); in TEST()
259 ASSERT_EQ(cl::NotHidden, Map["help"]->getOptionHiddenFlag()) in TEST()
263 cl::OptionCategory TestCategory2("Test Options set 2", "Description");
267 StackOption<int> TestOption2("multi-hide-option-2", cl::cat(TestCategory)); in TEST()
268 StackOption<int> TestOption3("multi-hide-option-3", cl::cat(TestCategory2)); in TEST()
270 const cl::OptionCategory *VisibleCategories[] = {&TestCategory, in TEST()
273 cl::HideUnrelatedOptions(makeArrayRef(VisibleCategories)); in TEST()
275 ASSERT_EQ(cl::ReallyHidden, TestOption1.getOptionHiddenFlag()) in TEST()
277 ASSERT_EQ(cl::NotHidden, TestOption2.getOptionHiddenFlag()) in TEST()
279 ASSERT_EQ(cl::NotHidden, TestOption3.getOptionHiddenFlag()) in TEST()
282 StringMap<cl::Option *> &Map = in TEST()
283 cl::getRegisteredOptions(*cl::TopLevelSubCommand); in TEST()
284 ASSERT_EQ(cl::NotHidden, Map["help"]->getOptionHiddenFlag()) in TEST()
289 cl::ResetCommandLineParser(); in TEST()
294 StackOption<bool> TopLevelOpt("top-level", cl::init(false)); in TEST()
295 StackOption<bool> SC1Opt("sc1", cl::sub(SC1), cl::init(false)); in TEST()
296 StackOption<bool> SC2Opt("sc2", cl::sub(SC2), cl::init(false)); in TEST()
302 EXPECT_TRUE(cl::ParseCommandLineOptions(2, args, nullptr, true)); in TEST()
309 cl::ResetAllOptionOccurrences(); in TEST()
314 EXPECT_TRUE(cl::ParseCommandLineOptions(3, args2, nullptr, true)); in TEST()
321 cl::ResetAllOptionOccurrences(); in TEST()
326 EXPECT_TRUE(cl::ParseCommandLineOptions(3, args3, nullptr, true)); in TEST()
333 cl::ResetCommandLineParser(); in TEST()
338 StackOption<bool> SC1Opt("sc1", cl::sub(SC1), cl::init(false)); in TEST()
339 StackOption<bool> SC2Opt("sc2", cl::sub(SC2), cl::init(false)); in TEST()
342 EXPECT_FALSE(cl::ParseCommandLineOptions(3, args, nullptr, true)); in TEST()
346 cl::ResetCommandLineParser(); in TEST()
349 StackOption<bool> AllOpt("everywhere", cl::sub(*cl::AllSubCommands), in TEST()
350 cl::init(false)); in TEST()
358 EXPECT_TRUE(cl::ParseCommandLineOptions(2, args, nullptr, true)); in TEST()
363 cl::ResetAllOptionOccurrences(); in TEST()
365 EXPECT_TRUE(cl::ParseCommandLineOptions(3, args2, nullptr, true)); in TEST()
370 cl::ResetAllOptionOccurrences(); in TEST()
372 EXPECT_TRUE(cl::ParseCommandLineOptions(3, args3, nullptr, true)); in TEST()
377 cl::ResetCommandLineParser(); in TEST()
379 StackOption<bool> TopLevelOpt("top-level", cl::sub(*cl::TopLevelSubCommand), in TEST()
380 cl::init(false)); in TEST()
385 EXPECT_TRUE(cl::ParseCommandLineOptions(2, args, nullptr, true)); in TEST()
390 cl::ResetAllOptionOccurrences(); in TEST()
392 EXPECT_TRUE(cl::ParseCommandLineOptions(2, args, nullptr, true)); in TEST()
397 cl::ResetCommandLineParser(); in TEST()
400 StackOption<bool> RemoveOption("remove-option", cl::sub(SC), cl::init(false)); in TEST()
401 StackOption<bool> KeepOption("keep-option", cl::sub(SC), cl::init(false)); in TEST()
406 EXPECT_TRUE(cl::ParseCommandLineOptions(3, args, nullptr, true)); in TEST()
411 cl::ResetAllOptionOccurrences(); in TEST()
412 EXPECT_FALSE(cl::ParseCommandLineOptions(3, args, nullptr, true)); in TEST()
416 cl::ResetCommandLineParser(); in TEST()
419 "top-level-remove", cl::sub(*cl::TopLevelSubCommand), cl::init(false)); in TEST()
421 "top-level-keep", cl::sub(*cl::TopLevelSubCommand), cl::init(false)); in TEST()
426 EXPECT_TRUE(cl::ParseCommandLineOptions(2, args, nullptr, true)); in TEST()
431 cl::ResetAllOptionOccurrences(); in TEST()
432 EXPECT_FALSE(cl::ParseCommandLineOptions(2, args, nullptr, true)); in TEST()
436 cl::ResetCommandLineParser(); in TEST()
440 StackOption<bool> RemoveOption("remove-option", cl::sub(*cl::AllSubCommands), in TEST()
441 cl::init(false)); in TEST()
442 StackOption<bool> KeepOption("keep-option", cl::sub(*cl::AllSubCommands), in TEST()
443 cl::init(false)); in TEST()
451 EXPECT_TRUE(cl::ParseCommandLineOptions(2, args0, nullptr, true)); in TEST()
456 cl::ResetAllOptionOccurrences(); in TEST()
458 EXPECT_TRUE(cl::ParseCommandLineOptions(3, args1, nullptr, true)); in TEST()
463 cl::ResetAllOptionOccurrences(); in TEST()
465 EXPECT_TRUE(cl::ParseCommandLineOptions(3, args2, nullptr, true)); in TEST()
471 cl::ResetAllOptionOccurrences(); in TEST()
472 EXPECT_FALSE(cl::ParseCommandLineOptions(2, args0, nullptr, true)); in TEST()
473 cl::ResetAllOptionOccurrences(); in TEST()
474 EXPECT_FALSE(cl::ParseCommandLineOptions(3, args1, nullptr, true)); in TEST()
475 cl::ResetAllOptionOccurrences(); in TEST()
476 EXPECT_FALSE(cl::ParseCommandLineOptions(3, args2, nullptr, true)); in TEST()