diff options
author | Krasimir Georgiev <krasimir@google.com> | 2017-02-03 10:18:25 +0000 |
---|---|---|
committer | Krasimir Georgiev <krasimir@google.com> | 2017-02-03 10:18:25 +0000 |
commit | d105b72df64ed394b6fb98c13467a2096c1b68e7 (patch) | |
tree | 742034f2130e14cc5f16c1c9824442da78c9134b /clang/lib | |
parent | 82c489f2a6c73dbe1391954d422ffd9bbdc2dab9 (diff) | |
download | bcm5719-llvm-d105b72df64ed394b6fb98c13467a2096c1b68e7.tar.gz bcm5719-llvm-d105b72df64ed394b6fb98c13467a2096c1b68e7.zip |
[clang-format] Re-align broken comment lines where appropriate.
Summary:
The comment aligner was skipping over newly broken comment lines. This patch fixes that.
source:
```
int ab; // line
int a; // long long
```
format with column limit 15 before:
```
int ab; // line
int a; // long
// long
```
format with column limit 15 after:
```
int ab; // line
int a; // long
// long
```
Reviewers: djasper
Reviewed By: djasper
Subscribers: cfe-commits, klimek
Differential Revision: https://reviews.llvm.org/D29486
llvm-svn: 293997
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/Format/WhitespaceManager.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/clang/lib/Format/WhitespaceManager.cpp b/clang/lib/Format/WhitespaceManager.cpp index 3fd92eaf785..93a2e490c66 100644 --- a/clang/lib/Format/WhitespaceManager.cpp +++ b/clang/lib/Format/WhitespaceManager.cpp @@ -164,8 +164,9 @@ void WhitespaceManager::calculateLineBreakInformation() { const WhitespaceManager::Change *LastBlockComment = nullptr; for (auto &Change : Changes) { // Reset the IsTrailingComment flag for changes inside of trailing comments - // so they don't get realigned later. - if (Change.IsInsideToken) + // so they don't get realigned later. Comment line breaks however still need + // to be aligned. + if (Change.IsInsideToken && Change.NewlinesBefore == 0) Change.IsTrailingComment = false; Change.StartOfBlockComment = nullptr; Change.IndentationOffset = 0; |