hokein created this revision.
hokein added a reviewer: sammccall.
Herald added subscribers: usaxena95, kadircet, arphaman.
hokein requested review of this revision.
Herald added subscribers: MaskRay, ilya-biryukov.
Herald added a project: clang.
to track the number of different "special" go-to-def request.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D94289
Files:
clang-tools-extra/clangd/XRefs.cpp
Index: clang-tools-extra/clangd/XRefs.cpp
===================================================================
--- clang-tools-extra/clangd/XRefs.cpp
+++ clang-tools-extra/clangd/XRefs.cpp
@@ -335,6 +335,8 @@
// Keep track of SymbolID -> index mapping, to fill in index data later.
llvm::DenseMap<SymbolID, size_t> ResultIndex;
+ static constexpr trace::Metric LocateASTReferentMetric(
+ "locate_ast_referent", trace::Metric::Counter, "case");
auto AddResultDecl = [&](const NamedDecl *D) {
D = getPreferredDecl(D);
auto Loc =
@@ -368,8 +370,10 @@
// saved in the AST.
if (CMD->isPure()) {
if (TouchedIdentifier && SM.getSpellingLoc(CMD->getLocation()) ==
- TouchedIdentifier->location())
+ TouchedIdentifier->location()) {
VirtualMethods.insert(getSymbolID(CMD));
+ LocateASTReferentMetric.record(1, "go-to-overrides");
+ }
}
// Special case: void foo() ^override: jump to the overridden method.
const InheritableAttr *Attr = D->getAttr<OverrideAttr>();
@@ -378,6 +382,7 @@
if (Attr && TouchedIdentifier &&
SM.getSpellingLoc(Attr->getLocation()) ==
TouchedIdentifier->location()) {
+ LocateASTReferentMetric.record(1, "go-to-overridens");
// We may be overridding multiple methods - offer them all.
for (const NamedDecl *ND : CMD->overridden_methods())
AddResultDecl(ND);
@@ -420,6 +425,7 @@
ID->getName() == TouchedIdentifier->text(SM)))
AddResultDecl(ID);
+ LocateASTReferentMetric.record(1, "regular");
// Otherwise the target declaration is the right one.
AddResultDecl(D);
}
Index: clang-tools-extra/clangd/XRefs.cpp
===================================================================
--- clang-tools-extra/clangd/XRefs.cpp
+++ clang-tools-extra/clangd/XRefs.cpp
@@ -335,6 +335,8 @@
// Keep track of SymbolID -> index mapping, to fill in index data later.
llvm::DenseMap<SymbolID, size_t> ResultIndex;
+ static constexpr trace::Metric LocateASTReferentMetric(
+ "locate_ast_referent", trace::Metric::Counter, "case");
auto AddResultDecl = [&](const NamedDecl *D) {
D = getPreferredDecl(D);
auto Loc =
@@ -368,8 +370,10 @@
// saved in the AST.
if (CMD->isPure()) {
if (TouchedIdentifier && SM.getSpellingLoc(CMD->getLocation()) ==
- TouchedIdentifier->location())
+ TouchedIdentifier->location()) {
VirtualMethods.insert(getSymbolID(CMD));
+ LocateASTReferentMetric.record(1, "go-to-overrides");
+ }
}
// Special case: void foo() ^override: jump to the overridden method.
const InheritableAttr *Attr = D->getAttr<OverrideAttr>();
@@ -378,6 +382,7 @@
if (Attr && TouchedIdentifier &&
SM.getSpellingLoc(Attr->getLocation()) ==
TouchedIdentifier->location()) {
+ LocateASTReferentMetric.record(1, "go-to-overridens");
// We may be overridding multiple methods - offer them all.
for (const NamedDecl *ND : CMD->overridden_methods())
AddResultDecl(ND);
@@ -420,6 +425,7 @@
ID->getName() == TouchedIdentifier->text(SM)))
AddResultDecl(ID);
+ LocateASTReferentMetric.record(1, "regular");
// Otherwise the target declaration is the right one.
AddResultDecl(D);
}
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits