Fix incorrect comparison operator causing loooong formatting times.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172308 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Format/Format.cpp b/lib/Format/Format.cpp
index ec8b02f..61d2f7f 100644
--- a/lib/Format/Format.cpp
+++ b/lib/Format/Format.cpp
@@ -282,7 +282,9 @@
return FirstLessLess < Other.FirstLessLess;
if (BreakBeforeClosingBrace != Other.BreakBeforeClosingBrace)
return BreakBeforeClosingBrace;
- return BreakAfterComma;
+ if (BreakAfterComma != Other.BreakAfterComma)
+ return BreakAfterComma;
+ return false;
}
};
diff --git a/unittests/Format/FormatTest.cpp b/unittests/Format/FormatTest.cpp
index 84ce0c1..668e8af 100644
--- a/unittests/Format/FormatTest.cpp
+++ b/unittests/Format/FormatTest.cpp
@@ -681,6 +681,24 @@
" : some_var_(var), // 4 space indent\n"
" some_other_var_(var + 1) { // lined up\n"
"}");
+
+ // This test takes VERY long when memoization is broken.
+ verifyGoogleFormat(
+ "Constructor()\n"
+ " : aaaa(a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a,"
+ " a, a, a,\n"
+ " a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a,"
+ " a, a, a,\n"
+ " a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a,"
+ " a, a, a,\n"
+ " a, a, a, a, a, a, a, a, a, a, a)\n"
+ " aaaa(a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a,"
+ " a, a, a,\n"
+ " a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a,"
+ " a, a, a,\n"
+ " a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a,"
+ " a, a, a,\n"
+ " a, a, a, a, a, a, a, a, a, a, a) {}\n");
}
TEST_F(FormatTest, BreaksAsHighAsPossible) {