Skip to content
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

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

Open
rafzi opened this issue Mar 26, 2025 · 1 comment
Open

Comments

@rafzi
Copy link
Member

rafzi commented Mar 26, 2025

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;
    }
}
@llvmbot
Copy link
Member

llvmbot commented Mar 26, 2025

@llvm/issue-subscribers-clang-format

Author: Rafael Stahl (rafzi)

I stumbled upon https://github.com//issues/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;
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants