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;
1313std::unique_ptr<cpp_entity> detail::try_parse_cpp_concept (const detail::parse_context& context,
1414 const CXCursor& cur)
1515{
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)
1819 return nullptr ;
19- #else
20- DEBUG_ASSERT (cur.kind == CXCursor_UnexposedDecl, detail::assert_handler{});
21- #endif
2220
2321 detail::cxtokenizer tokenizer (context.tu , context.file , cur);
2422 detail::cxtoken_stream stream (tokenizer, cur);
Original file line number Diff line number Diff line change 119119 }
120120
121121 auto kind = clang_getCursorKind (cur);
122- switch (kind)
122+ switch (int ( kind) )
123123 {
124124 case CXCursor_UnexposedDecl:
125125 // go through all the try_parse_XXX functions
@@ -198,13 +198,10 @@ try
198198 case CXCursor_ClassTemplatePartialSpecialization:
199199 return parse_cpp_class_template_specialization (context, cur);
200200
201- #if CINDEX_VERSION_MINOR >= 62
202- case CXCursor_ConceptDecl:
203- return try_parse_cpp_concept (context, cur);
204- #endif
205-
206201 case CXCursor_StaticAssert:
207202 return parse_cpp_static_assert (context, cur);
203+ case CXCursor_ConceptDecl:
204+ return try_parse_cpp_concept (context, cur);
208205
209206 default :
210207 break ;
Original file line number Diff line number Diff line change @@ -94,7 +94,18 @@ namespace detail
9494 std::unique_ptr<cpp_entity> try_parse_cpp_language_linkage (const parse_context& context,
9595 const CXCursor& cur);
9696
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
98109 std::unique_ptr<cpp_entity> try_parse_cpp_concept (const parse_context& context,
99110 const CXCursor& cur);
100111
You can’t perform that action at this time.
0 commit comments