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

Allow constructing PassRepeated from a PassManager #4319

Merged
merged 1 commit into from
Jan 5, 2024

Conversation

vlstill
Copy link
Contributor

@vlstill vlstill commented Jan 5, 2024

... and add explicit to the constructors that could be accidentally invoced by implicit casts otherwise

@vlstill vlstill added the core Topics concerning the core segments of the compiler (frontend, midend, parser) label Jan 5, 2024
@vlstill vlstill self-assigned this Jan 5, 2024
and add `explicit` to the constructors that could be accidentally invoced by implicit casts otherwise
Copy link
Contributor

@grg grg left a comment

Choose a reason for hiding this comment

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

LGTM.

Is the explicit to prevent accidental casts on the repeats argument? Or are there cases where an accidental cast could occur on the first argument? (Can something be cast to a PassManager?)

@vlstill
Copy link
Contributor Author

vlstill commented Jan 5, 2024

Is the explicit to prevent accidental casts on the repeats argument? Or are there cases where an accidental cast could occur on the first argument? (Can something be cast to a PassManager?)

It is the first argument. Any non-explicit constructor that can be called with a single argument can be used for explicit cast. So the new constructor would introduce cast from PassManager to PassRepeated, while the original had introduced cast from initializer list to PassRepeated. There are probably more in the compiler and it would be best to use clang-tidy to check and fix these.

@vlstill vlstill merged commit fa4cc97 into p4lang:main Jan 5, 2024
13 checks passed
@vlstill vlstill deleted the pass-repeated-ctor branch January 5, 2024 16:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Topics concerning the core segments of the compiler (frontend, midend, parser)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants