[IRGen] Eliminate infinite loop in keypath generation.

Uncovered by the investigation of rdar://problem/45685649.
This commit is contained in:
Doug Gregor
2018-11-06 14:59:07 -08:00
parent 37406e84d3
commit fd3c914ecf
2 changed files with 16 additions and 1 deletions

View File

@@ -728,7 +728,7 @@ emitWitnessTableGeneratorForKeyPath(IRGenModule &IGM,
static unsigned getClassFieldIndex(ClassDecl *classDecl, VarDecl *property) {
SmallVector<ClassDecl *, 3> superclasses;
for (auto *superDecl = classDecl; superDecl != nullptr;
superDecl = classDecl->getSuperclassDecl()) {
superDecl = superDecl->getSuperclassDecl()) {
superclasses.push_back(superDecl);
}