This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rGd304360decef: [clang-format] Parse nullability attributes as a pointer qualifier (authored by arichardson).
Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D86713/new/ https://reviews.llvm.org/D86713 Files: clang/lib/Format/TokenAnnotator.cpp clang/unittests/Format/FormatTest.cpp Index: clang/unittests/Format/FormatTest.cpp =================================================================== --- clang/unittests/Format/FormatTest.cpp +++ clang/unittests/Format/FormatTest.cpp @@ -8025,6 +8025,10 @@ verifyFormat("vector<int *const> v;"); verifyFormat("vector<int *const **const *> v;"); verifyFormat("vector<int *volatile> v;"); + verifyFormat("vector<a *_Nonnull> v;"); + verifyFormat("vector<a *_Nullable> v;"); + verifyFormat("vector<a *_Null_unspecified> v;"); + verifyFormat("vector<a * _NotAQualifier> v;"); verifyFormat("vector<a * b> v;"); verifyFormat("foo<b && false>();"); verifyFormat("foo<b & 1>();"); @@ -8059,6 +8063,9 @@ verifyIndependentOfContext("MACRO(A *volatile a);"); verifyIndependentOfContext("MACRO(A *__volatile a);"); verifyIndependentOfContext("MACRO(A *__volatile__ a);"); + verifyIndependentOfContext("MACRO(A *_Nonnull a);"); + verifyIndependentOfContext("MACRO(A *_Nullable a);"); + verifyIndependentOfContext("MACRO(A *_Null_unspecified a);"); verifyIndependentOfContext("MACRO(A *__attribute__((foo)) a);"); verifyIndependentOfContext("MACRO(A *__attribute((foo)) a);"); verifyIndependentOfContext("MACRO('0' <= c && c <= '9');"); Index: clang/lib/Format/TokenAnnotator.cpp =================================================================== --- clang/lib/Format/TokenAnnotator.cpp +++ clang/lib/Format/TokenAnnotator.cpp @@ -1890,9 +1890,10 @@ const FormatToken *NextToken = Tok.getNextNonComment(); if (!NextToken || - NextToken->isOneOf(tok::arrow, tok::equal, tok::kw_const, - tok::kw_restrict, tok::kw_volatile, - tok::kw___attribute, tok::kw_noexcept) || + NextToken->isOneOf( + tok::arrow, tok::equal, tok::kw_const, tok::kw_restrict, + tok::kw_volatile, tok::kw___attribute, tok::kw__Nonnull, + tok::kw__Nullable, tok::kw__Null_unspecified, tok::kw_noexcept) || (NextToken->is(tok::l_brace) && !NextToken->getNextNonComment())) return TT_PointerOrReference;
Index: clang/unittests/Format/FormatTest.cpp =================================================================== --- clang/unittests/Format/FormatTest.cpp +++ clang/unittests/Format/FormatTest.cpp @@ -8025,6 +8025,10 @@ verifyFormat("vector<int *const> v;"); verifyFormat("vector<int *const **const *> v;"); verifyFormat("vector<int *volatile> v;"); + verifyFormat("vector<a *_Nonnull> v;"); + verifyFormat("vector<a *_Nullable> v;"); + verifyFormat("vector<a *_Null_unspecified> v;"); + verifyFormat("vector<a * _NotAQualifier> v;"); verifyFormat("vector<a * b> v;"); verifyFormat("foo<b && false>();"); verifyFormat("foo<b & 1>();"); @@ -8059,6 +8063,9 @@ verifyIndependentOfContext("MACRO(A *volatile a);"); verifyIndependentOfContext("MACRO(A *__volatile a);"); verifyIndependentOfContext("MACRO(A *__volatile__ a);"); + verifyIndependentOfContext("MACRO(A *_Nonnull a);"); + verifyIndependentOfContext("MACRO(A *_Nullable a);"); + verifyIndependentOfContext("MACRO(A *_Null_unspecified a);"); verifyIndependentOfContext("MACRO(A *__attribute__((foo)) a);"); verifyIndependentOfContext("MACRO(A *__attribute((foo)) a);"); verifyIndependentOfContext("MACRO('0' <= c && c <= '9');"); Index: clang/lib/Format/TokenAnnotator.cpp =================================================================== --- clang/lib/Format/TokenAnnotator.cpp +++ clang/lib/Format/TokenAnnotator.cpp @@ -1890,9 +1890,10 @@ const FormatToken *NextToken = Tok.getNextNonComment(); if (!NextToken || - NextToken->isOneOf(tok::arrow, tok::equal, tok::kw_const, - tok::kw_restrict, tok::kw_volatile, - tok::kw___attribute, tok::kw_noexcept) || + NextToken->isOneOf( + tok::arrow, tok::equal, tok::kw_const, tok::kw_restrict, + tok::kw_volatile, tok::kw___attribute, tok::kw__Nonnull, + tok::kw__Nullable, tok::kw__Null_unspecified, tok::kw_noexcept) || (NextToken->is(tok::l_brace) && !NextToken->getNextNonComment())) return TT_PointerOrReference;
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits