Skip to content

Commit

Permalink
Merge pull request #14774 from rudkx/cs-check-type-before-getting
Browse files Browse the repository at this point in the history
Update ConstraintSystem::dump to check hasType before calling getType.
  • Loading branch information
rudkx committed Feb 22, 2018
2 parents 786cfc5 + 5e4390c commit 0ae61f6
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lib/Sema/TypeCheckConstraints.cpp
Expand Up @@ -3121,9 +3121,15 @@ void ConstraintSystem::dump() {
}

void ConstraintSystem::dump(Expr *E) {
auto getTypeOfExpr = [&](const Expr *E) -> Type { return getType(E); };
auto getTypeOfExpr = [&](const Expr *E) -> Type {
if (hasType(E))
return getType(E);
return Type();
};
auto getTypeOfTypeLoc = [&](const TypeLoc &TL) -> Type {
return getType(TL);
if (hasType(TL))
return getType(TL);
return Type();
};

E->dump(getTypeOfExpr, getTypeOfTypeLoc);
Expand Down

0 comments on commit 0ae61f6

Please sign in to comment.