@@ -63,53 +63,85 @@ SubstituteConstraintExpressionWithoutSatisfaction(
63
63
64
64
When there's no direct correspondence, this trait returns
65
65
the base Info type.
66
-
67
66
*/
68
- template <class DeclType >
69
- struct MrDocsType : std::type_identity<Info> {};
67
+ template <class >
68
+ struct InfoTypeFor {};
70
69
71
- template <std::derived_from<CXXRecordDecl> DeclType>
72
- struct MrDocsType <DeclType> : std::type_identity<RecordInfo> {};
70
+ // Extract NamespaceInfo from NamespaceDecl
71
+ template <>
72
+ struct InfoTypeFor <NamespaceDecl>
73
+ : std::type_identity<NamespaceInfo> {};
73
74
74
- template <std::derived_from<VarDecl> VarTy>
75
- struct MrDocsType <VarTy> : std::type_identity<VariableInfo> {};
75
+ // Extract RecordInfo from anything derived from CXXRecordDecl
76
+ template <std::derived_from<CXXRecordDecl> DeclType>
77
+ struct InfoTypeFor <DeclType>
78
+ : std::type_identity<RecordInfo> {};
76
79
80
+ // Extract FunctionInfo from anything derived from FunctionDecl
77
81
template <std::derived_from<FunctionDecl> FunctionTy>
78
- struct MrDocsType <FunctionTy> : std::type_identity<FunctionInfo> {};
79
-
80
- template <std::derived_from<TypedefNameDecl> TypedefNameTy>
81
- struct MrDocsType <TypedefNameTy> : std::type_identity<TypedefInfo> {};
82
+ struct InfoTypeFor <FunctionTy>
83
+ : std::type_identity<FunctionInfo> {};
82
84
85
+ // Extract EnumInfo from EnumDecl
83
86
template <>
84
- struct MrDocsType <EnumDecl> : std::type_identity<EnumInfo> {};
87
+ struct InfoTypeFor <EnumDecl>
88
+ : std::type_identity<EnumInfo> {};
85
89
90
+ // Extract EnumConstantInfo from EnumConstantDecl
86
91
template <>
87
- struct MrDocsType <FieldDecl> : std::type_identity<FieldInfo> {};
92
+ struct InfoTypeFor <EnumConstantDecl>
93
+ : std::type_identity<EnumConstantInfo> {};
88
94
89
- template <>
90
- struct MrDocsType <EnumConstantDecl> : std::type_identity<EnumConstantInfo> {};
95
+ // Extract TypedefInfo from anything derived from TypedefNameDecl
96
+ template <std::derived_from<TypedefNameDecl> TypedefNameTy>
97
+ struct InfoTypeFor <TypedefNameTy>
98
+ : std::type_identity<TypedefInfo> {};
91
99
100
+ // Extract VariableInfo from anything derived from VarDecl
101
+ template <std::derived_from<VarDecl> VarTy>
102
+ struct InfoTypeFor <VarTy>
103
+ : std::type_identity<VariableInfo> {};
104
+
105
+ // Extract FieldInfo from FieldDecl
92
106
template <>
93
- struct MrDocsType <FriendDecl> : std::type_identity<FriendInfo> {};
107
+ struct InfoTypeFor <FieldDecl>
108
+ : std::type_identity<FieldInfo> {};
94
109
110
+ // Extract FriendInfo from FriendDecl
95
111
template <>
96
- struct MrDocsType <CXXDeductionGuideDecl> : std::type_identity<GuideInfo> {};
112
+ struct InfoTypeFor <FriendDecl>
113
+ : std::type_identity<FriendInfo> {};
97
114
115
+ // Extract GuideInfo from CXXDeductionGuideDecl
98
116
template <>
99
- struct MrDocsType <NamespaceAliasDecl> : std::type_identity<NamespaceAliasInfo> {};
117
+ struct InfoTypeFor <CXXDeductionGuideDecl>
118
+ : std::type_identity<GuideInfo> {};
100
119
120
+ // Extract NamespaceAliasInfo from NamespaceAliasDecl
101
121
template <>
102
- struct MrDocsType <UsingDecl> : std::type_identity<UsingInfo> {};
122
+ struct InfoTypeFor <NamespaceAliasDecl>
123
+ : std::type_identity<NamespaceAliasInfo> {};
103
124
125
+ // Extract UsingInfo from UsingDecl
104
126
template <>
105
- struct MrDocsType <NamespaceDecl> : std::type_identity<NamespaceInfo>{};
127
+ struct InfoTypeFor <UsingDecl>
128
+ : std::type_identity<UsingInfo> {};
106
129
130
+ // Extract ConceptInfo from ConceptDecl
107
131
template <>
108
- struct MrDocsType <ConceptDecl> : std::type_identity<ConceptInfo>{};
132
+ struct InfoTypeFor <ConceptDecl>
133
+ : std::type_identity<ConceptInfo> {};
134
+
135
+ // / Determine if there's a MrDocs Info type for a Clang DeclType
136
+ template <class T >
137
+ concept HasInfoTypeFor = requires
138
+ {
139
+ typename InfoTypeFor<T>::type;
140
+ };
109
141
110
- // / @copydoc MrDocsType
142
+ // / @copydoc InfoTypeFor
111
143
template <class DeclType >
112
- using MrDocsType_t = typename MrDocsType <DeclType>::type;
144
+ using InfoTypeFor_t = typename InfoTypeFor <DeclType>::type;
113
145
114
146
/* * Convert a Clang AccessSpecifier into a MrDocs AccessKind
115
147
*/
0 commit comments