From 23888ca9c4e825fadd7cb767310ecfda19da6139 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonathan=20M=C3=BCller?= Date: Fri, 23 Jun 2017 12:39:43 +0200 Subject: [PATCH] Workaround libclang issue with USR of conversion function --- src/libclang/parse_functions.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/libclang/parse_functions.cpp b/src/libclang/parse_functions.cpp index 4940cdd..68e661e 100644 --- a/src/libclang/parse_functions.cpp +++ b/src/libclang/parse_functions.cpp @@ -15,11 +15,14 @@ cpp_entity_id detail::get_entity_id(const CXCursor& cur) { cxstring usr(clang_getCursorUSR(cur)); DEBUG_ASSERT(!usr.empty(), detail::parse_error_handler{}, cur, "cannot create id for entity"); - if (clang_getCursorKind(cur) == CXCursor_FunctionTemplate) + if (clang_getCursorKind(cur) == CXCursor_FunctionTemplate + || clang_getCursorKind(cur) == CXCursor_ConversionFunction) { // we have a function template // combine return type with USR to ensure no ambiguity when SFINAE is applied there // (and hope this prevents all collisions...) + // same workaround also applies to conversion functions, + // there template arguments in the result are ignored cxstring type_spelling(clang_getTypeSpelling(clang_getCursorResultType(cur))); return cpp_entity_id(std::string(usr.c_str()) + type_spelling.c_str()); }