File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -215,6 +215,17 @@ class SwiftDispatcher {
215
215
// Emits a Location TRAP entry and attaches it to a `Locatable` trap label
216
216
template <typename Locatable>
217
217
void attachLocation (Locatable* locatable, TrapLabel<LocatableTag> locatableLabel) {
218
+ // Swift 5.7.1 causing a crash when the Swift compiler uses .back() of and empty
219
+ // getPatternList() when getting the source location.
220
+ // So far this only observed with the entities coming from precompiled modules, so they
221
+ // should not have locations anyway.
222
+ if constexpr (std::is_base_of<swift::Decl, Locatable>::value) {
223
+ if (auto * decl = llvm::dyn_cast<swift::PatternBindingDecl>(locatable)) {
224
+ if (decl->getPatternList ().empty ()) {
225
+ return ;
226
+ }
227
+ }
228
+ }
218
229
attachLocation (locatable->getStartLoc (), locatable->getEndLoc (), locatableLabel);
219
230
}
220
231
You can’t perform that action at this time.
0 commit comments