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

C: Support generics #1455

Merged
merged 2 commits into from
Feb 13, 2023
Merged

C: Support generics #1455

merged 2 commits into from
Feb 13, 2023

Conversation

Smit-create
Copy link
Collaborator

No description provided.

@Smit-create Smit-create added the c Label for C language related changes label Jan 24, 2023
@Smit-create Smit-create marked this pull request as ready for review January 24, 2023 11:55
@@ -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)) {
Copy link
Collaborator

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?

Copy link
Contributor

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.

Copy link
Collaborator

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.

Copy link
Collaborator Author

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

Copy link
Collaborator Author

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.

@certik
Copy link
Contributor

certik commented Jan 27, 2023

Converted to a Draft for now.

@Smit-create Smit-create marked this pull request as ready for review February 13, 2023 11:04
@Smit-create Smit-create added the ready for review PRs that are ready for review label Feb 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c Label for C language related changes ready for review PRs that are ready for review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants