@@ -663,16 +663,17 @@ class FunctionsCategorizer {
663
663
StringRef IfPresentStr,
664
664
StringRef IfAbsentStr = " " ) {
665
665
Rules.emplace_back (Rule::RKind::K_FlagAttribute,
666
- std::tuple {AttrName, IfPresentStr, IfAbsentStr});
666
+ Rule::FlagRuleData {AttrName, IfPresentStr, IfAbsentStr});
667
667
}
668
668
669
669
// Creates a simple rule, which adds one or another value to a resulting
670
670
// identifier based on a presence of a metadata on a function.
671
671
void registerSimpleFlagMetadataRule (StringRef MetadataName,
672
672
StringRef IfPresentStr,
673
673
StringRef IfAbsentStr = " " ) {
674
- Rules.emplace_back (Rule::RKind::K_FlagMetadata,
675
- std::tuple{MetadataName, IfPresentStr, IfAbsentStr});
674
+ Rules.emplace_back (
675
+ Rule::RKind::K_FlagMetadata,
676
+ Rule::FlagRuleData{MetadataName, IfPresentStr, IfAbsentStr});
676
677
}
677
678
678
679
// Creates a rule, which adds a list of dash-separated integers converted
@@ -689,10 +690,12 @@ class FunctionsCategorizer {
689
690
690
691
private:
691
692
struct Rule {
692
- using TupleOfThreeStringRef = std::tuple<StringRef, StringRef, StringRef>;
693
+ struct FlagRuleData {
694
+ StringRef Name, IfPresentStr, IfAbsentStr;
695
+ };
693
696
694
697
private:
695
- std::variant<StringRef, TupleOfThreeStringRef ,
698
+ std::variant<StringRef, FlagRuleData ,
696
699
std::function<std::string(Function *)>>
697
700
Storage;
698
701
@@ -763,12 +766,11 @@ std::string FunctionsCategorizer::computeCategoryFor(Function *F) const {
763
766
} break ;
764
767
765
768
case Rule::RKind::K_FlagMetadata: {
766
- Rule::TupleOfThreeStringRef Data =
767
- R.getStorage <Rule::RKind::K_FlagMetadata>();
768
- if (F->hasMetadata (std::get<0 >(Data)))
769
- Result += std::get<1 >(Data);
769
+ Rule::FlagRuleData Data = R.getStorage <Rule::RKind::K_FlagMetadata>();
770
+ if (F->hasMetadata (Data.Name ))
771
+ Result += Data.IfPresentStr ;
770
772
else
771
- Result += std::get< 2 >( Data) ;
773
+ Result += Data. IfAbsentStr ;
772
774
} break ;
773
775
774
776
case Rule::RKind::K_IntegersListMetadata: {
@@ -801,12 +803,11 @@ std::string FunctionsCategorizer::computeCategoryFor(Function *F) const {
801
803
} break ;
802
804
803
805
case Rule::RKind::K_FlagAttribute: {
804
- Rule::TupleOfThreeStringRef Data =
805
- R.getStorage <Rule::RKind::K_FlagAttribute>();
806
- if (F->hasFnAttribute (std::get<0 >(Data)))
807
- Result += std::get<1 >(Data);
806
+ Rule::FlagRuleData Data = R.getStorage <Rule::RKind::K_FlagAttribute>();
807
+ if (F->hasFnAttribute (Data.Name ))
808
+ Result += Data.IfPresentStr ;
808
809
else
809
- Result += std::get< 2 >( Data) ;
810
+ Result += Data. IfAbsentStr ;
810
811
} break ;
811
812
}
812
813
0 commit comments