summaryrefslogtreecommitdiffstats
path: root/clang/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
commitecdc7507ab3080b252539c1ab57e80c4c34cf65f (patch)
tree1bfc1fee648e9b8a748db8229405b80e296e12cc /clang/lib/Format/UnwrappedLineParser.cpp
parente8f80a12bd06b0d82eff217e44dc27ddca246f59 (diff)
downloadbcm5719-llvm-ecdc7507ab3080b252539c1ab57e80c4c34cf65f.tar.gz
bcm5719-llvm-ecdc7507ab3080b252539c1ab57e80c4c34cf65f.zip
Clang-format: detect unbalanced braces.
Reviewers: klimek, djasper Reviewed By: klimek CC: cfe-commits, silvas Differential Revision: http://llvm-reviews.chandlerc.com/D176 llvm-svn: 169518
Diffstat (limited to 'clang/lib/Format/UnwrappedLineParser.cpp')
-rw-r--r--clang/lib/Format/UnwrappedLineParser.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/clang/lib/Format/UnwrappedLineParser.cpp b/clang/lib/Format/UnwrappedLineParser.cpp
index 99e58321cd7..425e15b81f9 100644
--- a/clang/lib/Format/UnwrappedLineParser.cpp
+++ b/clang/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.
OpenPOWER on IntegriCloud