@@ -2457,11 +2457,9 @@ class HelpPrinter {
24572457 sortSubCommands (GlobalParser->RegisteredSubCommands , Subs);
24582458
24592459#ifdef SYCLomatic_CUSTOMIZATION
2460- if (isDPCT) {
2461- if (CtHelpCat == CtHelpCategory::HC_Examples) {
2462- outs () << DPCTExamplesMsg;
2463- return ;
2464- }
2460+ if (isDPCT && CtHelpCat == CtHelpCategory::HC_Examples) {
2461+ outs () << DPCTExamplesMsg;
2462+ return ;
24652463 }
24662464#endif // SYCLomatic_CUSTOMIZATION
24672465
@@ -2515,10 +2513,10 @@ class HelpPrinter {
25152513 MaxArgLen = std::max (MaxArgLen, Opts[i].second ->getOptionWidth ());
25162514
25172515#ifdef SYCLomatic_CUSTOMIZATION
2518- OptionCategory &reqCtHelpCat (getReqCtHelpCategory (CtHelpCat));
2516+ OptionCategory &ReqCtHelpCat (getReqCtHelpCategory (CtHelpCat));
25192517
25202518 if (isDPCT && CtHelpCat != CtHelpCategory::HC_All)
2521- outs () << " OPTIONS: " << reqCtHelpCat .getName () << " \n " ;
2519+ outs () << " OPTIONS: " << ReqCtHelpCat .getName () << " \n " ;
25222520 else
25232521 outs () << " OPTIONS:\n " ;
25242522#else
@@ -2582,8 +2580,10 @@ class CategorizedHelpPrinter : public HelpPrinter {
25822580
25832581 // Make sure we inherit our base class's operator=()
25842582 using HelpPrinter::operator =;
2583+ #ifdef SYCLomatic_CUSTOMIZATION
25852584 using HelpPrinter::getReqCtHelpCategory;
25862585 using HelpPrinter::setReqCtHelpCategory;
2586+ #endif // SYCLomatic_CUSTOMIZATION
25872587
25882588protected:
25892589 void printOptions (StrOptionPairVector &Opts, size_t MaxArgLen) override {
@@ -2600,6 +2600,10 @@ class CategorizedHelpPrinter : public HelpPrinter {
26002600 array_pod_sort (SortedCategories.begin (), SortedCategories.end (),
26012601 OptionCategoryCompare);
26022602
2603+ #ifdef SYCLomatic_CUSTOMIZATION
2604+ OptionCategory &ReqCtHelpCat (getReqCtHelpCategory (CtHelpCat));
2605+ #endif // SYCLomatic_CUSTOMIZATION
2606+
26032607 // Walk through pre-sorted options and assign into categories.
26042608 // Because the options are already alphabetically sorted the
26052609 // options within categories will also be alphabetically sorted.
@@ -2608,16 +2612,12 @@ class CategorizedHelpPrinter : public HelpPrinter {
26082612 for (auto &Cat : Opt->Categories ) {
26092613 assert (llvm::is_contained (SortedCategories, Cat) &&
26102614 " Option has an unregistered category" );
2611- CategorizedOptions[Cat].push_back (Opt);
2612- }
2613- }
2614-
26152615#ifdef SYCLomatic_CUSTOMIZATION
2616- if (CtHelpCat != CtHelpCategory::HC_All)
2617- SortedCategories.erase (
2618- std::find (SortedCategories.begin (), SortedCategories.end (),
2619- &getReqCtHelpCategory (CtHelpCategory::HC_All)));
2616+ if (!isDPCT || Cat == &ReqCtHelpCat)
26202617#endif // SYCLomatic_CUSTOMIZATION
2618+ CategorizedOptions[Cat].push_back (Opt);
2619+ }
2620+ }
26212621
26222622 // Now do printing.
26232623 for (OptionCategory *Category : SortedCategories) {
@@ -2626,7 +2626,7 @@ class CategorizedHelpPrinter : public HelpPrinter {
26262626 if (CategoryOptions.empty ())
26272627 continue ;
26282628
2629- // Print category information.
2629+ // Print category information.
26302630#ifdef SYCLomatic_CUSTOMIZATION
26312631 // outs() << "\n";
26322632 // outs() << Category->getName() << ":\n";
@@ -2979,8 +2979,10 @@ void HelpPrinterWrapper::operator=(bool Value) {
29792979
29802980#ifdef SYCLomatic_CUSTOMIZATION
29812981void HelpPrinterWrapper::operator =(CtHelpCategory Value) {
2982- CategorizedPrinter.setReqCtHelpCategory (Value);
2983- cl::HideUnrelatedOptions (CategorizedPrinter.getReqCtHelpCategory (Value));
2982+ if (isDPCT) {
2983+ CategorizedPrinter.setReqCtHelpCategory (Value);
2984+ cl::HideUnrelatedOptions (CategorizedPrinter.getReqCtHelpCategory (Value));
2985+ }
29842986
29852987 *this = true ;
29862988}
0 commit comments