[all-commits] [llvm/llvm-project] b22a5d: [analyzer] Fix false negative when pass implicit c...
tripleCC via All-commits
all-commits at lists.llvm.org
Thu Jul 6 07:37:11 PDT 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: b22a5d46179b0ec2d5350c078dc349f09177b9ed
https://github.com/llvm/llvm-project/commit/b22a5d46179b0ec2d5350c078dc349f09177b9ed
Author: songruiwang <songruiwang at kuaishou.com>
Date: 2023-07-06 (Thu, 06 Jul 2023)
Changed paths:
M clang/lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp
M clang/test/Analysis/nullability-arc.mm
M clang/test/Analysis/nullability.mm
Log Message:
-----------
[analyzer] Fix false negative when pass implicit cast nil to nonnull
We should look through implicit casts before determining the type of the arguments, and only allow explicit cast to _Nonnull to suppress warning
```
void foo(NSString *_Nonnull);
foo((NSString * _Nonnull)nil); // no-warning
id obj = nil;
foo(obj); // should warning here (implicit cast id to NSString *_Nonnull)
```
Reviewed By: xazax.hun, steakhal
Differential Revision: https://reviews.llvm.org/D154221
More information about the All-commits
mailing list