File tree Expand file tree Collapse file tree 3 files changed +18
-12
lines changed Expand file tree Collapse file tree 3 files changed +18
-12
lines changed Original file line number Diff line number Diff line change @@ -13,12 +13,10 @@ using namespace cppast;
13
13
std::unique_ptr<cpp_entity> detail::try_parse_cpp_concept (const detail::parse_context& context,
14
14
const CXCursor& cur)
15
15
{
16
- #if CINDEX_VERSION_MINOR >= 62
17
- if (cur.kind != CXCursor_ConceptDecl)
16
+ DEBUG_ASSERT (cur.kind == CXCursor_UnexposedDecl || cur.kind == CXCursor_ConceptDecl,
17
+ detail::assert_handler{});
18
+ if (libclang_definitely_has_concept_support && cur.kind != CXCursor_ConceptDecl)
18
19
return nullptr ;
19
- #else
20
- DEBUG_ASSERT (cur.kind == CXCursor_UnexposedDecl, detail::assert_handler{});
21
- #endif
22
20
23
21
detail::cxtokenizer tokenizer (context.tu , context.file , cur);
24
22
detail::cxtoken_stream stream (tokenizer, cur);
Original file line number Diff line number Diff line change 119
119
}
120
120
121
121
auto kind = clang_getCursorKind (cur);
122
- switch (kind)
122
+ switch (int ( kind) )
123
123
{
124
124
case CXCursor_UnexposedDecl:
125
125
// go through all the try_parse_XXX functions
@@ -198,13 +198,10 @@ try
198
198
case CXCursor_ClassTemplatePartialSpecialization:
199
199
return parse_cpp_class_template_specialization (context, cur);
200
200
201
- #if CINDEX_VERSION_MINOR >= 62
202
- case CXCursor_ConceptDecl:
203
- return try_parse_cpp_concept (context, cur);
204
- #endif
205
-
206
201
case CXCursor_StaticAssert:
207
202
return parse_cpp_static_assert (context, cur);
203
+ case CXCursor_ConceptDecl:
204
+ return try_parse_cpp_concept (context, cur);
208
205
209
206
default :
210
207
break ;
Original file line number Diff line number Diff line change @@ -94,7 +94,18 @@ namespace detail
94
94
std::unique_ptr<cpp_entity> try_parse_cpp_language_linkage (const parse_context& context,
95
95
const CXCursor& cur);
96
96
97
- // unexposed
97
+ // If the version is < 62, CXCursor_ConceptDecl does not exist.
98
+ // If the version is > 62, CXCursor_ConceptDecl does exist.
99
+ // If the version == 62, it may or may not exist. :(
100
+ // As such, manually define it to the corresponding number.
101
+ constexpr auto libclang_definitely_has_concept_support = CINDEX_VERSION_MINOR > 62 ;
102
+ #if CINDEX_VERSION_MINOR > 62
103
+ constexpr auto CXCursor_ConceptDecl = ::CXCursor_ConceptDecl;
104
+ #else
105
+ constexpr auto CXCursor_ConceptDecl = CXCursorKind(604 );
106
+ #endif
107
+
108
+ // unexposed, ConceptDecl
98
109
std::unique_ptr<cpp_entity> try_parse_cpp_concept (const parse_context& context,
99
110
const CXCursor& cur);
100
111
You can’t perform that action at this time.
0 commit comments