Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SIL: Verify kinds of vtable entries. #32171

Merged
merged 1 commit into from
Jun 4, 2020

Conversation

jckarter
Copy link
Contributor

@jckarter jckarter commented Jun 3, 2020

Validate that inherited entries are not left at "normal" state, and that non-overridden entries do not in fact have overrides.

Validate that inherited entries are not left at "normal" state, and that non-overridden entries do not in fact have
overrides.
@jckarter
Copy link
Contributor Author

jckarter commented Jun 3, 2020

@swift-ci Please test

validKind = false;
break;
}
assert(validKind && "vtable entry in root class must not be inherited or override");
Copy link
Contributor

@gottesmm gottesmm Jun 4, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

continue and eliminate the else? E.x.:

if (...) {
   assert(validKind, ...)
   continue;
}

if (superVTable) {
   ...
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason why I am suggesting this is that it makes it clearer that the if statement will never cause any code beneath it to be evaluated. Without this, I have to scan after the else if to see if that code may be run after the first if completes. In contrast, with the early continue like this I now have a nice invariant I can use when scanning the code below. Take it or leave it ; ).

@jckarter jckarter merged commit 9a61985 into swiftlang:master Jun 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants