-
Notifications
You must be signed in to change notification settings - Fork 158
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
C: Support generics #1455
C: Support generics #1455
Conversation
@@ -516,6 +516,9 @@ class ASRToCVisitor : public BaseCCPPVisitor<ASRToCVisitor> | |||
sub = format_type_c("", "const " + const_underlying_type + " ", | |||
v.m_name, false, false); | |||
} | |||
} else if (ASR::is_a<ASR::TypeParameter_t>(*v_m_type)) { |
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.
If I am not wrong backend shouldn't need to care if there are any generics in the frontend? The code for each type combination should be generated by the instantiate_template
pass? Correct @certik?
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.
Yes, everything should be already instantiated, so the generics should work in all backends, no special logic needed.
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.
So this PR should never have been needed. @Smit-create Can you check what's there in ASR which is causing you to handle generics in C backend? I guess ASR is not correct that's why you created this PR for C backend.
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.
Opened an issue for it's discussion: #1471
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.
As per the discussion in #1471, the current ASR is fine and this diff fixes the codegen of generics in C backend.
Converted to a Draft for now. |
4a2c8e4
to
a0fc29d
Compare
No description provided.