aboutsummaryrefslogtreecommitdiff
path: root/lib/Format/Format.cpp
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2013-04-24 06:33:59 +0000
committerDaniel Jasper <djasper@google.com>2013-04-24 06:33:59 +0000
commitaf8497681e38106ad6f84408e029537e2a13d79d (patch)
treea5dc54db9377b7a60d54e014d9bc0bf62515bc48 /lib/Format/Format.cpp
parent44f72d34a947c654f88ea212b7fe5834615bca11 (diff)
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180173 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Format/Format.cpp')
-rw-r--r--lib/Format/Format.cpp2
1 files changed, 2 insertions, 0 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;
}