[PATCH] D107269: [clan-format] detect function definitions more conservatively

Owen Pan via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 3 01:36:57 PDT 2021


owenpan added inline comments.


================
Comment at: clang/lib/Format/TokenAnnotator.cpp:2485-2486
   if (Next->Next && Next->Next->is(tok::identifier) &&
-      !(Next->MatchingParen->Next && Next->MatchingParen->Next->is(tok::semi)))
+      (!Next->MatchingParen->Next ||
+       Next->MatchingParen->Next->is(tok::l_brace)))
     return true;
----------------
I was contemplating the above in https://reviews.llvm.org/D105964 and should have used it instead. This is probably more conservative and accurate than checking for an `l_brace` following the `r_paren`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D107269



More information about the cfe-commits mailing list