Fix formatting for short function blocks#4878
Open
pfultz2 wants to merge 2 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the repository’s .clang-format configuration to work around a clang-format regression affecting short blocks, and then re-applies formatting across multiple headers/source files so short one-line blocks are expanded into multi-line blocks consistently.
Changes:
- Update
.clang-formatto setAllowShortBlocksOnASingleLine: Empty. - Reformat many short forwarding/wrapper functions from single-line
{ ... }to multi-line blocks across type-erased interfaces and API helpers.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
src/include/migraphx/target.hpp |
Reformats short helper/wrapper bodies and several type-erased forwarding overrides. |
src/include/migraphx/stream_model.hpp |
Reformats type-erased forwarding overrides into multi-line blocks. |
src/include/migraphx/schedule_model.hpp |
Reformats type-erased forwarding overrides into multi-line blocks. |
src/include/migraphx/pass.hpp |
Reformats short apply wrappers and type-erased forwarding overrides. |
src/include/migraphx/operation.hpp |
Reformats many short helper functions and type-erased forwarding overrides. |
src/include/migraphx/marker.hpp |
Reformats type-erased forwarding overrides into multi-line blocks. |
src/include/migraphx/context.hpp |
Reformats short context helpers and type-erased forwarding overrides. |
src/include/migraphx/concat_opt.hpp |
Reformats type-erased forwarding overrides into multi-line blocks. |
src/include/migraphx/allocation_model.hpp |
Reformats type-erased forwarding overrides into multi-line blocks. |
src/api/api.cpp |
Reformats several small helper functions and a custom op wrapper to multi-line blocks. |
.clang-format |
Changes short-block formatting behavior to mitigate a clang-format regression. |
Comment on lines
417
to
+421
| std::vector<pass> get_passes(context& ctx, const compile_options& options) const override | ||
| { return private_detail_te_value.get_passes(ctx, options); } | ||
| { | ||
|
|
||
| return private_detail_te_value.get_passes(ctx, options); | ||
| } |
Comment on lines
291
to
+295
| void apply(module_pass_manager& mpm) const override | ||
| { private_detail_te_default_apply(char(0), private_detail_te_value, mpm); } | ||
| { | ||
|
|
||
| private_detail_te_default_apply(char(0), private_detail_te_value, mpm); | ||
| } |
Comment on lines
275
to
+279
| std::size_t get_stream(instruction_ref ins) const override | ||
| { return private_detail_te_value.get_stream(ins); } | ||
| { | ||
|
|
||
| return private_detail_te_value.get_stream(ins); | ||
| } |
Comment on lines
268
to
+272
| void sched(module& m, instruction_ref ins, std::size_t n) const override | ||
| { private_detail_te_value.sched(m, ins, n); } | ||
| { | ||
|
|
||
| private_detail_te_value.sched(m, ins, n); | ||
| } |
| void mark_start(instruction_ref ins_ref) override | ||
| { private_detail_te_value.mark_start(ins_ref); } | ||
| { | ||
|
|
Comment on lines
358
to
+362
| value to_value() const override | ||
| { return private_detail_te_default_to_value(char(0), private_detail_te_value); } | ||
| { | ||
|
|
||
| return private_detail_te_default_to_value(char(0), private_detail_te_value); | ||
| } |
Comment on lines
262
to
+266
| optional<op::concat> get_concat(const operation& op) const override | ||
| { return private_detail_te_value.get_concat(op); } | ||
| { | ||
|
|
||
| return private_detail_te_value.get_concat(op); | ||
| } |
Comment on lines
262
to
+266
| operation allocate(const shape& s) const override | ||
| { return private_detail_te_value.allocate(s); } | ||
| { | ||
|
|
||
| return private_detail_te_value.allocate(s); | ||
| } |
Comment on lines
1206
to
+1210
| bool is_context_free() const override | ||
| { return private_detail_te_default_is_context_free(char(0), private_detail_te_value); } | ||
| { | ||
|
|
||
| return private_detail_te_default_is_context_free(char(0), private_detail_te_value); | ||
| } |
| @@ -323,31 +361,43 @@ struct custom_operation | |||
|
|
|||
causten
approved these changes
May 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
There seems to be a bug with the latest clang format with #187993 and #183705 where the
AllowShortBlocksOnASingleLineputs the block on a seperate line(where it should be the same line)Technical Details
As a workaround setting
AllowShortBlocksOnASingleLinetoEmptyseems to help.Changelog Category
Add a
CHANGELOG.mdentry for any option other thanNot Applicable