Skip to content

Commit 566d52a

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 3f748e6 commit 566d52a

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
@@ -8425,7 +8425,7 @@ void swift::simple_display(llvm::raw_ostream &out, AccessorKind kind) {
84258425
}
84268426

84278427
SourceLoc swift::extractNearestSourceLoc(const Decl *decl) {
8428-
auto loc = decl->getLoc();
8428+
auto loc = decl->getLoc(/*SerializedOK=*/false);
84298429
if (loc.isValid())
84308430
return loc;
84318431

0 commit comments

Comments
 (0)