[clang] [StaticAnalyzer] Make it a noop when initializing a field of empty record (PR #138594)

via cfe-commits cfe-commits at lists.llvm.org
Mon May 5 17:32:19 PDT 2025


================
@@ -715,7 +717,11 @@ void ExprEngine::handleConstructor(const Expr *E,
         // actually make things worse. Placement new makes this tricky as well,
         // since it's then possible to be initializing one part of a multi-
         // dimensional array.
-        State = State->bindDefaultZero(Target, LCtx);
+        const CXXRecordDecl *TargetHeldRecord =
+            Target.getType(Ctx)->getPointeeCXXRecordDecl();
----------------
isuckatcs wrote:

Nit: are you sure, we always know the target type? If yes, please assert it, if not, please handle the potential `nullptr` dereference.

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


More information about the cfe-commits mailing list