[PATCH] D36359: [clang-format] Put '/**' and '*/' on own lines in jsdocs ending in comment pragmas

Martin Probst via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 7 14:13:58 PDT 2017


mprobst added inline comments.


================
Comment at: lib/Format/BreakableToken.cpp:688
+  if (DelimitersOnNewline) {
+    StringRef TrimmedContent = Content.back().substr(TailOffset).rtrim(Blanks);
+    if (!TrimmedContent.empty()) {
----------------
Can you add a comment on what this is doing? It's non obvious. Make sure to document both intention (why) and implementation (how).


================
Comment at: lib/Format/BreakableToken.cpp:688
+  if (DelimitersOnNewline) {
+    StringRef TrimmedContent = Content.back().substr(TailOffset).rtrim(Blanks);
+    if (!TrimmedContent.empty()) {
----------------
mprobst wrote:
> Can you add a comment on what this is doing? It's non obvious. Make sure to document both intention (why) and implementation (how).
I don't understand why we're trimming `Content.back()` here, and `Lines.back()` below.


================
Comment at: lib/Format/BreakableToken.cpp:690
+    if (!TrimmedContent.empty()) {
+      size_t Whitespaces =
+          Lines.back().size() - Lines.back().rtrim(Blanks).size();
----------------
`Whitespaces` seems like a bad variable name, isn't this rather the index of trimmed whitespace in the last line?


https://reviews.llvm.org/D36359





More information about the cfe-commits mailing list