summaryrefslogtreecommitdiffstats
path: root/clang/lib/Format/WhitespaceManager.cpp
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2016-02-01 11:20:55 +0000
committerDaniel Jasper <djasper@google.com>2016-02-01 11:20:55 +0000
commitbb37a2f6f34f787c93c983a7cc1e7d9495c7e73b (patch)
tree22d058dd55506ecc83fbce616c76bb0f3e8ac7af /clang/lib/Format/WhitespaceManager.cpp
parent1ce41112a43005b3ac2ee24119f2e633d86a27f5 (diff)
downloadbcm5719-llvm-bb37a2f6f34f787c93c983a7cc1e7d9495c7e73b.tar.gz
bcm5719-llvm-bb37a2f6f34f787c93c983a7cc1e7d9495c7e73b.zip
clang-format: Fix alignment of trailing multiline columns.
llvm-svn: 259351
Diffstat (limited to 'clang/lib/Format/WhitespaceManager.cpp')
-rw-r--r--clang/lib/Format/WhitespaceManager.cpp24
1 files changed, 14 insertions, 10 deletions
diff --git a/clang/lib/Format/WhitespaceManager.cpp b/clang/lib/Format/WhitespaceManager.cpp
index d6e6ed2c2ba..0673dfb3ace 100644
--- a/clang/lib/Format/WhitespaceManager.cpp
+++ b/clang/lib/Format/WhitespaceManager.cpp
@@ -372,16 +372,20 @@ void WhitespaceManager::alignTrailingComments() {
unsigned CommentColumn = SourceMgr.getSpellingColumnNumber(
Changes[i].OriginalWhitespaceRange.getEnd());
for (unsigned j = i + 1; j != e; ++j) {
- if (Changes[j].Kind != tok::comment) { // Skip over comments.
- unsigned NextColumn = SourceMgr.getSpellingColumnNumber(
- Changes[j].OriginalWhitespaceRange.getEnd());
- // The start of the next token was previously aligned with the
- // start of this comment.
- WasAlignedWithStartOfNextLine =
- CommentColumn == NextColumn ||
- CommentColumn == NextColumn + Style.IndentWidth;
- break;
- }
+ if (Changes[j].Kind == tok::comment ||
+ Changes[j].Kind == tok::unknown)
+ // Skip over comments and unknown tokens. "unknown tokens are used for
+ // the continuation of multiline comments.
+ continue;
+
+ unsigned NextColumn = SourceMgr.getSpellingColumnNumber(
+ Changes[j].OriginalWhitespaceRange.getEnd());
+ // The start of the next token was previously aligned with the
+ // start of this comment.
+ WasAlignedWithStartOfNextLine =
+ CommentColumn == NextColumn ||
+ CommentColumn == NextColumn + Style.IndentWidth;
+ break;
}
}
if (!Style.AlignTrailingComments || FollowsRBraceInColumn0) {
OpenPOWER on IntegriCloud