sugak created this revision.
Before:
int operator++(int)noexcept;
After:
int operator++(int) noexcept;
https://reviews.llvm.org/D39587
Files:
lib/Format/TokenAnnotator.cpp
unittests/Format/FormatTest.cpp
Index: unittests/Format/FormatTest.cpp
===================================================================
--- unittests/Format/FormatTest.cpp
+++ unittests/Format/FormatTest.cpp
@@ -5591,6 +5591,7 @@
verifyFormat("bool operator!=();");
verifyFormat("int operator+();");
verifyFormat("int operator++();");
+ verifyFormat("int operator++(int) volatile noexcept;");
verifyFormat("bool operator,();");
verifyFormat("bool operator();");
verifyFormat("bool operator()();");
Index: lib/Format/TokenAnnotator.cpp
===================================================================
--- lib/Format/TokenAnnotator.cpp
+++ lib/Format/TokenAnnotator.cpp
@@ -696,7 +696,8 @@
CurrentToken->Type = TT_PointerOrReference;
consumeToken();
if (CurrentToken &&
- CurrentToken->Previous->isOneOf(TT_BinaryOperator, tok::comma))
+ CurrentToken->Previous->isOneOf(TT_BinaryOperator,
TT_UnaryOperator,
+ tok::comma))
CurrentToken->Previous->Type = TT_OverloadedOperator;
}
if (CurrentToken) {
Index: unittests/Format/FormatTest.cpp
===================================================================
--- unittests/Format/FormatTest.cpp
+++ unittests/Format/FormatTest.cpp
@@ -5591,6 +5591,7 @@
verifyFormat("bool operator!=();");
verifyFormat("int operator+();");
verifyFormat("int operator++();");
+ verifyFormat("int operator++(int) volatile noexcept;");
verifyFormat("bool operator,();");
verifyFormat("bool operator();");
verifyFormat("bool operator()();");
Index: lib/Format/TokenAnnotator.cpp
===================================================================
--- lib/Format/TokenAnnotator.cpp
+++ lib/Format/TokenAnnotator.cpp
@@ -696,7 +696,8 @@
CurrentToken->Type = TT_PointerOrReference;
consumeToken();
if (CurrentToken &&
- CurrentToken->Previous->isOneOf(TT_BinaryOperator, tok::comma))
+ CurrentToken->Previous->isOneOf(TT_BinaryOperator, TT_UnaryOperator,
+ tok::comma))
CurrentToken->Previous->Type = TT_OverloadedOperator;
}
if (CurrentToken) {
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits