[PATCH] D107907: [clang-format] handle trailing comments in function definition detection
Krasimir Georgiev via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Aug 11 23:57:02 PDT 2021
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG0fc27ef19670: [clang-format] handle trailing comments in function definition detection (authored by krasimir).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D107907/new/
https://reviews.llvm.org/D107907
Files:
clang/lib/Format/TokenAnnotator.cpp
clang/unittests/Format/FormatTest.cpp
Index: clang/unittests/Format/FormatTest.cpp
===================================================================
--- clang/unittests/Format/FormatTest.cpp
+++ clang/unittests/Format/FormatTest.cpp
@@ -8252,6 +8252,9 @@
verifyFormat("Tttttttttttttttttttttttt ppppppppppppppp\n"
" ABSL_GUARDED_BY(mutex) = {};",
getGoogleStyleWithColumns(40));
+ verifyFormat("Tttttttttttttttttttttttt ppppppppppppppp\n"
+ " ABSL_GUARDED_BY(mutex); // comment",
+ getGoogleStyleWithColumns(40));
Style = getGNUStyle();
Index: clang/lib/Format/TokenAnnotator.cpp
===================================================================
--- clang/lib/Format/TokenAnnotator.cpp
+++ clang/lib/Format/TokenAnnotator.cpp
@@ -2482,7 +2482,7 @@
// return i + 1;
// }
if (Next->Next && Next->Next->is(tok::identifier) &&
- Line.Last->isNot(tok::semi))
+ !Line.endsWith(tok::semi))
return true;
for (const FormatToken *Tok = Next->Next; Tok && Tok != Next->MatchingParen;
Tok = Tok->Next) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D107907.365919.patch
Type: text/x-patch
Size: 1076 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210812/6904ea42/attachment.bin>
More information about the cfe-commits
mailing list