summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/lib/Format/Format.cpp4
-rw-r--r--clang/unittests/Format/FormatTest.cpp18
2 files changed, 21 insertions, 1 deletions
diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp
index ec8b02ffcad..61d2f7fb63f 100644
--- a/clang/lib/Format/Format.cpp
+++ b/clang/lib/Format/Format.cpp
@@ -282,7 +282,9 @@ private:
return FirstLessLess < Other.FirstLessLess;
if (BreakBeforeClosingBrace != Other.BreakBeforeClosingBrace)
return BreakBeforeClosingBrace;
- return BreakAfterComma;
+ if (BreakAfterComma != Other.BreakAfterComma)
+ return BreakAfterComma;
+ return false;
}
};
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp
index 84ce0c1e06d..668e8af76bc 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -681,6 +681,24 @@ TEST_F(FormatTest, ConstructorInitializers) {
" : 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) {
OpenPOWER on IntegriCloud