================
@@ -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();
----------------
steakhal wrote:

Good point!

`SVal::getType` should be avoided unless it's infeasible to avoid in the 
context because the type it returns may differ from the actual type that was 
lost during translating from C++ to the abstract domain in the abstract machine 
(aka. we approximated something on the way).

Anyway, I believe you could use the proper type by considering the following:
`E` is either `CXXConstructExpr` or `CXXInheritedCtorInitExpr` according to the 
assert at the beginning of the function.
In both of these we have a `getConstructor()` that should give us the 
`CXXMethodDecl` and it's `getParent()` should be the `CXXRecordDecl`.


https://github.com/llvm/llvm-project/pull/138594
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to