First proposal of improvements on C++ generator#1065
Conversation
|
Initial discussion : @pramodk @ohm314 Stack approach to manipulate code blocks
Rework CodePrinter::add_lineThe change allows the method to essentially work like the Python standard library function textwrap.dedent Remove trivial
|
|
@tristan0x: suggestions look fine to me! (as mentioned elsewhere, we would like to make it easy to understand/develop/contribute by external users/devs) |
|
(Bear with me until I look in detail at the changes but) overall I agree with the suggestions. |
ohm314
left a comment
There was a problem hiding this comment.
Alright, I did a pass. I really like the changes. Had just some minor comments.
87e724f to
453cc1a
Compare
This comment has been minimized.
This comment has been minimized.
c4e7fce to
97dab1e
Compare
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## master #1065 +/- ##
==========================================
+ Coverage 69.94% 70.19% +0.24%
==========================================
Files 188 188
Lines 25647 25632 -15
==========================================
+ Hits 17939 17992 +53
+ Misses 7708 7640 -68
☔ View full report in Codecov by Sentry. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
6adfd7b to
5eb5a81
Compare
This comment has been minimized.
This comment has been minimized.
* reduce number of copies * `CodePrinter::add_text`: * now supports multiple arguments * use it instead of trivial but expensive call to `fmt::format`. * `CodePrinter::add_multi_line`: * rework to work with C++ raw string literals * used it instead of 3 or more consecutive `add_line` * `CodePrinter::start_block`: rename to `push_block` * `CodePrinter::end_block`: rename to pop_block
5eb5a81 to
0e59bd4
Compare
This comment has been minimized.
This comment has been minimized.
Co-authored-by: Nicolas Cornu <nicolas.cornu@epfl.ch>
This comment has been minimized.
This comment has been minimized.
iomaganaris
left a comment
There was a problem hiding this comment.
LGTM overall. Some small suggestions
Co-authored-by: Ioannis Magkanaris <iomagkanaris@gmail.com>
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
Logfiles from GitLab pipeline #154642 (:white_check_mark:) have been uploaded here! Status and direct links: |
|
Sorry, I was too late to notice comment. But I guess this has resolved somehow 👍 |
* First proposal of improvements on C++ generator * reduce number of copies * `CodePrinter::add_text`: * now supports multiple arguments * use it instead of trivial but expensive call to `fmt::format`. * `CodePrinter::add_multi_line`: * rework to work with C++ raw string literals * used it instead of 3 or more consecutive `add_line` * `CodePrinter::start_block`: rename to `push_block` * `CodePrinter::end_block`: rename to pop_block * CodegenCppVisitor::visit_program more visible * Try removing python3-importlib-metadata Co-authored-by: Nicolas Cornu <nicolas.cornu@epfl.ch> Co-authored-by: Ioannis Magkanaris <iomagkanaris@gmail.com> Co-authored-by: Erik Heeren <erik.heeren@epfl.ch>
* First proposal of improvements on C++ generator * reduce number of copies * `CodePrinter::add_text`: * now supports multiple arguments * use it instead of trivial but expensive call to `fmt::format`. * `CodePrinter::add_multi_line`: * rework to work with C++ raw string literals * used it instead of 3 or more consecutive `add_line` * `CodePrinter::start_block`: rename to `push_block` * `CodePrinter::end_block`: rename to pop_block * CodegenCppVisitor::visit_program more visible * Try removing python3-importlib-metadata Co-authored-by: Nicolas Cornu <nicolas.cornu@epfl.ch> Co-authored-by: Ioannis Magkanaris <iomagkanaris@gmail.com> Co-authored-by: Erik Heeren <erik.heeren@epfl.ch> NMODL Repo SHA: BlueBrain/nmodl@4a6d511
CodePrinter::add_text:fmt::format.CodePrinter::add_multi_line:add_lineCodePrinter::start_block: rename topush_blockCodePrinter::end_block: rename to pop_blockCodePrinter::chain_block: rename to chain_block