Fix incorrect line breaking before trailing block comments.
Before, clang-format would happily move a trailing block comment to a
new line, which normally changes the perceived binding of that comment.
E.g., it would move:
void f() { /* comment */
...
}
to:
void f() {
/* comment */
...
}
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183420 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Format/TokenAnnotator.cpp b/lib/Format/TokenAnnotator.cpp
index 71a1a28..8b1382e 100644
--- a/lib/Format/TokenAnnotator.cpp
+++ b/lib/Format/TokenAnnotator.cpp
@@ -1198,7 +1198,7 @@
Left.Previous->is(tok::kw___attribute))
return false;
- if (Right.Type == TT_LineComment)
+ if (Right.isTrailingComment())
// We rely on MustBreakBefore being set correctly here as we should not
// change the "binding" behavior of a comment.
return false;