]> granicus.if.org Git - clang/commit
[clang-format] Keep trailing preprocessor line comments separate from the following...
authorKrasimir Georgiev <krasimir@google.com>
Mon, 22 May 2017 10:07:56 +0000 (10:07 +0000)
committerKrasimir Georgiev <krasimir@google.com>
Mon, 22 May 2017 10:07:56 +0000 (10:07 +0000)
commit51ee6cef43b88fc860d5263b80d2327a05d1c581
tree4644035e2a72ca77ab96a9dc552ba009538cc668
parentbeecc655817798b162afbb5f558dbffc627a840a
[clang-format] Keep trailing preprocessor line comments separate from the following section comments

Summary:
r303415 changed the way a sequence of line comments following a preprocessor
macro is handled, which has the unfortunate effect of aligning a trailing
preprocessor line comment and following unrelated section comments, so:
```
#ifdef A // comment about A
// section comment
#endif
```
gets turned into:
```
#ifdef A // comment about A
         // section comment
#endif
```
This patch fixes this by additionally checking the original start columns of
the line comments.

Reviewers: djasper

Reviewed By: djasper

Subscribers: klimek, cfe-commits

Differential Revision: https://reviews.llvm.org/D33394

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@303541 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Format/UnwrappedLineParser.cpp
unittests/Format/FormatTestComments.cpp