Skip to content
This repository has been archived by the owner. It is now read-only.

PointerAlignment: Right interaction with AlignConsecutiveDeclarations #27353

Open
llvmbot opened this issue Apr 14, 2016 · 4 comments
Open

PointerAlignment: Right interaction with AlignConsecutiveDeclarations #27353

llvmbot opened this issue Apr 14, 2016 · 4 comments

Comments

@llvmbot
Copy link
Collaborator

@llvmbot 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 llvmbot commented Dec 11, 2017

+1

I'd like to get this fixed as well.

With current implementation, AlignConsecutiveDeclarations breaks PointerAlignment.

Loading

@llvmbot
Copy link
Collaborator Author

@llvmbot 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?

Loading

@llvmbot
Copy link
Collaborator Author

@llvmbot llvmbot commented Aug 15, 2018

Loading

@mkurdej
Copy link
Member

@mkurdej mkurdej commented May 28, 2021

Loading

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants