forked from OSchip/llvm-project
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
This commit is contained in:
parent
e8f80a12bd
commit
ecdc7507ab
|
@ -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.
|
||||
|
|
|
@ -428,6 +428,7 @@ TEST_F(FormatTest, IncorrectCodeErrorDetection) {
|
|||
EXPECT_EQ("{\n{\n}\n", format("{\n{\n}\n"));
|
||||
EXPECT_EQ("{\n {\n}\n", format("{\n {\n}\n"));
|
||||
EXPECT_EQ("{\n {\n }\n", format("{\n {\n }\n"));
|
||||
EXPECT_EQ("{\n {\n }\n }\n}\n", format("{\n {\n }\n }\n}\n"));
|
||||
|
||||
FormatStyle Style = getLLVMStyle();
|
||||
Style.ColumnLimit = 10;
|
||||
|
|
Loading…
Reference in New Issue