diff options
author | tripleCC <tripleCC@users.noreply.github.com> | 2023-10-04 08:38:10 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-04 08:38:10 +0800 |
commit | 1dceba3a3684d12394731e09a6cf3efcebf07a3a (patch) | |
tree | ee51a4dc4457908af9b09ef187e96a82ae34b317 /llvm/lib/Object/ObjectFile.cpp | |
parent | a6cdbba4d68c9387e560c026320772d383be3d52 (diff) | |
download | llvm-1dceba3a3684d12394731e09a6cf3efcebf07a3a.zip llvm-1dceba3a3684d12394731e09a6cf3efcebf07a3a.tar.gz llvm-1dceba3a3684d12394731e09a6cf3efcebf07a3a.tar.bz2 |
[analyzer] Fix false negative when accessing a nonnull property from … (#67563)
```
@interface A : NSObject
@property (nonnull, nonatomic, strong) NSString *name;
+ (nullable instancetype)shared;
@end
@[[A shared].name];
```
Consider the code above, the nullability of the name property should
depend on the result of the shared method. A warning is expected because
of adding a nullable object to array.
ObjCMessageExpr gets the actual type through
Sema::getMessageSendResultType, instead of using the return type of
MethodDecl directly. The final type is generated by considering the
nullability of receiver and MethodDecl together.
Thus, the RetType in NullabilityChecker should all be replaced with
M.getOriginExpr()->getType().
Co-authored-by: tripleCC <triplecc@gmail.com>
Diffstat (limited to 'llvm/lib/Object/ObjectFile.cpp')
0 files changed, 0 insertions, 0 deletions