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] Unrelated declarations are aligned with Cpp11BracedListStyle: false #53699

Open
mkurdej opened this issue Feb 10, 2022 · 2 comments
Labels
bug Indicates an unexpected problem or unintended behavior clang-format

Comments

@mkurdej
Copy link
Member

mkurdej commented Feb 10, 2022

Found when fixing #44292.

Given config:

BasedOnStyle: LLVM
AlignConsecutiveDeclarations: true
Cpp11BracedListStyle: false

this already formatted code:

const volatile auto result{ []() {
  const auto something = 1;
  return 2;
} };

gets incorrectly formatted to:

const volatile auto result{ []() {
  const auto        something = 1;
  return 2;
} };

That seems to be caused by the fact that with Cpp11BracedListStyle: false, we do not add an indent level, and so the declarations of result and something are considered to be at the same level and hence aligned.

@mkurdej mkurdej added bug Indicates an unexpected problem or unintended behavior clang-format labels Feb 10, 2022
@llvmbot
Copy link
Collaborator

llvmbot commented Feb 10, 2022

@llvm/issue-subscribers-clang-format

@llvmbot
Copy link
Collaborator

llvmbot commented Feb 10, 2022

@llvm/issue-subscribers-bug

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Indicates an unexpected problem or unintended behavior clang-format
Projects
None yet
Development

No branches or pull requests

2 participants