CPlusPlus: Add more usage tags

To be used in subsequent patches.

Change-Id: Id7140aa39bb2adba343cc12b0273c90f3c12abeb
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
Christian Kandeler
2022-11-02 14:27:17 +01:00
parent d891e18edc
commit 3e3569f6dc
5 changed files with 198 additions and 12 deletions

View File

@@ -397,7 +397,17 @@ static Usage::Tags getUsageType(const ClangdAstPath &path)
return Usage::Tag::WritableRef;
return Usage::Tag::Read;
}
return Usage::Tag::Declaration;
Usage::Tags tags = Usage::Tag::Declaration;
const auto children = pathIt->children().value_or(QList<ClangdAstNode>());
for (const ClangdAstNode &child : children) {
if (child.role() == "attribute") {
if (child.kind() == "Override" || child.kind() == "Final")
tags |= Usage::Tag::Override;
else if (child.kind() == "Annotate" && child.arcanaContains("qt_"))
tags |= Usage::Tag::MocInvokable;
}
}
return tags;
}
if (pathIt->kind() == "MemberInitializer")
return pathIt == path.rbegin() ? Usage::Tag::Write : Usage::Tag::Read;