Refactored is variadic to a method of cursor
This commit is contained in:
@@ -239,6 +239,12 @@ public:
|
|||||||
return clang_Cursor_getTranslationUnit(m_cursor);
|
return clang_Cursor_getTranslationUnit(m_cursor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool is_template_parameter_variadic() const
|
||||||
|
{
|
||||||
|
const auto &tokens = tokenize();
|
||||||
|
return tokens.size() > 2 && tokens[1] == "...";
|
||||||
|
}
|
||||||
|
|
||||||
std::string usr() const { return to_string(clang_getCursorUSR(m_cursor)); }
|
std::string usr() const { return to_string(clang_getCursorUSR(m_cursor)); }
|
||||||
|
|
||||||
CXSourceRange extent() const { return clang_getCursorExtent(m_cursor); }
|
CXSourceRange extent() const { return clang_getCursorExtent(m_cursor); }
|
||||||
|
|||||||
@@ -330,13 +330,13 @@ static enum CXChildVisitResult class_visitor(
|
|||||||
ret = CXChildVisit_Continue;
|
ret = CXChildVisit_Continue;
|
||||||
break;
|
break;
|
||||||
case CXCursor_TemplateTypeParameter: {
|
case CXCursor_TemplateTypeParameter: {
|
||||||
const auto &tokens = cursor.tokenize();
|
spdlog::info("Found template type parameter: {}: {}, isvariadic={}",
|
||||||
spdlog::info("Found template type parameter: {}: {}, [{}]", cursor,
|
cursor, cursor.type(), cursor.is_template_parameter_variadic());
|
||||||
cursor.type(), fmt::join(tokens, ", "));
|
|
||||||
class_template ct;
|
class_template ct;
|
||||||
ct.type = "";
|
ct.type = "";
|
||||||
ct.default_value = "";
|
ct.default_value = "";
|
||||||
ct.is_variadic = tokens.size() > 2 && tokens[1] == "...";
|
ct.is_variadic = cursor.is_template_parameter_variadic();
|
||||||
ct.name = cursor.spelling();
|
ct.name = cursor.spelling();
|
||||||
if (ct.is_variadic)
|
if (ct.is_variadic)
|
||||||
ct.name += "...";
|
ct.name += "...";
|
||||||
@@ -347,6 +347,7 @@ static enum CXChildVisitResult class_visitor(
|
|||||||
case CXCursor_NonTypeTemplateParameter: {
|
case CXCursor_NonTypeTemplateParameter: {
|
||||||
spdlog::info("Found template nontype parameter: {}: {}",
|
spdlog::info("Found template nontype parameter: {}: {}",
|
||||||
cursor.spelling(), cursor.type());
|
cursor.spelling(), cursor.type());
|
||||||
|
|
||||||
class_template ct;
|
class_template ct;
|
||||||
ct.type = cursor.type().canonical().spelling();
|
ct.type = cursor.type().canonical().spelling();
|
||||||
ct.name = cursor.spelling();
|
ct.name = cursor.spelling();
|
||||||
|
|||||||
Reference in New Issue
Block a user