Skip to content

[clang-format] AllowShortFunctionsOnASingleLine=Inline does not respect macros #133089

Closed
@rafzi

Description

@rafzi

I stumbled upon #60627 which describes this same issue. Over there, the conclusion seems to be wont-fix because the intention of the related change (https://reviews.llvm.org/D117142) was to fix exactly the reported case.

However, I'd argue that a slight modification to the example is an unintended regression. If macros hide the "class" token, the scope is not correctly detected.

#define MY_THING(name) class name##Thing final
MY_THING(Foo)
{
    int func() { return 7; }
}

is formatted to:

#define MY_THING(name) class name##Thing final
MY_THING(Foo)
{
    int func()
    {
        return 7;
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    clang-formatquestionA question, not bug report. Check out https://llvm.org/docs/GettingInvolved.html instead!

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions