Skip to content

Commit 88f0e75

Browse files
committed
[Index] Always skip invalid locations outside of modules
There's a number of paths that end up calling into `initIndexSymbol` that may or may not have checked that the given location is actually valid. Add an extra check within the method to guarantee we only output 0:0 locations when indexing modules. Resolves rdar://98645486.
1 parent 38d2b96 commit 88f0e75

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lib/Index/Index.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1601,8 +1601,13 @@ bool IndexSwiftASTWalker::reportImplicitConformance(ValueDecl *witness, ValueDec
16011601
bool IndexSwiftASTWalker::initIndexSymbol(ValueDecl *D, SourceLoc Loc,
16021602
bool IsRef, IndexSymbol &Info) {
16031603
assert(D);
1604+
1605+
if (Loc.isInvalid() && !IsModuleFile)
1606+
return true;
1607+
16041608
if (Loc.isValid() && SrcMgr.findBufferContainingLoc(Loc) != BufferID)
16051609
return true;
1610+
16061611
if (auto *VD = dyn_cast<VarDecl>(D)) {
16071612
// Always base the symbol information on the canonical VarDecl
16081613
D = VD->getCanonicalVarDecl();

0 commit comments

Comments
 (0)