diff options
author | Daniel Jasper <djasper@google.com> | 2013-11-28 15:58:55 +0000 |
---|---|---|
committer | Daniel Jasper <djasper@google.com> | 2013-11-28 15:58:55 +0000 |
commit | 9c19956845808a7a0972e58b08864da36c1ddaf0 (patch) | |
tree | b7038a46d760f3e9cc31eadc2ed4556b953165ae /clang/lib/Format/TokenAnnotator.h | |
parent | b2abd160b32144b86271a60487f10e71223cd97e (diff) | |
download | bcm5719-llvm-9c19956845808a7a0972e58b08864da36c1ddaf0.tar.gz bcm5719-llvm-9c19956845808a7a0972e58b08864da36c1ddaf0.zip |
clang-format: Improve selective formatting of nested statements.
Previously, clang-format could create quite corrupt formattings if
individual lines of nested blocks (e.g. in "DEBUG({})" or lambdas) were
used. With this patch, it tries to extend the formatted regions to leave
around some reasonable format without always formatting the entire
surrounding statement.
llvm-svn: 195925
Diffstat (limited to 'clang/lib/Format/TokenAnnotator.h')
-rw-r--r-- | clang/lib/Format/TokenAnnotator.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/clang/lib/Format/TokenAnnotator.h b/clang/lib/Format/TokenAnnotator.h index 8bdf758bc1b..bd919805847 100644 --- a/clang/lib/Format/TokenAnnotator.h +++ b/clang/lib/Format/TokenAnnotator.h @@ -42,7 +42,7 @@ public: InPPDirective(Line.InPPDirective), MustBeDeclaration(Line.MustBeDeclaration), MightBeFunctionDecl(false), StartsDefinition(false), Affected(false), - LeadingEmptyLinesAffected(false) { + LeadingEmptyLinesAffected(false), ChildrenAffected(false) { assert(!Line.Tokens.empty()); // Calculate Next and Previous for all tokens. Note that we must overwrite @@ -96,6 +96,9 @@ public: /// input ranges. bool LeadingEmptyLinesAffected; + /// \c True if a one of this line's children intersects with an input range. + bool ChildrenAffected; + private: // Disallow copying. AnnotatedLine(const AnnotatedLine &) LLVM_DELETED_FUNCTION; |