@@ -63,53 +63,85 @@ SubstituteConstraintExpressionWithoutSatisfaction(
6363
6464 When there's no direct correspondence, this trait returns
6565 the base Info type.
66-
6766 */
68- template <class DeclType >
69- struct MrDocsType : std::type_identity<Info> {};
67+ template <class >
68+ struct InfoTypeFor {};
7069
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> {};
7374
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> {};
7679
80+ // Extract FunctionInfo from anything derived from FunctionDecl
7781template <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> {};
8284
85+ // Extract EnumInfo from EnumDecl
8386template <>
84- struct MrDocsType <EnumDecl> : std::type_identity<EnumInfo> {};
87+ struct InfoTypeFor <EnumDecl>
88+ : std::type_identity<EnumInfo> {};
8589
90+ // Extract EnumConstantInfo from EnumConstantDecl
8691template <>
87- struct MrDocsType <FieldDecl> : std::type_identity<FieldInfo> {};
92+ struct InfoTypeFor <EnumConstantDecl>
93+ : std::type_identity<EnumConstantInfo> {};
8894
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> {};
9199
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
92106template <>
93- struct MrDocsType <FriendDecl> : std::type_identity<FriendInfo> {};
107+ struct InfoTypeFor <FieldDecl>
108+ : std::type_identity<FieldInfo> {};
94109
110+ // Extract FriendInfo from FriendDecl
95111template <>
96- struct MrDocsType <CXXDeductionGuideDecl> : std::type_identity<GuideInfo> {};
112+ struct InfoTypeFor <FriendDecl>
113+ : std::type_identity<FriendInfo> {};
97114
115+ // Extract GuideInfo from CXXDeductionGuideDecl
98116template <>
99- struct MrDocsType <NamespaceAliasDecl> : std::type_identity<NamespaceAliasInfo> {};
117+ struct InfoTypeFor <CXXDeductionGuideDecl>
118+ : std::type_identity<GuideInfo> {};
100119
120+ // Extract NamespaceAliasInfo from NamespaceAliasDecl
101121template <>
102- struct MrDocsType <UsingDecl> : std::type_identity<UsingInfo> {};
122+ struct InfoTypeFor <NamespaceAliasDecl>
123+ : std::type_identity<NamespaceAliasInfo> {};
103124
125+ // Extract UsingInfo from UsingDecl
104126template <>
105- struct MrDocsType <NamespaceDecl> : std::type_identity<NamespaceInfo>{};
127+ struct InfoTypeFor <UsingDecl>
128+ : std::type_identity<UsingInfo> {};
106129
130+ // Extract ConceptInfo from ConceptDecl
107131template <>
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+ };
109141
110- // / @copydoc MrDocsType
142+ // / @copydoc InfoTypeFor
111143template <class DeclType >
112- using MrDocsType_t = typename MrDocsType <DeclType>::type;
144+ using InfoTypeFor_t = typename InfoTypeFor <DeclType>::type;
113145
114146/* * Convert a Clang AccessSpecifier into a MrDocs AccessKind
115147 */
0 commit comments