[PATCH] D120503: [clang-format] Handle trailing comment for InsertBraces

Owen Pan via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 24 16:19:59 PST 2022


owenpan added inline comments.


================
Comment at: clang/lib/Format/UnwrappedLineParser.cpp:2340-2341
       if (!L.InPPDirective) {
         Tok = getLastNonComment(L);
-        if (Tok)
+        if (Tok) {
+          Tok = L.Tokens.back().Tok;
----------------
HazardyKnusperkeks wrote:
> So basically one would just need a `Line.isComment()` or so? The `lastNonComment` is not important, right?
We don't really need a pointer to the last non-comment token here as we would return the last token of the line, but the pointer is still needed for the left brace above.


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

https://reviews.llvm.org/D120503



More information about the cfe-commits mailing list