[PATCH] D152269: [StaticAnalyzer] Fix false negative on NilArgChecker when creating literal object
tripleCC via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Jun 6 19:09:01 PDT 2023
tripleCC added inline comments.
================
Comment at: clang/test/Analysis/NSContainers.m:336-337
+void testCreateArrayLiteralWithNullableArg() {
+ (void)@[getNonnullFoo()]; // no warning
+ (void)@[getNullableFoo()]; // expected-warning {{Nullable pointer is passed to a callee that requires a non-null}}
+}
----------------
steakhal wrote:
> How about the case when it calls a `Foo * getMightBeNullFoo();`? I guess, it would still raise an issue, even though we couldn't prove that it must be null.
I have added the `Foo * getMightBeNullFoo();` test case. It would not raise an issue actually because without tracked nullability, the NullabilityChecker does not produce warnings. You can check the logic in the checkEvent function for this part
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D152269/new/
https://reviews.llvm.org/D152269
More information about the cfe-commits
mailing list