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

Balazs Benics via cfe-commits cfe-commits at lists.llvm.org
Wed May 7 02:50:18 PDT 2025


================
@@ -715,7 +716,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 =
+            dyn_cast_or_null<CXXRecordDecl>(CE->getType()->getAsRecordDecl());
----------------
steakhal wrote:

Can this be ever null? If not, shouldn't we rather use `llvm::cast<>` instead?

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


More information about the cfe-commits mailing list