diff options
author | Daniel Jasper <djasper@google.com> | 2013-04-24 06:33:59 +0000 |
---|---|---|
committer | Daniel Jasper <djasper@google.com> | 2013-04-24 06:33:59 +0000 |
commit | 770eb7c5f9439f7e81d6a27e30752ce08ec46e84 (patch) | |
tree | ea734c9cf6b958c85cd18ae3072e1ba56b769e06 /clang/lib/Format/WhitespaceManager.h | |
parent | f759989bcd3140bc2120870085b524365bcd3a87 (diff) | |
download | bcm5719-llvm-770eb7c5f9439f7e81d6a27e30752ce08ec46e84.tar.gz bcm5719-llvm-770eb7c5f9439f7e81d6a27e30752ce08ec46e84.zip |
Fix comment alignment behavior.
In the following snippet, clang-format incorrectly aligned the
trailing comment, when only the last line was formatted:
int aaaaaa; // comment
int b;
int c; // Formatting only this line moved this comment.
llvm-svn: 180173
Diffstat (limited to 'clang/lib/Format/WhitespaceManager.h')
-rw-r--r-- | clang/lib/Format/WhitespaceManager.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/clang/lib/Format/WhitespaceManager.h b/clang/lib/Format/WhitespaceManager.h index 252997f6d8d..2833e249c42 100644 --- a/clang/lib/Format/WhitespaceManager.h +++ b/clang/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); |