Skip to content

Make the TranslationUnitPass have a Generator property instead of a BindingContext #1757

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

Closed
deadlocklogic opened this issue Aug 3, 2023 · 3 comments
Assignees

Comments

@deadlocklogic
Copy link
Contributor

I am working on a generator which contains data usable in my custom passes.
Wouldn't be optimal to pass a Generator to the TranslationUnitPass instead of a BindingContext.
Otherwise I am only able to share data via the DriverOptions and since the data is computed/modified by previous passes, it does not really fit in options.
I am not implying refactoring, but it should be a cleaner way to allow each generator to have its own data/options etc...

@deadlocklogic
Copy link
Contributor Author

Maybe I have to roll my own Pass which depends on a Generator and setup the whole thing myself.
Right?

@tritao
Copy link
Collaborator

tritao commented Aug 3, 2023

Wouldn't be optimal to pass a Generator to the TranslationUnitPass instead of a BindingContext.

This could work, not sure if I would say its optimal though, as it's better IMHO for passes to try to be as generator-independent as possible. Most passes do not need a reference to the generator.

But there should be a way to do what you need, I was thinking maybe we could add the current generator to BindingContext.

Or maybe add a new GeneratorSpecificPass that can get a Generator property automatically set before running it?

You think either of those could be a good enough solution?

@deadlocklogic
Copy link
Contributor Author

deadlocklogic commented Aug 3, 2023

Or maybe add a new GeneratorSpecificPass that can get a Generator property automatically set before running it?

You think either of those could be a good enough solution?

This is what I am considering.

Feel free to close this issue.

@tritao tritao self-assigned this Aug 16, 2023
@tritao tritao closed this as completed Sep 30, 2023
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

No branches or pull requests

2 participants