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

2024-05-09 Thread James Y Knight via cfe-commits
jyknight wrote: I note that this commit (probably unintentionally) fixed an issue with the `-Wnonnull` warning for return values in Objective-C++ code. Previously, `id _Nonnull foo() { return nullptr; }` does not warn under `clang -fobjc-arc -target x86_64-apple-macos11 -x objective-c++

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

2024-03-29 Thread via cfe-commits
dyung wrote: The reapplication of this change in bbbcc1d is causing many build bots to fail due to a missing header file as outlined in #87023. The failing bots include the following: - https://lab.llvm.org/buildbot/#/builders/188/builds/43765 -

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

2024-03-14 Thread Tom Honermann via cfe-commits
@@ -201,6 +201,21 @@ Attribute Changes in Clang and each must be a positive integer when provided. The parameter ``x`` is required, while ``y`` and ``z`` are optional with default value of 1. +- The ``_Nullable`` and ``_Nonnull`` family of type attributes can now apply +

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

2024-03-14 Thread Tom Honermann via cfe-commits
@@ -201,6 +201,21 @@ Attribute Changes in Clang and each must be a positive integer when provided. The parameter ``x`` is required, while ``y`` and ``z`` are optional with default value of 1. +- The ``_Nullable`` and ``_Nonnull`` family of type attributes can now apply +

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

2024-03-14 Thread Sam McCall via cfe-commits
https://github.com/sam-mccall closed https://github.com/llvm/llvm-project/pull/82705 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2024-03-14 Thread Sam McCall via cfe-commits
https://github.com/sam-mccall updated https://github.com/llvm/llvm-project/pull/82705 >From ebf37038879e6b7ea2a315f267dc1dfe10a12c41 Mon Sep 17 00:00:00 2001 From: Sam McCall Date: Thu, 22 Feb 2024 16:00:44 +0100 Subject: [PATCH 1/5] [clang][nullability] allow _Nonnull etc on nullable class

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

2024-03-13 Thread Sam McCall via cfe-commits
https://github.com/sam-mccall updated https://github.com/llvm/llvm-project/pull/82705 >From eccc46840e343e7ba15200cd4b81316a51c46943 Mon Sep 17 00:00:00 2001 From: Sam McCall Date: Thu, 22 Feb 2024 16:00:44 +0100 Subject: [PATCH 1/4] [clang][nullability] allow _Nonnull etc on nullable class

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

2024-03-13 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman approved this pull request. LGTM though there may be a minor change to the docs that could make sense (feel free to change when landing if you agree). https://github.com/llvm/llvm-project/pull/82705 ___ cfe-commits

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

2024-03-13 Thread Aaron Ballman via cfe-commits
@@ -4096,6 +4096,18 @@ non-underscored keywords. For example: @property (assign, nullable) NSView *superview; @property (readonly, nonnull) NSArray *subviews; @end + +As well as built-in pointer types, the nullability attributes can be attached +to C++ classes

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

2024-03-13 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman edited https://github.com/llvm/llvm-project/pull/82705 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2024-03-13 Thread Aaron Ballman via cfe-commits
@@ -215,6 +215,18 @@ void Sema::inferGslOwnerPointerAttribute(CXXRecordDecl *Record) { inferGslPointerAttribute(Record, Record); } +void Sema::inferNullableClassAttribute(CXXRecordDecl *CRD) { + static llvm::StringSet<> Nullable{ + "auto_ptr", "shared_ptr",

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

2024-03-13 Thread Aaron Ballman via cfe-commits
@@ -1494,6 +1494,15 @@ void Parser::ParseMicrosoftInheritanceClassAttributes(ParsedAttributes ) { } } +void Parser::ParseNullabilityClassAttributes(ParsedAttributes ) { + while (Tok.is(tok::kw__Nullable)) { AaronBallman wrote: With other attributes,

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

2024-03-13 Thread Aaron Ballman via cfe-commits
@@ -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 =

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

2024-03-11 Thread Sam McCall via cfe-commits
https://github.com/sam-mccall updated https://github.com/llvm/llvm-project/pull/82705 >From eccc46840e343e7ba15200cd4b81316a51c46943 Mon Sep 17 00:00:00 2001 From: Sam McCall Date: Thu, 22 Feb 2024 16:00:44 +0100 Subject: [PATCH 1/3] [clang][nullability] allow _Nonnull etc on nullable class

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

2024-03-11 Thread Sam McCall via cfe-commits
https://github.com/sam-mccall updated https://github.com/llvm/llvm-project/pull/82705 >From eccc46840e343e7ba15200cd4b81316a51c46943 Mon Sep 17 00:00:00 2001 From: Sam McCall Date: Thu, 22 Feb 2024 16:00:44 +0100 Subject: [PATCH 1/2] [clang][nullability] allow _Nonnull etc on nullable class

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

2024-03-11 Thread Sam McCall via cfe-commits
@@ -5955,6 +5955,20 @@ static void handleBuiltinAliasAttr(Sema , Decl *D, D->addAttr(::new (S.Context) BuiltinAliasAttr(S.Context, AL, Ident)); } +static void handleNullableTypeAttr(Sema , Decl *D, const ParsedAttr ) { + if (AL.isUsedAsTypeAttr()) +return; + + if

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

2024-03-11 Thread Sam McCall via cfe-commits
@@ -215,6 +215,18 @@ void Sema::inferGslOwnerPointerAttribute(CXXRecordDecl *Record) { inferGslPointerAttribute(Record, Record); } +void Sema::inferNullableClassAttribute(CXXRecordDecl *CRD) { + static llvm::StringSet<> Nullable{ + "auto_ptr", "shared_ptr",

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

2024-03-11 Thread Sam McCall via cfe-commits
https://github.com/sam-mccall edited https://github.com/llvm/llvm-project/pull/82705 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2024-03-11 Thread Sam McCall via cfe-commits
@@ -1494,6 +1494,15 @@ void Parser::ParseMicrosoftInheritanceClassAttributes(ParsedAttributes ) { } } +void Parser::ParseNullabilityClassAttributes(ParsedAttributes ) { + while (Tok.is(tok::kw__Nullable)) { sam-mccall wrote: It's not important that we

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

2024-03-11 Thread Sam McCall via cfe-commits
@@ -4096,6 +4096,11 @@ non-underscored keywords. For example: @property (assign, nullable) NSView *superview; @property (readonly, nonnull) NSArray *subviews; @end + +As well as built-in pointer types, ithe nullability attributes can be attached +to nullable

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

2024-03-11 Thread Sam McCall via cfe-commits
@@ -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 =

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

2024-03-07 Thread Dmitri Gribenko via cfe-commits
@@ -96,8 +146,16 @@ void AssignAndInitNonNullFromFn() { void *_Nonnull nonnull; nonnull = ReturnNullable(); // expected-warning{{implicit conversion from nullable pointer 'void * _Nullable' to non-nullable pointer type 'void * _Nonnull'}} nonnull = {ReturnNullable()};

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

2024-03-01 Thread Sam McCall via cfe-commits
https://github.com/sam-mccall edited https://github.com/llvm/llvm-project/pull/82705 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2024-03-01 Thread Sam McCall via cfe-commits
https://github.com/sam-mccall edited https://github.com/llvm/llvm-project/pull/82705 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits