Navigation Menu

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

PointerAlignment: Right interaction with AlignConsecutiveDeclarations #27727

Closed
llvmbot opened this issue Apr 14, 2016 · 5 comments
Closed

PointerAlignment: Right interaction with AlignConsecutiveDeclarations #27727

llvmbot opened this issue Apr 14, 2016 · 5 comments
Labels
bugzilla Issues migrated from bugzilla clang-format

Comments

@llvmbot
Copy link
Collaborator

llvmbot commented Apr 14, 2016

Bugzilla Link 27353
Version trunk
OS All
Reporter LLVM Bugzilla Contributor
CC @mkurdej

Extended Description

Repro:

$ cat sample.c
int* a;
unsigned long long x;
double* b;
$ clang-format -style="{PointerAlignment: Right, AlignConsecutiveDeclarations: true}" sample.c
int *              a;
unsigned long long x;
double *           b;

Expected/desired output is:

int                *a;
unsigned long long  x;
double             *b;
@llvmbot
Copy link
Collaborator Author

llvmbot commented Dec 11, 2017

+1

I'd like to get this fixed as well.

With current implementation, AlignConsecutiveDeclarations breaks PointerAlignment.

@llvmbot
Copy link
Collaborator Author

llvmbot commented Aug 13, 2018

In the code (clang/lib/Format/WhitespaceManager.cpp:449) contains a comment about this. It states it is unclear how

  const char* const* v1;
  float const* v2;
  SomeVeryLongType const& v3;

should be aligned. Does everyone agree that

  const char *const      *v1;
  float const            *v2;
  SomeVeryLongType const &v3;

is correct?

Or does anyone want:

const char *const *v1;

Or something else?

@llvmbot
Copy link
Collaborator Author

llvmbot commented Aug 15, 2018

Addressed by https://reviews.llvm.org/D27651

@mkurdej
Copy link
Member

mkurdej commented May 28, 2021

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

Close by 3e333cc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla clang-format
Projects
None yet
Development

No branches or pull requests

3 participants