diff options
Diffstat (limited to 'lib/Format')
-rw-r--r-- | lib/Format/Format.cpp | 2 | ||||
-rw-r--r-- | lib/Format/WhitespaceManager.h | 6 |
2 files changed, 5 insertions, 3 deletions
diff --git a/lib/Format/Format.cpp b/lib/Format/Format.cpp index 2538f33f50..0c3f85d124 100644 --- a/lib/Format/Format.cpp +++ b/lib/Format/Format.cpp @@ -1069,6 +1069,8 @@ public: if (TheLine.Last->is(tok::comment)) Whitespaces.addUntouchableComment(SourceMgr.getSpellingColumnNumber( TheLine.Last->FormatTok.Tok.getLocation()) - 1); + else + Whitespaces.alignComments(); } PreviousLineLastToken = I->Last; } diff --git a/lib/Format/WhitespaceManager.h b/lib/Format/WhitespaceManager.h index 252997f6d8..2833e249c4 100644 --- a/lib/Format/WhitespaceManager.h +++ b/lib/Format/WhitespaceManager.h @@ -66,6 +66,9 @@ public: void addUntouchableComment(unsigned Column); + /// \brief Try to align all stashed comments. + void alignComments(); + private: std::string getNewLineText(unsigned NewLines, unsigned Spaces); @@ -84,9 +87,6 @@ private: SmallVector<StoredComment, 16> Comments; typedef SmallVector<StoredComment, 16>::iterator comment_iterator; - /// \brief Try to align all stashed comments. - void alignComments(); - /// \brief Put all the comments between \p I and \p E into \p Column. void alignComments(comment_iterator I, comment_iterator E, unsigned Column); |