[PATCH] D80940: [clang-format] [PR46159] Linux kernel 'C' code uses 'try' as a variable name, allow clang-format to handle such cases

Marek Kurdej via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 3 05:27:41 PDT 2020


curdeius added a comment.

Nice. Should we test other non-C keywords as well?
Out of curiosity, where does "@try" come from?



================
Comment at: clang/lib/Format/FormatTokenLexer.cpp:392
+  auto &Try = *(Tokens.end() - 2);
+  auto &Brace = *(Tokens.end() - 1);
+  if (!Try->is(tok::kw_try))
----------------
Please rename to something that includes colon or is more general. Just using Brace is misleading.


================
Comment at: clang/lib/Format/FormatTokenLexer.cpp:393
+  auto &Brace = *(Tokens.end() - 1);
+  if (!Try->is(tok::kw_try))
+    return false;
----------------
Nit: You can move this if above.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80940





More information about the cfe-commits mailing list