Skip to content

Commit c66de77

Browse files
committed
SILGen: Avoid needless walk up ancestor chain of imported class
1 parent bec666c commit c66de77

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

lib/SILGen/SILGenType.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -262,10 +262,6 @@ class SILGenVTable : public SILVTableVisitor<SILGenVTable> {
262262
void emitVTable() {
263263
PrettyStackTraceDecl("silgen emitVTable", theClass);
264264

265-
// Imported types don't have vtables right now.
266-
if (theClass->hasClangNode())
267-
return;
268-
269265
// Populate our list of base methods and overrides.
270266
visitAncestor(theClass);
271267

@@ -317,6 +313,10 @@ class SILGenVTable : public SILVTableVisitor<SILGenVTable> {
317313
}
318314

319315
void visitAncestor(ClassDecl *ancestor) {
316+
// Imported types don't have vtables right now.
317+
if (ancestor->hasClangNode())
318+
return;
319+
320320
auto *superDecl = ancestor->getSuperclassDecl();
321321
if (superDecl)
322322
visitAncestor(superDecl);
@@ -1153,8 +1153,10 @@ class SILGenType : public TypeMemberVisitor<SILGenType> {
11531153

11541154
// Build a vtable if this is a class.
11551155
if (auto theClass = dyn_cast<ClassDecl>(theType)) {
1156-
SILGenVTable genVTable(SGM, theClass);
1157-
genVTable.emitVTable();
1156+
if (!theClass->hasClangNode()) {
1157+
SILGenVTable genVTable(SGM, theClass);
1158+
genVTable.emitVTable();
1159+
}
11581160
}
11591161

11601162
// If this is a nominal type that is move only, emit a deinit table for it.

0 commit comments

Comments
 (0)