Skip to content

Fix formatting for short function blocks#4878

Open
pfultz2 wants to merge 2 commits into
developfrom
format-allow-short-blocks
Open

Fix formatting for short function blocks#4878
pfultz2 wants to merge 2 commits into
developfrom
format-allow-short-blocks

Conversation

@pfultz2
Copy link
Copy Markdown
Collaborator

@pfultz2 pfultz2 commented May 12, 2026

Motivation

There seems to be a bug with the latest clang format with #187993 and #183705 where the AllowShortBlocksOnASingleLine puts the block on a seperate line(where it should be the same line)

Technical Details

As a workaround setting AllowShortBlocksOnASingleLine to Empty seems to help.

Changelog Category

Add a CHANGELOG.md entry for any option other than Not Applicable

    • Added: New functionality.
    • Changed: Changes to existing functionality.
    • Removed: Functionality or support that has been removed. (Compared to a previous release)
    • Optimized: Component performance that has been optimized or improved.
    • Resolved Issues: Known issues from a previous version that have been resolved.
    • Not Applicable: This PR is not to be included in the changelog.

@pfultz2 pfultz2 requested a review from causten as a code owner May 12, 2026 22:15
Copilot AI review requested due to automatic review settings May 12, 2026 22:15
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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-format to set AllowShortBlocksOnASingleLine: 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);
}
Comment thread src/api/api.cpp
@@ -323,31 +361,43 @@ struct custom_operation

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

Successfully merging this pull request may close these issues.

3 participants