diff options
Diffstat (limited to 'clang/lib/Format/WhitespaceManager.cpp')
-rw-r--r-- | clang/lib/Format/WhitespaceManager.cpp | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/clang/lib/Format/WhitespaceManager.cpp b/clang/lib/Format/WhitespaceManager.cpp index d6e6ed2..0673dfb 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) { |