[PATCH] D77836: [Attribute] Fix noderef attribute false-negatives
Leonard Chan via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Apr 13 16:52:58 PDT 2020
leonardchan added inline comments.
================
Comment at: clang/lib/Sema/SemaInit.cpp:8182-8184
+ // Do not check static casts here because they are checked earlier
+ // in Sema::ActOnCXXNamedCast()
+ if (!Kind.isStaticCast()) {
----------------
leonardchan wrote:
> rsmith wrote:
> > Are there any `static_cast` cases that don't get here? I'm also a little surprised that `static_cast` would get here but the `static_cast` interpretation of a C-style or functional cast would not.
> I'll double check on this. The reason I added this here was because the cast in `static_cast_from_same_ptr_type()` triggered 2 of the `warn_noderef_to_dereferenceable_pointer` warnings and one of them was triggered here.
Yeah it seems the `int *a = static_cast<int *>(x);` case in `cast_from_void_ptr()` is an example of a static_cast that doesn't go through here.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D77836/new/
https://reviews.llvm.org/D77836
More information about the cfe-commits
mailing list