-
Notifications
You must be signed in to change notification settings - Fork 457
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 extending ToP4, clean its constructors #4899
Conversation
82ccc21
to
81ce8f4
Compare
We'd probably go with some value-based semantics here. But it seems pretty heavyweight for a task. And essentially the same wrapped smart pointer. :) |
frontends/common/parser_options.cpp
Outdated
@@ -472,8 +472,8 @@ static std::filesystem::path makeFileName(const std::filesystem::path &folder, | |||
|
|||
bool ParserOptions::isv1() const { return langVersion == ParserOptions::FrontendVersion::P4_14; } | |||
|
|||
void ParserOptions::dumpPass(const char *manager, unsigned seq, const char *pass, | |||
const IR::Node *node) const { | |||
void ParserOptions::dumpPass(ToP4Factory toP4Fact, const char *manager, unsigned seq, |
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.
Make this a virtual function of the options that returns the appropriate ToP4 instance? E.g., ToP4 * toP4Printer()
. Then you can also change the priner with the options you are using.
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.
Good idea. I left the unique_ptr
there as I think we should not rely on GC especially in the places where the memory management is very straight-forward
Signed-off-by: Vladimir Still <[email protected]>
Signed-off-by: Vladimir Still <[email protected]>
Signed-off-by: Vladimir Still <[email protected]>
Signed-off-by: Vladimir Still <[email protected]>
81ce8f4
to
41e4bf0
Compare
Signed-off-by: Vladimir Still <[email protected]>
41e4bf0
to
3c78563
Compare
Signed-off-by: Vladimír Štill <[email protected]>
cstring
argument inToP4
withstd::filesystem::path
. This is the breaking change.ParserOptions
with a descendant ofToP4
-- the way I did this is not exactly nice, but I don't see other clear way to create the instance on demand.ToP4
pass is a good candidate for larger refactoring, but I don't have time for that now.