Added skipping of forward declarations
This commit is contained in:
@@ -130,6 +130,16 @@ public:
|
||||
|
||||
bool is_declaration() const { return clang_isDeclaration(kind()); }
|
||||
|
||||
bool is_forward_declaration() const
|
||||
{
|
||||
auto definition = clang_getCursorDefinition(m_cursor);
|
||||
|
||||
if (clang_equalCursors(definition, clang_getNullCursor()))
|
||||
return true;
|
||||
|
||||
return !clang_equalCursors(m_cursor, definition);
|
||||
}
|
||||
|
||||
bool is_invalid_declaration() const
|
||||
{
|
||||
return clang_isInvalidDeclaration(m_cursor);
|
||||
|
||||
@@ -572,12 +572,16 @@ static enum CXChildVisitResult translation_unit_visitor(
|
||||
case CXCursor_ClassTemplate:
|
||||
[[fallthrough]];
|
||||
case CXCursor_ClassDecl: {
|
||||
spdlog::info("Found class or class template declaration: {}",
|
||||
cursor_name_str);
|
||||
spdlog::info(
|
||||
"Found class or class template declaration: {}", cursor);
|
||||
if (!ctx->config.should_include(cursor.fully_qualified())) {
|
||||
ret = CXChildVisit_Continue;
|
||||
break;
|
||||
}
|
||||
if (cursor.is_forward_declaration()) {
|
||||
ret = CXChildVisit_Continue;
|
||||
break;
|
||||
}
|
||||
|
||||
scope = scope_t::kPublic;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user