aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Index/IndexDecl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Index/IndexDecl.cpp')
-rw-r--r--lib/Index/IndexDecl.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/Index/IndexDecl.cpp b/lib/Index/IndexDecl.cpp
index 7d60aad3895d..3b4f3f81399d 100644
--- a/lib/Index/IndexDecl.cpp
+++ b/lib/Index/IndexDecl.cpp
@@ -92,7 +92,13 @@ public:
Relations.emplace_back((unsigned)SymbolRole::RelationAccessorOf,
AssociatedProp);
- if (!IndexCtx.handleDecl(D, (unsigned)SymbolRole::Dynamic, Relations))
+ // getLocation() returns beginning token of a method declaration, but for
+ // indexing purposes we want to point to the base name.
+ SourceLocation MethodLoc = D->getSelectorStartLoc();
+ if (MethodLoc.isInvalid())
+ MethodLoc = D->getLocation();
+
+ if (!IndexCtx.handleDecl(D, MethodLoc, (unsigned)SymbolRole::Dynamic, Relations))
return false;
IndexCtx.indexTypeSourceInfo(D->getReturnTypeSourceInfo(), D);
bool hasIBActionAndFirst = D->hasAttr<IBActionAttr>();