[clang] [Webkit Checkers][SaferCpp] Fix MemoryUnsafeCastChecker to precisely exclude `*this` casts (PR #210180)

Ryosuke Niwa via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 16 14:47:51 PDT 2026


================
@@ -254,6 +254,9 @@ class CanMakeWeakPtrBase {
   void initializeWeakPtrFactory() const {
     auto &this_to_T = static_cast<const WeakPtrFactoryType&>(*this);
   }
+  void initializeWeakPtrFactoryReinterpret() const {
+    auto &this_to_T = reinterpret_cast<const WeakPtrFactoryType&>(*this);
----------------
rniwa wrote:

Hm... I think we want to only permit this type of cast when the type we're casting to is a CRTP parameter, not whenever we're casting `this` or `*this`.

https://github.com/llvm/llvm-project/pull/210180


More information about the cfe-commits mailing list