aboutsummaryrefslogtreecommitdiff
path: root/lib/Format
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Format')
-rw-r--r--lib/Format/Format.cpp2
-rw-r--r--lib/Format/UnwrappedLineParser.cpp14
2 files changed, 10 insertions, 6 deletions
diff --git a/lib/Format/Format.cpp b/lib/Format/Format.cpp
index c0ed6c5be1..39efeab52c 100644
--- a/lib/Format/Format.cpp
+++ b/lib/Format/Format.cpp
@@ -1033,6 +1033,8 @@ private:
if (Left.is(tok::at) &&
Right.FormatTok.Tok.getObjCKeywordID() != tok::objc_not_keyword)
return false;
+ if (Left.is(tok::l_brace) && Right.is(tok::r_brace))
+ return false;
return true;
}
diff --git a/lib/Format/UnwrappedLineParser.cpp b/lib/Format/UnwrappedLineParser.cpp
index 736178e1eb..e9c6211313 100644
--- a/lib/Format/UnwrappedLineParser.cpp
+++ b/lib/Format/UnwrappedLineParser.cpp
@@ -167,15 +167,17 @@ bool UnwrappedLineParser::parseBlock(unsigned AddLevels) {
assert(FormatTok.Tok.is(tok::l_brace) && "'{' expected");
nextToken();
- addUnwrappedLine();
+ if (!FormatTok.Tok.is(tok::r_brace)) {
+ addUnwrappedLine();
- Line->Level += AddLevels;
- parseLevel(/*HasOpeningBrace=*/true);
- Line->Level -= AddLevels;
+ Line->Level += AddLevels;
+ parseLevel(/*HasOpeningBrace=*/true);
+ Line->Level -= AddLevels;
- if (!FormatTok.Tok.is(tok::r_brace))
- return true;
+ if (!FormatTok.Tok.is(tok::r_brace))
+ return true;
+ }
nextToken(); // Munch the closing brace.
return false;
}