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.
This commit is contained in:
Slava Pestov
2017-04-24 00:50:57 -07:00
parent 26aa02324b
commit b4aaaee956

View File

@@ -398,8 +398,13 @@ void SubstitutionMap::verify() const {
}
void SubstitutionMap::dump(llvm::raw_ostream &out) const {
auto *genericSig = getGenericSignature();
if (genericSig == nullptr) {
out << "Empty substitution map\n";
return;
}
out << "Generic signature: ";
getGenericSignature()->print(out);
genericSig->print(out);
out << "\n";
out << "Substitutions:\n";
for (const auto &sub : subMap) {