!OverriddenBy.Subjects.empty())
Index->relations(
OverriddenBy, [&](const SymbolID &Subject, const Symbol &Object) {
- if (auto LSPLoc =
- toLSPLocation(Object.CanonicalDeclaration, *MainFilePath)) {
+ const auto LSPLocDecl =
+ toLSPLocation(Object.CanonicalDeclaration, *MainFilePath);
+ const auto LSPLocDef =
+ toLSPLocation(Object.Definition, *MainFilePath);
+ if (LSPLocDecl && LSPLocDecl != LSPLocDef) {
ReferencesResult::Reference Result;
- Result.Loc = std::move(*LSPLoc);
+ Result.Loc = std::move(*LSPLocDecl);
Result.Attributes =
ReferencesResult::Declaration | ReferencesResult::Override;
Results.References.push_back(std::move(Result));
}
- if (auto LSPLoc = toLSPLocation(Object.Definition, *MainFilePath)) {
+ if (LSPLocDef) {
ReferencesResult::Reference Result;
- Result.Loc = std::move(*LSPLoc);
+ Result.Loc = std::move(*LSPLocDef);
Result.Attributes = ReferencesResult::Declaration |
ReferencesResult::Definition |
ReferencesResult::Override;
void $overridedecl[[func]]() override;
};
void Derived::$overridedef[[func]]() {}
+ class Derived2 : public Base {
+ void $overridedef[[func]]() override {}
+ };
void test(Derived* D) {
D->func(); // No references to the overrides.
})cpp";