-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[IRGen] Add getEnumTag and injectEnumTag builtins #70327
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
Conversation
@swift-ci please test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm!
@@ -1968,6 +1968,26 @@ static ValueDecl *getPackLength(ASTContext &ctx, Identifier id) { | |||
return builder.build(id); | |||
} | |||
|
|||
static ValueDecl *getGetEnumTag(ASTContext &ctx, Identifier id) { | |||
BuiltinFunctionBuilder builder(ctx, /* genericParamCount */ 1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be nice to use the getBuiltinFunction infrastructure here.
@swift-ci please test |
4f8dc15
to
0ed4a19
Compare
@swift-ci please test |
@swift-ci please test Linux |
1 similar comment
@swift-ci please test Linux |
This adds 2 new builtins, one that calls the getEnumTag vwt function on a generic type and another that injects the given tag into some generic value. These are unsafe operations that assume the value passed in as
T
is an enum type.