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 | f3a5d004915bf70a32359d45d043a4197dc4c20d (patch) | |
tree | 654bf7670db6a92709ac68dc0fc4390a715a53c6 /clang/lib/Format/Format.cpp | |
parent | 178273a174cc22d7f5d23dbe83c697efeb52a1de (diff) | |
download | bcm5719-llvm-f3a5d004915bf70a32359d45d043a4197dc4c20d.tar.gz bcm5719-llvm-f3a5d004915bf70a32359d45d043a4197dc4c20d.zip |
Address post-commit review comments from r190038.
Mostly additional comments :-).
llvm-svn: 190042
Diffstat (limited to 'clang/lib/Format/Format.cpp')
-rw-r--r-- | clang/lib/Format/Format.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp index 512f99f5e7f..c482c402ec8 100644 --- a/clang/lib/Format/Format.cpp +++ b/clang/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() { |