@@ -9589,8 +9589,11 @@ TEST_F(FormatTest, UnderstandsOverloadedOperators) {
9589
9589
}
9590
9590
9591
9591
TEST_F(FormatTest, UnderstandsFunctionRefQualification) {
9592
+ verifyFormat("void A::b() && {}");
9593
+ verifyFormat("void A::b() &&noexcept {}");
9592
9594
verifyFormat("Deleted &operator=(const Deleted &) & = default;");
9593
9595
verifyFormat("Deleted &operator=(const Deleted &) && = delete;");
9596
+ verifyFormat("Deleted &operator=(const Deleted &) &noexcept = default;");
9594
9597
verifyFormat("SomeType MemberFunction(const Deleted &) & = delete;");
9595
9598
verifyFormat("SomeType MemberFunction(const Deleted &) && = delete;");
9596
9599
verifyFormat("Deleted &operator=(const Deleted &) &;");
@@ -9600,16 +9603,21 @@ TEST_F(FormatTest, UnderstandsFunctionRefQualification) {
9600
9603
verifyFormat("SomeType MemberFunction(const Deleted &) && {}");
9601
9604
verifyFormat("SomeType MemberFunction(const Deleted &) && final {}");
9602
9605
verifyFormat("SomeType MemberFunction(const Deleted &) && override {}");
9606
+ verifyFormat("SomeType MemberFunction(const Deleted &) &&noexcept {}");
9603
9607
verifyFormat("void Fn(T const &) const &;");
9604
9608
verifyFormat("void Fn(T const volatile &&) const volatile &&;");
9609
+ verifyFormat("void Fn(T const volatile &&) const volatile &&noexcept;");
9605
9610
verifyFormat("template <typename T>\n"
9606
9611
"void F(T) && = delete;",
9607
9612
getGoogleStyle());
9608
9613
9609
9614
FormatStyle AlignLeft = getLLVMStyle();
9610
9615
AlignLeft.PointerAlignment = FormatStyle::PAS_Left;
9611
9616
verifyFormat("void A::b() && {}", AlignLeft);
9617
+ verifyFormat("void A::b() && noexcept {}", AlignLeft);
9612
9618
verifyFormat("Deleted& operator=(const Deleted&) & = default;", AlignLeft);
9619
+ verifyFormat("Deleted& operator=(const Deleted&) & noexcept = default;",
9620
+ AlignLeft);
9613
9621
verifyFormat("SomeType MemberFunction(const Deleted&) & = delete;",
9614
9622
AlignLeft);
9615
9623
verifyFormat("Deleted& operator=(const Deleted&) &;", AlignLeft);
@@ -9620,6 +9628,29 @@ TEST_F(FormatTest, UnderstandsFunctionRefQualification) {
9620
9628
verifyFormat("auto Function(T) & -> void;", AlignLeft);
9621
9629
verifyFormat("void Fn(T const&) const&;", AlignLeft);
9622
9630
verifyFormat("void Fn(T const volatile&&) const volatile&&;", AlignLeft);
9631
+ verifyFormat("void Fn(T const volatile&&) const volatile&& noexcept;",
9632
+ AlignLeft);
9633
+
9634
+ FormatStyle AlignMiddle = getLLVMStyle();
9635
+ AlignMiddle.PointerAlignment = FormatStyle::PAS_Middle;
9636
+ verifyFormat("void A::b() && {}", AlignMiddle);
9637
+ verifyFormat("void A::b() && noexcept {}", AlignMiddle);
9638
+ verifyFormat("Deleted & operator=(const Deleted &) & = default;",
9639
+ AlignMiddle);
9640
+ verifyFormat("Deleted & operator=(const Deleted &) & noexcept = default;",
9641
+ AlignMiddle);
9642
+ verifyFormat("SomeType MemberFunction(const Deleted &) & = delete;",
9643
+ AlignMiddle);
9644
+ verifyFormat("Deleted & operator=(const Deleted &) &;", AlignMiddle);
9645
+ verifyFormat("SomeType MemberFunction(const Deleted &) &;", AlignMiddle);
9646
+ verifyFormat("auto Function(T t) & -> void {}", AlignMiddle);
9647
+ verifyFormat("auto Function(T... t) & -> void {}", AlignMiddle);
9648
+ verifyFormat("auto Function(T) & -> void {}", AlignMiddle);
9649
+ verifyFormat("auto Function(T) & -> void;", AlignMiddle);
9650
+ verifyFormat("void Fn(T const &) const &;", AlignMiddle);
9651
+ verifyFormat("void Fn(T const volatile &&) const volatile &&;", AlignMiddle);
9652
+ verifyFormat("void Fn(T const volatile &&) const volatile && noexcept;",
9653
+ AlignMiddle);
9623
9654
9624
9655
FormatStyle Spaces = getLLVMStyle();
9625
9656
Spaces.SpacesInCStyleCastParentheses = true;
0 commit comments