Workaround libclang issue with USR of conversion function
This commit is contained in:
parent
70ac5cf111
commit
23888ca9c4
1 changed files with 4 additions and 1 deletions
|
|
@ -15,11 +15,14 @@ cpp_entity_id detail::get_entity_id(const CXCursor& cur)
|
||||||
{
|
{
|
||||||
cxstring usr(clang_getCursorUSR(cur));
|
cxstring usr(clang_getCursorUSR(cur));
|
||||||
DEBUG_ASSERT(!usr.empty(), detail::parse_error_handler{}, cur, "cannot create id for entity");
|
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
|
// we have a function template
|
||||||
// combine return type with USR to ensure no ambiguity when SFINAE is applied there
|
// combine return type with USR to ensure no ambiguity when SFINAE is applied there
|
||||||
// (and hope this prevents all collisions...)
|
// (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)));
|
cxstring type_spelling(clang_getTypeSpelling(clang_getCursorResultType(cur)));
|
||||||
return cpp_entity_id(std::string(usr.c_str()) + type_spelling.c_str());
|
return cpp_entity_id(std::string(usr.c_str()) + type_spelling.c_str());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue