[PATCH] D77836: [Attribute] Fix noderef attribute false-negatives
Richard Smith - zygoloid via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sat Apr 11 22:25:23 PDT 2020
rsmith added inline comments.
================
Comment at: clang/lib/Sema/SemaCast.cpp:264
+ CheckNoderef(*this, E->getType(), TInfo->getType(), OpLoc);
+
----------------
Warning on this seems reasonable for `static_cast` and `dynamic_cast`, but should `reinterpret_cast` (or the `reinterpret_cast` interpretation of a C-style cast) warn? Presumably we want to leave open some type system holes for the case where the programmer really does know what they're doing.
================
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()) {
----------------
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.
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