[PATCH] D93938: [clang-format] Fixed AfterEnum handling

Ally Tiritoglu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 15 08:10:38 PDT 2021


atirit added inline comments.


================
Comment at: clang/lib/Format/TokenAnnotator.cpp:3683
+        Style.BraceWrapping.AfterEnum;
+    bool isLineTooBig = (strlen(Right.TokenText.data()) +
+                         Right.OriginalColumn) > Style.ColumnLimit;
----------------
curdeius wrote:
> strlen? Please use `StringRef::size()`.
For `FormatToken.TokenText`, `StringRef::size()` is set to the length of the token, not of the stored text. Please see `clang/lib/Format/FormatTokenLexer.cpp:1047`. Changing that line breaks nearly every format test so I'm assuming that it is correct. A `strlen` or equivalent is necessary here.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D93938/new/

https://reviews.llvm.org/D93938



More information about the cfe-commits mailing list