Skip to content

Commit 13c7011

Browse files
committed
Check for definition first
1 parent 478cd5a commit 13c7011

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

clang-tools-extra/clangd/XRefs.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -446,9 +446,8 @@ locateASTReferent(SourceLocation CurLoc, const syntax::Token *TouchedIdentifier,
446446
// FIXME: Support jumping from a protocol decl to overrides on go-to
447447
// definition.
448448
if (const auto *OMD = llvm::dyn_cast<ObjCMethodDecl>(D)) {
449-
if (TouchedIdentifier &&
450-
objcMethodIsTouched(SM, OMD, TouchedIdentifier->location()) &&
451-
OMD->isThisDeclarationADefinition()) {
449+
if (OMD->isThisDeclarationADefinition() && TouchedIdentifier &&
450+
objcMethodIsTouched(SM, OMD, TouchedIdentifier->location())) {
452451
llvm::SmallVector<const ObjCMethodDecl *, 4> Overrides;
453452
OMD->getOverriddenMethods(Overrides);
454453
if (!Overrides.empty()) {

0 commit comments

Comments
 (0)