Skip to content

Commit b4aaaee

Browse files
committed
AST: Fix crash in SubstitutionMap::dump() with empty SubstitutionMap
The SubstitutionMap type has a "null value" where there's no generic signature and no entries. There's nothing to dump in this case.
1 parent 26aa023 commit b4aaaee

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/AST/SubstitutionMap.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,8 +398,13 @@ void SubstitutionMap::verify() const {
398398
}
399399

400400
void SubstitutionMap::dump(llvm::raw_ostream &out) const {
401+
auto *genericSig = getGenericSignature();
402+
if (genericSig == nullptr) {
403+
out << "Empty substitution map\n";
404+
return;
405+
}
401406
out << "Generic signature: ";
402-
getGenericSignature()->print(out);
407+
genericSig->print(out);
403408
out << "\n";
404409
out << "Substitutions:\n";
405410
for (const auto &sub : subMap) {

0 commit comments

Comments
 (0)