@@ -12375,6 +12375,9 @@ TEST_F(FormatTest, UnderstandsUsesOfStarAndAmp) {
1237512375 verifyFormat("vector<a *_Nonnull> v;");
1237612376 verifyFormat("vector<a *_Nullable> v;");
1237712377 verifyFormat("vector<a *_Null_unspecified> v;");
12378+ verifyGoogleFormat("vector<a* absl_nonnull> v;");
12379+ verifyGoogleFormat("vector<a* absl_nullable> v;");
12380+ verifyGoogleFormat("vector<a* absl_nullability_unknown> v;");
1237812381 verifyFormat("vector<a *__ptr32> v;");
1237912382 verifyFormat("vector<a *__ptr64> v;");
1238012383 verifyFormat("vector<a *__capability> v;");
@@ -12518,6 +12521,12 @@ TEST_F(FormatTest, UnderstandsUsesOfStarAndAmp) {
1251812521 verifyIndependentOfContext("MACRO(A *_Nonnull a);");
1251912522 verifyIndependentOfContext("MACRO(A *_Nullable a);");
1252012523 verifyIndependentOfContext("MACRO(A *_Null_unspecified a);");
12524+
12525+ Style = getGoogleStyle();
12526+ verifyIndependentOfContext("MACRO(A* absl_nonnull a);", Style);
12527+ verifyIndependentOfContext("MACRO(A* absl_nullable a);", Style);
12528+ verifyIndependentOfContext("MACRO(A* absl_nullability_unknown a);", Style);
12529+
1252112530 verifyIndependentOfContext("MACRO(A *__attribute__((foo)) a);");
1252212531 verifyIndependentOfContext("MACRO(A *__attribute((foo)) a);");
1252312532 verifyIndependentOfContext("MACRO(A *[[clang::attr]] a);");
@@ -12676,6 +12685,12 @@ TEST_F(FormatTest, UnderstandsAttributes) {
1267612685 verifyFormat("SomeType s __unused{InitValue};", CustomAttrs);
1267712686 verifyFormat("SomeType *__capability s(InitValue);", CustomAttrs);
1267812687 verifyFormat("SomeType *__capability s{InitValue};", CustomAttrs);
12688+ verifyGoogleFormat("SomeType* absl_nonnull s(InitValue);");
12689+ verifyGoogleFormat("SomeType* absl_nonnull s{InitValue};");
12690+ verifyGoogleFormat("SomeType* absl_nullable s(InitValue);");
12691+ verifyGoogleFormat("SomeType* absl_nullable s{InitValue};");
12692+ verifyGoogleFormat("SomeType* absl_nullability_unknown s(InitValue);");
12693+ verifyGoogleFormat("SomeType* absl_nullability_unknown s{InitValue};");
1267912694}
1268012695
1268112696TEST_F(FormatTest, UnderstandsPointerQualifiersInCast) {
@@ -12687,7 +12702,9 @@ TEST_F(FormatTest, UnderstandsPointerQualifiersInCast) {
1268712702 verifyFormat("x = (foo *_Nonnull)*v;");
1268812703 verifyFormat("x = (foo *_Nullable)*v;");
1268912704 verifyFormat("x = (foo *_Null_unspecified)*v;");
12690- verifyFormat("x = (foo *_Nonnull)*v;");
12705+ verifyGoogleFormat("x = (foo* absl_nonnull)*v;");
12706+ verifyGoogleFormat("x = (foo* absl_nullable)*v;");
12707+ verifyGoogleFormat("x = (foo* absl_nullability_unknown)*v;");
1269112708 verifyFormat("x = (foo *[[clang::attr]])*v;");
1269212709 verifyFormat("x = (foo *[[clang::attr(\"foo\")]])*v;");
1269312710 verifyFormat("x = (foo *__ptr32)*v;");
@@ -12701,7 +12718,7 @@ TEST_F(FormatTest, UnderstandsPointerQualifiersInCast) {
1270112718 LongPointerLeft.PointerAlignment = FormatStyle::PAS_Left;
1270212719 StringRef AllQualifiers =
1270312720 "const volatile restrict __attribute__((foo)) _Nonnull _Null_unspecified "
12704- "_Nonnull [[clang::attr]] __ptr32 __ptr64 __capability";
12721+ "_Nullable [[clang::attr]] __ptr32 __ptr64 __capability";
1270512722 verifyFormat(("x = (foo *" + AllQualifiers + ")*v;").str(), LongPointerRight);
1270612723 verifyFormat(("x = (foo* " + AllQualifiers + ")*v;").str(), LongPointerLeft);
1270712724
0 commit comments