summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
Diffstat (limited to 'clang')
-rw-r--r--clang/lib/Format/UnwrappedLineParser.cpp2
-rw-r--r--clang/unittests/Format/FormatTest.cpp2
2 files changed, 3 insertions, 1 deletions
diff --git a/clang/lib/Format/UnwrappedLineParser.cpp b/clang/lib/Format/UnwrappedLineParser.cpp
index 93840dcad8f..e8503bb3322 100644
--- a/clang/lib/Format/UnwrappedLineParser.cpp
+++ b/clang/lib/Format/UnwrappedLineParser.cpp
@@ -225,7 +225,7 @@ bool UnwrappedLineParser::parse() {
Callback.finishRun();
Lines.clear();
while (!PPLevelBranchIndex.empty() &&
- PPLevelBranchIndex.back() + 1 == PPLevelBranchCount.back()) {
+ PPLevelBranchIndex.back() + 1 >= PPLevelBranchCount.back()) {
PPLevelBranchIndex.resize(PPLevelBranchIndex.size() - 1);
PPLevelBranchCount.resize(PPLevelBranchCount.size() - 1);
}
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp
index 5fea8e781eb..6e8179a3068 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -2317,6 +2317,8 @@ TEST_F(FormatTest, LayoutStatementsAroundPreprocessorDirectives) {
" x();\n"
"}",
getLLVMStyleWithColumns(28));
+ verifyFormat("#if 1\n"
+ "int i;");
}
TEST_F(FormatTest, LayoutBlockInsideParens) {
OpenPOWER on IntegriCloud