aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--clang/lib/Format/ContinuationIndenter.cpp4
-rw-r--r--clang/unittests/Format/FormatTest.cpp7
2 files changed, 10 insertions, 1 deletions
diff --git a/clang/lib/Format/ContinuationIndenter.cpp b/clang/lib/Format/ContinuationIndenter.cpp
index 55e1d1c..4e4e48f9 100644
--- a/clang/lib/Format/ContinuationIndenter.cpp
+++ b/clang/lib/Format/ContinuationIndenter.cpp
@@ -1475,7 +1475,9 @@ unsigned ContinuationIndenter::getNewLineColumn(const LineState &State) {
(PreviousNonComment->ClosesTemplateDeclaration ||
PreviousNonComment->ClosesRequiresClause ||
(PreviousNonComment->is(TT_AttributeMacro) &&
- Current.isNot(tok::l_paren)) ||
+ Current.isNot(tok::l_paren) &&
+ !Current.endsSequence(TT_StartOfName, TT_AttributeMacro,
+ TT_PointerOrReference)) ||
PreviousNonComment->isOneOf(
TT_AttributeRParen, TT_AttributeSquare, TT_FunctionAnnotationRParen,
TT_JavaAnnotation, TT_LeadingJavaAnnotation))) ||
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp
index 436beaf..8fe57c8 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -12714,6 +12714,13 @@ TEST_F(FormatTest, UnderstandsAttributes) {
verifyGoogleFormat("SomeType* absl_nullable s{InitValue};");
verifyGoogleFormat("SomeType* absl_nullability_unknown s(InitValue);");
verifyGoogleFormat("SomeType* absl_nullability_unknown s{InitValue};");
+
+ auto Style = getLLVMStyleWithColumns(60);
+ Style.AttributeMacros.push_back("my_fancy_attr");
+ Style.PointerAlignment = FormatStyle::PAS_Left;
+ verifyFormat("void foo(const MyLongTypeNameeeeeeeeeeeee* my_fancy_attr\n"
+ " testttttttttt);",
+ Style);
}
TEST_F(FormatTest, UnderstandsPointerQualifiersInCast) {