-
Notifications
You must be signed in to change notification settings - Fork 14.7k
Closed
Labels
bugIndicates an unexpected problem or unintended behaviorIndicates an unexpected problem or unintended behaviorbugzillaIssues migrated from bugzillaIssues migrated from bugzillaclang-formatconfirmedVerified by a second partyVerified by a second party
Description
Bugzilla Link | 38357 |
Version | trunk |
OS | All |
Extended Description
AlignConsecutiveDeclarations in formatter (and possibly several other options depending on WhiteSpaceFormatter) fail to format the following example properly.
Language: Cpp
BasedOnStyle: LLVM
ColumnLimit: 100
AlignConsecutiveDeclarations: true
typedef struct {
int *a; // ААААААААААААААААААААААААААААААААААААААААААААА
unsigned char *b; // ААААААААААААААААААААААААААААААААААААААААААААА
char c; // ААААААААААААААААААААААААААААААААААААААААААААА
unsigned long long d; //
long double e; //
} s;
The expected output is as follows:
typedef struct {
int * a; // ААААААААААААААААААААААААААААААААААААААААААААА
unsigned char * b; // ААААААААААААААААААААААААААААААААААААААААААААА
char c; // ААААААААААААААААААААААААААААААААААААААААААААА
unsigned long long d; //
long double e; //
} s;
Yet the resulting output is exactly the same as the input above. Formatter works fine when latin-only characters are used.
typedef struct {
int * a; // AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
unsigned char * b; // AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
char c; // AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
unsigned long long d; //
long double e; //
} s;
It seems that WhitespaceManager::Change relies on TokenLength (which is the length in bytes) and is not aware of the actual column width obtained by e.g. encoding::columnWidth.
The issue is present at least in 6.0 and onwards.
Metadata
Metadata
Assignees
Labels
bugIndicates an unexpected problem or unintended behaviorIndicates an unexpected problem or unintended behaviorbugzillaIssues migrated from bugzillaIssues migrated from bugzillaclang-formatconfirmedVerified by a second partyVerified by a second party