[PATCH] D120217: [clang-format] Add an option to insert braces after control statements

Owen Pan via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Feb 20 21:27:34 PST 2022


owenpan added inline comments.


================
Comment at: clang/lib/Format/UnwrappedLineParser.cpp:2303
+static FormatToken *getLastNonComment(const UnwrappedLine &Line) {
+  for (const auto &Token : llvm::reverse(Line.Tokens))
+    if (Token.Tok->isNot(tok::comment))
----------------
HazardyKnusperkeks wrote:
> Get the last token, and if it's a comment `getPreviousNonComment()`?
Almost. I tried to use `getPreviousNonComment()` but sometimes got `nullptr` when a nonnull was always expected (line 2316).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D120217



More information about the cfe-commits mailing list