diff options
| author | Daniel Jasper <djasper@google.com> | 2013-09-05 10:48:50 +0000 |
|---|---|---|
| committer | Daniel Jasper <djasper@google.com> | 2013-09-05 10:48:50 +0000 |
| commit | 1a925bce18ea691d9bc7b2810715f37657ca8f51 (patch) | |
| tree | 089b31aad72bfb0d6d922333fb0530357ab3ef17 /lib/Format/Format.cpp | |
| parent | b2c70470def1ab0380be36a295ce4aa7864abfe1 (diff) | |
| download | clang-1a925bce18ea691d9bc7b2810715f37657ca8f51.tar.gz clang-1a925bce18ea691d9bc7b2810715f37657ca8f51.tar.bz2 clang-1a925bce18ea691d9bc7b2810715f37657ca8f51.tar.xz | |
Address post-commit review comments from r190038.
Mostly additional comments :-).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@190042 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Format/Format.cpp')
| -rw-r--r-- | lib/Format/Format.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/Format/Format.cpp b/lib/Format/Format.cpp index 512f99f5e7..c482c402ec 100644 --- a/lib/Format/Format.cpp +++ b/lib/Format/Format.cpp @@ -489,8 +489,8 @@ private: ++Count; } - /// \brief Format all children of \p Tok assuming the parent is indented to - /// \p ParentIndent. + /// \brief If the \p State's next token is an r_brace closing a nested block, + /// format the nested block before it. /// /// Returns \c true if all children could be placed successfully and adapts /// \p Penalty as well as \p State. If \p DryRun is false, also directly @@ -514,7 +514,9 @@ private: const FormatToken &LBrace = *State.NextToken->Previous; if (LBrace.isNot(tok::l_brace) || LBrace.BlockKind != BK_Block || LBrace.Children.size() == 0) - return true; // The previous token does not open a block. Nothing to do. + // The previous token does not open a block. Nothing to do. We don't + // assert so that we can simply call this function for all tokens. + return true; if (NewLine) { unsigned ParentIndent = State.Stack.back().Indent; @@ -734,7 +736,6 @@ public: for (unsigned i = 0, e = AnnotatedLines.size(); i != e; ++i) { delete AnnotatedLines[i]; } - AnnotatedLines.clear(); } tooling::Replacements format() { |
