[clang] [clang][nullability] allow _Nonnull etc on nullable class types (PR #82705)

Sam McCall via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 11 06:17:17 PDT 2024


================
@@ -2156,9 +2156,10 @@ def TypeNonNull : TypeAttr {
   let Documentation = [TypeNonNullDocs];
 }
 
-def TypeNullable : TypeAttr {
+def TypeNullable : DeclOrTypeAttr {
   let Spellings = [CustomKeyword<"_Nullable">];
   let Documentation = [TypeNullableDocs];
+//  let Subjects = SubjectList<[CXXRecord], ErrorDiag>;
----------------
sam-mccall wrote:

With this enabled, the validation will *only* accept `_Nullable` on class declarations, not on types. As far as I can tell, SubjectList can only describe declarations.

Other DeclOrTypeAttrs use a commented-out `Subjects` like this, I assume as documentation, so I did it here for consistency. I can drop it if you want...

https://github.com/llvm/llvm-project/pull/82705


More information about the cfe-commits mailing list