llvm-project/clang/unittests
Krasimir Georgiev a1c30937ce [clang-format] Handle trailing comment sections in import statement lines
Summary:
This patch updates the handling of multiline trailing comment sections in
import statement lines to make it more consistent with the case in general.
This includes updating the parsing logic to collect the trailing comment
sections and the formatting logic to not insert escaped newlines at the end of
comment lines in import statement lines.

Specifically, before this patch this code:
```
#include <a> // line 1
             // line 2
```
will be turned into two unwrapped lines, whereas this code:
```
int i; // line 1
       // line 2
```
is turned into a single unwrapped line, enabling reflowing across comments.

An example where the old behaviour is bad is when partially formatting the lines
3 to 4 of this code:
```
#include <a> // line 1
             // line 2

int i;
```
which gets turned into:
```
#include <a> // line 1
             // line 2

             int i;
```
because the two comment lines were independent and the indent was copied.

Reviewers: djasper

Reviewed By: djasper

Subscribers: cfe-commits, klimek

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

llvm-svn: 303415
2017-05-19 10:34:57 +00:00
..
AST Tracking exception specification source locations 2017-01-12 16:11:28 +00:00
ASTMatchers Add cxxStdInitializerListExpr AST matcher 2017-05-05 21:01:12 +00:00
Analysis [analyzer] Reland r299544 "Add a modular constraint system to the CloneDetector" 2017-04-06 14:34:07 +00:00
Basic [modules] Round-trip -Werror flag through explicit module build. 2017-05-03 00:28:49 +00:00
CodeGen Make sure the LLVMContext outlive the CompilerInstance 2016-04-14 05:37:41 +00:00
Driver Testing commit access. 2017-04-18 17:34:46 +00:00
Format [clang-format] Handle trailing comment sections in import statement lines 2017-05-19 10:34:57 +00:00
Frontend Refactor frontend InputKind to prepare for treating module maps as a distinct kind of input. 2017-04-26 18:57:40 +00:00
Lex Reapply "Modules: Cache PCMs in memory and avoid a use-after-free" 2017-03-20 17:58:26 +00:00
Rewrite Remove autoconf support 2016-01-26 21:30:40 +00:00
Sema [Sema] Allow an external sema source to handle delayed typo corrections. 2016-05-19 10:46:10 +00:00
StaticAnalyzer Add a method to get the list of registered static analyzer checkers. 2016-11-08 07:23:32 +00:00
Tooling [AST] RecursiveASTVisitor should not crash on lambdas with type attributes 2017-05-10 16:21:00 +00:00
libclang Fixed more signed/unsigned mismatch warnings introduced in my change at r279076 2016-08-18 20:56:48 +00:00
CMakeLists.txt CFGBuilder: Fix crash when visiting a range-based for over a dependent type 2016-07-08 10:50:51 +00:00