Skip to content

Commit 4c5bda2

Browse files
committed
AST: Don't trigger source location deserialization in request evaluator
Deserializing a source location will compute the declaration's USR, which might trigger another request cycle, etc. Tentative fix for rdar://problem/80546848, but I don't have a test case.
1 parent f636e9a commit 4c5bda2

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

include/swift/AST/AnyFunctionRef.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -210,9 +210,9 @@ class AnyFunctionRef {
210210
llvm_unreachable("unexpected AnyFunctionRef representation");
211211
}
212212

213-
SourceLoc getLoc() const {
213+
SourceLoc getLoc(bool SerializedOK = true) const {
214214
if (auto afd = TheFunction.dyn_cast<AbstractFunctionDecl *>()) {
215-
return afd->getLoc();
215+
return afd->getLoc(SerializedOK);
216216
}
217217
if (auto ce = TheFunction.dyn_cast<AbstractClosureExpr *>()) {
218218
return ce->getLoc();
@@ -269,7 +269,7 @@ class AnyFunctionRef {
269269
}
270270

271271
friend SourceLoc extractNearestSourceLoc(AnyFunctionRef fn) {
272-
return fn.getLoc();
272+
return fn.getLoc(/*SerializedOK=*/false);
273273
}
274274

275275
private:

lib/AST/Decl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8517,7 +8517,7 @@ void swift::simple_display(llvm::raw_ostream &out, AccessorKind kind) {
85178517
}
85188518

85198519
SourceLoc swift::extractNearestSourceLoc(const Decl *decl) {
8520-
auto loc = decl->getLoc();
8520+
auto loc = decl->getLoc(/*SerializedOK=*/false);
85218521
if (loc.isValid())
85228522
return loc;
85238523

0 commit comments

Comments
 (0)