forked from qt-creator/qt-creator
CPlusPlus: Add new usage tag "Template"
For use in follow-up patch. Change-Id: I49c057280be9b09862a89fa385a7396f1b1093bb Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -360,6 +360,22 @@ static Usage::Tags getUsageType(const ClangdAstPath &path, const QString &search
|
||||
if (path.last().role() == "expression" && path.last().kind() == "CXXConstruct")
|
||||
invokedConstructor = path.last().detail().value_or(QString());
|
||||
const auto isPotentialWrite = [&] { return potentialWrite && !isFunction; };
|
||||
const auto isSomeSortOfTemplate = [&](auto declPathIt) {
|
||||
if (declPathIt->kind() == "Function") {
|
||||
const auto children = declPathIt->children().value_or(QList<ClangdAstNode>());
|
||||
for (const ClangdAstNode &child : children) {
|
||||
if (child.role() == "template argument")
|
||||
return true;
|
||||
}
|
||||
}
|
||||
for (; declPathIt != path.rend(); ++declPathIt) {
|
||||
if (declPathIt->kind() == "FunctionTemplate" || declPathIt->kind() == "ClassTemplate"
|
||||
|| declPathIt->kind() == "ClassTemplatePartialSpecialization") {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
for (auto pathIt = path.rbegin(); pathIt != path.rend(); ++pathIt) {
|
||||
if (pathIt->arcanaContains("non_odr_use_unevaluated"))
|
||||
return {};
|
||||
@@ -414,6 +430,8 @@ static Usage::Tags getUsageType(const ClangdAstPath &path, const QString &search
|
||||
tags |= Usage::Tag::MocInvokable;
|
||||
}
|
||||
}
|
||||
if (isSomeSortOfTemplate(pathIt))
|
||||
tags |= Usage::Tag::Template;
|
||||
return tags;
|
||||
}
|
||||
if (pathIt->kind() == "MemberInitializer")
|
||||
|
||||
Reference in New Issue
Block a user