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 aligns "=" of "operator=" with "= deleted" if copy assignment operator is deleted #33044

Closed
llvmbot opened this issue Jul 6, 2017 · 5 comments
Labels
bug Indicates an unexpected problem or unintended behavior bugzilla Issues migrated from bugzilla clang-format good first issue https://github.com/llvm/llvm-project/contribute

Comments

@llvmbot
Copy link
Collaborator

llvmbot commented Jul 6, 2017

Bugzilla Link 33697
Version 4.0
OS Windows NT
Attachments clang-format configuration file, Example output file
Reporter LLVM Bugzilla Contributor
CC @ts826848

Extended Description

If a long class name leads to a line break within the declaration of a deleted copy assignment operator the “=” sign of "operator=" is aligned with the “=” of the “= delete”. The following section shows the formatted output:

ExampleFile.hxx

class SomeClassWithARatherLongNameWhichBreaksTheColumnLimit
{
public:
  SomeClassWithARatherLongNameWhichBreaksTheColumnLimit();
  virtual ~SomeClassWithARatherLongNameWhichBreaksTheColumnLimit();

private:
  SomeClassWithARatherLongNameWhichBreaksTheColumnLimit(
      const SomeClassWithARatherLongNameWhichBreaksTheColumnLimit& other) = delete;
  SomeClassWithARatherLongNameWhichBreaksTheColumnLimit& operator         =(
      const SomeClassWithARatherLongNameWhichBreaksTheColumnLimit& other) = delete;
};

Attached you find the clang-format configuration file we used for formatting.

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 10, 2021
@mydeveloperday
Copy link
Contributor

I can confirm as of clang-format 13 this is still an issue

@mydeveloperday mydeveloperday added the good first issue https://github.com/llvm/llvm-project/contribute label Dec 13, 2021
@mkurdej
Copy link
Member

mkurdej commented Jan 10, 2022

Possible duplicate of #31568.

@mkurdej mkurdej added the bug Indicates an unexpected problem or unintended behavior label Jan 10, 2022
@llvmbot
Copy link
Collaborator Author

llvmbot commented Jan 10, 2022

@llvm/issue-subscribers-bug

@glotchimo
Copy link
Contributor

glotchimo commented Jan 17, 2022

After investigating, the patch for #31568 does not address this, presumably due to wrapping being handled outside of WhitespaceManager::alignConsecutiveAssignments.

mkurdej added a commit that referenced this issue Jan 20, 2022
Also, add test case from #33044.
This was actually fixed in 480a1fa, but there were no tests for delete.
@mkurdej
Copy link
Member

mkurdej commented Jan 20, 2022

Actually, commit 480a1fa fixed this issue.
Added tests in commit 794b1ee.

@mkurdej mkurdej closed this as completed Jan 20, 2022
mem-frob pushed a commit to draperlaboratory/hope-llvm-project that referenced this issue Oct 7, 2022
Also, add test case from llvm/llvm-project#33044.
This was actually fixed in llvm/llvm-project@480a1fa, but there were no tests for delete.
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 bugzilla Issues migrated from bugzilla clang-format good first issue https://github.com/llvm/llvm-project/contribute
Projects
None yet
Development

No branches or pull requests

4 participants