Don't break after pointer or reference specifier.
This fixes llvm.org/PR14717.
Buggy format:
TypeSpecDecl *
TypeSpecDecl::Create(ASTContext &C, DeclContext *DC, SourceLocation L,
IdentifierInfo *II, Type *T) {
Now changed to:
TypeSpecDecl *TypeSpecDecl::Create(ASTContext &C, DeclContext *DC,
SourceLocation L, IdentifierInfo *II,
Type *T) {
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171357 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/unittests/Format/FormatTest.cpp b/unittests/Format/FormatTest.cpp
index b719acf..99204f5 100644
--- a/unittests/Format/FormatTest.cpp
+++ b/unittests/Format/FormatTest.cpp
@@ -682,6 +682,16 @@
verifyGoogleFormat("A<int**, int**> a;");
}
+TEST_F(FormatTest, DoesNotBreakBeforePointerOrReference) {
+ verifyFormat(
+ "int *someFunction(int LoooooooooooooooongParam1,\n"
+ " int LoooooooooooooooongParam2) {\n}");
+ verifyFormat(
+ "TypeSpecDecl *TypeSpecDecl::Create(ASTContext &C, DeclContext *DC,\n"
+ " SourceLocation L, IdentifierIn *II,\n"
+ " Type *T) {\n}");
+}
+
TEST_F(FormatTest, LineStartsWithSpecialCharacter) {
verifyFormat("(a)->b();");
verifyFormat("--a;");