<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - Formatter's WhitespaceManager does not measure unicode column width"
href="https://bugs.llvm.org/show_bug.cgi?id=38357">38357</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Formatter's WhitespaceManager does not measure unicode column width
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>All
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Formatter
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>vit9696@avp.su
</td>
</tr>
<tr>
<th>CC</th>
<td>djasper@google.com, klimek@google.com, llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>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.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>