@@ -13,7 +13,12 @@ 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)
18+ return nullptr ;
19+ #else
1620 DEBUG_ASSERT (cur.kind == CXCursor_UnexposedDecl, detail::assert_handler{});
21+ #endif
1722
1823 detail::cxtokenizer tokenizer (context.tu , context.file , cur);
1924 detail::cxtoken_stream stream (tokenizer, cur);
@@ -34,28 +39,15 @@ std::unique_ptr<cpp_entity> detail::try_parse_cpp_concept(const detail::parse_co
3439 return nullptr ;
3540
3641 const auto & identifier_token = stream.get ();
37- if (identifier_token.kind () != CXTokenKind::CXToken_Identifier)
38- {
39- return nullptr ;
40- }
41-
42- cpp_concept::builder builder (identifier_token.value ().std_str ());
43-
44- if (!detail::skip_if (stream, " =" ))
45- {
46- return nullptr ;
47- }
48-
49- if (*(stream.end () - 1 ) != " ;" )
50- {
51- return nullptr ;
52- }
42+ DEBUG_ASSERT (identifier_token.kind () == CXTokenKind::CXToken_Identifier,
43+ detail::assert_handler{});
5344
54- builder. set_expression (
55- parse_raw_expression (context, stream, stream.end () - 1 ,
56- cpp_builtin_type::build (cpp_builtin_type_kind::cpp_bool) ));
45+ detail::skip (stream, " = " );
46+ auto expr = parse_raw_expression (context, stream, stream.end () - 1 ,
47+ cpp_builtin_type::build (cpp_builtin_type_kind::cpp_bool));
5748
49+ cpp_concept::builder builder (identifier_token.value ().std_str ());
50+ builder.set_expression (std::move (expr));
5851 builder.set_parameters (std::move (params));
59-
6052 return builder.finish (*context.idx , detail::get_entity_id (cur));
6153}
0 commit comments