[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)
commitea222a7951cfb3026a4b4ef592c942a4ef05b437
treea415f38581a6f89cd2ef32720de047268f30f254
parent6110be9759f6accf215c793c31278d6d4849bf6f
[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

llvm-svn: 303541
clang/lib/Format/UnwrappedLineParser.cpp
clang/unittests/Format/FormatTestComments.cpp