@@ -12375,6 +12375,9 @@ TEST_F(FormatTest, UnderstandsUsesOfStarAndAmp) {
12375
12375
verifyFormat("vector<a *_Nonnull> v;");
12376
12376
verifyFormat("vector<a *_Nullable> v;");
12377
12377
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;");
12378
12381
verifyFormat("vector<a *__ptr32> v;");
12379
12382
verifyFormat("vector<a *__ptr64> v;");
12380
12383
verifyFormat("vector<a *__capability> v;");
@@ -12518,6 +12521,12 @@ TEST_F(FormatTest, UnderstandsUsesOfStarAndAmp) {
12518
12521
verifyIndependentOfContext("MACRO(A *_Nonnull a);");
12519
12522
verifyIndependentOfContext("MACRO(A *_Nullable a);");
12520
12523
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
+
12521
12530
verifyIndependentOfContext("MACRO(A *__attribute__((foo)) a);");
12522
12531
verifyIndependentOfContext("MACRO(A *__attribute((foo)) a);");
12523
12532
verifyIndependentOfContext("MACRO(A *[[clang::attr]] a);");
@@ -12676,6 +12685,12 @@ TEST_F(FormatTest, UnderstandsAttributes) {
12676
12685
verifyFormat("SomeType s __unused{InitValue};", CustomAttrs);
12677
12686
verifyFormat("SomeType *__capability s(InitValue);", CustomAttrs);
12678
12687
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};");
12679
12694
}
12680
12695
12681
12696
TEST_F(FormatTest, UnderstandsPointerQualifiersInCast) {
@@ -12687,7 +12702,9 @@ TEST_F(FormatTest, UnderstandsPointerQualifiersInCast) {
12687
12702
verifyFormat("x = (foo *_Nonnull)*v;");
12688
12703
verifyFormat("x = (foo *_Nullable)*v;");
12689
12704
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;");
12691
12708
verifyFormat("x = (foo *[[clang::attr]])*v;");
12692
12709
verifyFormat("x = (foo *[[clang::attr(\"foo\")]])*v;");
12693
12710
verifyFormat("x = (foo *__ptr32)*v;");
@@ -12701,7 +12718,7 @@ TEST_F(FormatTest, UnderstandsPointerQualifiersInCast) {
12701
12718
LongPointerLeft.PointerAlignment = FormatStyle::PAS_Left;
12702
12719
StringRef AllQualifiers =
12703
12720
"const volatile restrict __attribute__((foo)) _Nonnull _Null_unspecified "
12704
- "_Nonnull [[clang::attr]] __ptr32 __ptr64 __capability";
12721
+ "_Nullable [[clang::attr]] __ptr32 __ptr64 __capability";
12705
12722
verifyFormat(("x = (foo *" + AllQualifiers + ")*v;").str(), LongPointerRight);
12706
12723
verifyFormat(("x = (foo* " + AllQualifiers + ")*v;").str(), LongPointerLeft);
12707
12724
0 commit comments