[PATCH] D124260: [clang-format] ColumnLimit check for trailing comments alignment acts wrong for multi-byte UTF-8 #47624
Александр Тулуп via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Apr 22 07:20:32 PDT 2022
StailGot created this revision.
StailGot added a project: clang-format.
Herald added a project: All.
StailGot requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
Fix for https://github.com/llvm/llvm-project/issues/47624
Used token for counting length instead of logical symbols.
That leads to wrong length count with utf8 symbols
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D124260
Files:
clang/lib/Format/WhitespaceManager.cpp
Index: clang/lib/Format/WhitespaceManager.cpp
===================================================================
--- clang/lib/Format/WhitespaceManager.cpp
+++ clang/lib/Format/WhitespaceManager.cpp
@@ -909,8 +909,8 @@
if (Style.ColumnLimit == 0)
ChangeMaxColumn = UINT_MAX;
- else if (Style.ColumnLimit >= Changes[i].TokenLength)
- ChangeMaxColumn = Style.ColumnLimit - Changes[i].TokenLength;
+ else if (Style.ColumnLimit >= Changes[i].Tok->ColumnWidth)
+ ChangeMaxColumn = Style.ColumnLimit - Changes[i].Tok->ColumnWidth;
else
ChangeMaxColumn = ChangeMinColumn;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D124260.424466.patch
Type: text/x-patch
Size: 610 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220422/f29d34c7/attachment.bin>
More information about the cfe-commits
mailing list