Skip to content

clang-format over breaking near "new" expressions #105133

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

Closed
kadircet opened this issue Aug 20, 2024 · 3 comments · Fixed by #105168
Closed

clang-format over breaking near "new" expressions #105133

kadircet opened this issue Aug 20, 2024 · 3 comments · Fixed by #105168

Comments

@kadircet
Copy link
Member

foo.cc:

fooooooooooo(new BARRRRRRRRR(
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXZZZZZZZZZZZZZZZZZZZZZZZZZ()));

Expected:

$ ../llvm/build/bin/clang-format -style='{AlignAfterOpenBracket: AlwaysBreak}' foo.cc
fooooooooooo(new BARRRRRRRRR(
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXZZZZZZZZZZZZZZZZZZZZZZZZZ()));

Actual:

$ ../llvm/build/bin/clang-format -style='{AlignAfterOpenBracket: AlwaysBreak}' foo.cc
fooooooooooo(
    new BARRRRRRRRR(
        XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXZZZZZZZZZZZZZZZZZZZZZZZZZ()));
@kadircet
Copy link
Member Author

ccae7b4 seems to be the culprit

@kadircet
Copy link
Member Author

@kadircet
Copy link
Member Author

put together #105168 as a possible fix

kadircet added a commit to kadircet/llvm-project that referenced this issue Aug 20, 2024
ccae7b4 improved handling for nested
calls, but this resulted in a lot of changes near `new` expressions.

This patch tries to restore previous behavior around new expressions, by
treating them as simple functions, which seem to align with the concept.

Fixes llvm#105133.
kadircet added a commit to kadircet/llvm-project that referenced this issue Aug 22, 2024
ccae7b4 improved handling for nested
calls, but this resulted in a lot of changes near `new` expressions.

This patch tries to restore previous behavior around new expressions, by
treating them as simple functions, which seem to align with the concept.

Fixes llvm#105133.
kadircet added a commit to kadircet/llvm-project that referenced this issue Aug 23, 2024
ccae7b4 improved handling for nested
calls, but this resulted in a lot of changes near `new` expressions.

This patch tries to restore previous behavior around new expressions, by
treating them as simple functions, which seem to align with the concept.

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

Successfully merging a pull request may close this issue.

1 participant