[llvm-bugs] [Bug 38357] New: Formatter's WhitespaceManager does not measure unicode column width
via llvm-bugs
llvm-bugs at lists.llvm.org
Sun Jul 29 22:44:15 PDT 2018
https://bugs.llvm.org/show_bug.cgi?id=38357
Bug ID: 38357
Summary: Formatter's WhitespaceManager does not measure unicode
column width
Product: clang
Version: trunk
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P
Component: Formatter
Assignee: unassignedclangbugs at nondot.org
Reporter: vit9696 at avp.su
CC: djasper at google.com, klimek at google.com,
llvm-bugs at lists.llvm.org
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.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20180730/5f1585db/attachment.html>
More information about the llvm-bugs
mailing list