From 1130981907705ddc9ed56093cf972df8f9e0bdfd Mon Sep 17 00:00:00 2001 From: Daniel Jasper Date: Wed, 18 Mar 2015 14:20:13 +0000 Subject: [PATCH] clang-format: Fix bad wrapping after "*" introduced in r232044. Before: void aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaaaaaaaa* const aaaaaaaaaaaa) {} After: void aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa( aaaaaaaaaaaaaaaaaaaaaaaaa* const aaaaaaaaaaaa) {} llvm-svn: 232635 --- clang/lib/Format/TokenAnnotator.cpp | 4 +--- clang/unittests/Format/FormatTest.cpp | 6 ++++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp index 911d52d..eea9d67 100644 --- a/clang/lib/Format/TokenAnnotator.cpp +++ b/clang/lib/Format/TokenAnnotator.cpp @@ -1996,9 +1996,7 @@ bool TokenAnnotator::canBreakBefore(const AnnotatedLine &Line, if (Left.isOneOf(TT_JavaAnnotation, TT_LeadingJavaAnnotation)) return !Right.is(tok::l_paren); if (Left.is(TT_PointerOrReference)) - return (!Line.IsMultiVariableDeclStmt && - Style.PointerAlignment != FormatStyle::PAS_Right) || - Right.is(TT_FunctionDeclarationName); + return Right.is(TT_FunctionDeclarationName); if (Right.is(TT_PointerOrReference)) return Line.IsMultiVariableDeclStmt || (Style.PointerAlignment == FormatStyle::PAS_Right && diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp index 0b5baba..228e952 100644 --- a/clang/unittests/Format/FormatTest.cpp +++ b/clang/unittests/Format/FormatTest.cpp @@ -3774,6 +3774,12 @@ TEST_F(FormatTest, BreaksFunctionDeclarations) { "typename aaaaaaaaaa::aaaaaaaaaaa\n" "aaaaaaaaaa::aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(\n" " bool *aaaaaaaaaaaaaaaaaa, bool *aa) {}"); + + FormatStyle Style = getLLVMStyle(); + Style.PointerAlignment = FormatStyle::PAS_Left; + verifyFormat("void aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(\n" + " aaaaaaaaaaaaaaaaaaaaaaaaa* const aaaaaaaaaaaa) {}", + Style); } TEST_F(FormatTest, TrailingReturnType) { -- 2.7.4