aboutsummaryrefslogtreecommitdiff
path: root/lib/Format/UnwrappedLineParser.cpp
diff options
context:
space:
mode:
authorAlexander Kornienko <alexfh@google.com>2012-12-06 17:49:17 +0000
committerAlexander Kornienko <alexfh@google.com>2012-12-06 17:49:17 +0000
commita3a2b3a1e86a93d2044106046a4dca13a3558fba (patch)
tree21f852f4151e5bce9b230554b68de90c0b3aa729 /lib/Format/UnwrappedLineParser.cpp
parent33c95f1178999ea06837769f90be8d7b8d57bb4d (diff)
Clang-format: detect unbalanced braces.
Reviewers: klimek, djasper Reviewed By: klimek CC: cfe-commits, silvas Differential Revision: http://llvm-reviews.chandlerc.com/D176 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169518 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Format/UnwrappedLineParser.cpp')
-rw-r--r--lib/Format/UnwrappedLineParser.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/Format/UnwrappedLineParser.cpp b/lib/Format/UnwrappedLineParser.cpp
index 99e58321cd..425e15b81f 100644
--- a/lib/Format/UnwrappedLineParser.cpp
+++ b/lib/Format/UnwrappedLineParser.cpp
@@ -52,8 +52,8 @@ bool UnwrappedLineParser::parseLevel() {
addUnwrappedLine();
break;
case tok::r_brace:
- // FIXME: We need a test when it has to be "return Error;"
- return false;
+ // Stray '}' is an error.
+ return true;
default:
parseStatement();
break;
@@ -63,6 +63,7 @@ bool UnwrappedLineParser::parseLevel() {
}
bool UnwrappedLineParser::parseBlock() {
+ assert(FormatTok.Tok.is(tok::l_brace) && "'{' expected");
nextToken();
// FIXME: Remove this hack to handle namespaces.