diff options
| author | Daniel Jasper <djasper@google.com> | 2016-02-29 12:26:20 +0000 |
|---|---|---|
| committer | Daniel Jasper <djasper@google.com> | 2016-02-29 12:26:20 +0000 |
| commit | 35ca66debf3b353b9793b07a412619130dcbd586 (patch) | |
| tree | 9f11ade9a085a35d6da66dc40981acab86cfd99b /clang/lib | |
| parent | 6bb15021b37cd79e0fa8c361880756f90d9b5ba3 (diff) | |
| download | bcm5719-llvm-35ca66debf3b353b9793b07a412619130dcbd586.tar.gz bcm5719-llvm-35ca66debf3b353b9793b07a412619130dcbd586.zip | |
clang-format: Don't format unrelated nested blocks.
With this change:
SomeFunction(
[] {
int i;
return i; // Format this line.
},
[] {
return 2; // Don't "fix" this.
});
llvm-svn: 262216
Diffstat (limited to 'clang/lib')
| -rw-r--r-- | clang/lib/Format/UnwrappedLineFormatter.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/clang/lib/Format/UnwrappedLineFormatter.cpp b/clang/lib/Format/UnwrappedLineFormatter.cpp index f6505690796..d75eaf54a08 100644 --- a/clang/lib/Format/UnwrappedLineFormatter.cpp +++ b/clang/lib/Format/UnwrappedLineFormatter.cpp @@ -863,7 +863,9 @@ UnwrappedLineFormatter::format(const SmallVectorImpl<AnnotatedLine *> &Lines, // If no token in the current line is affected, we still need to format // affected children. if (TheLine.ChildrenAffected) - format(TheLine.Children, DryRun); + for (const FormatToken *Tok = TheLine.First; Tok; Tok = Tok->Next) + if (!Tok->Children.empty()) + format(Tok->Children, DryRun); // Adapt following lines on the current indent level to the same level // unless the current \c AnnotatedLine is not at the beginning of a line. |

