diff options
author | Daniel Jasper <djasper@google.com> | 2013-01-02 08:44:14 +0000 |
---|---|---|
committer | Daniel Jasper <djasper@google.com> | 2013-01-02 08:44:14 +0000 |
commit | 4dc41def6129bcecd4d08e5ffafe021aa7b1fa2a (patch) | |
tree | 44cd1ec13cc61341be55c5aa1223f5152a1b1c40 /unittests/Format/FormatTest.cpp | |
parent | 62a833eaebb1867d9950767288debdfa34dd8561 (diff) |
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
Diffstat (limited to 'unittests/Format/FormatTest.cpp')
-rw-r--r-- | unittests/Format/FormatTest.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/unittests/Format/FormatTest.cpp b/unittests/Format/FormatTest.cpp index b719acfabc..99204f56f5 100644 --- a/unittests/Format/FormatTest.cpp +++ b/unittests/Format/FormatTest.cpp @@ -682,6 +682,16 @@ TEST_F(FormatTest, UnderstandsUsesOfStar) { 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;"); |