rsmith added a comment. > There are also no argument expressions, even though the inherited constructor > for `A` takes one argument `x`. The current patch takes argument expressions > from the topmost `CXXConstructExpr`, which also requires a different location > context to access. As far as i can see, the result of such substitution is > always correct, i.e., the resulting argument `SVal` obtained from the > `Environment` this way will always be `evalBinOp`-equal to the correct > argument value.
Just in case this isn't clear: the reason why `CXXInheritedCtorInitExpr` doesn't take arguments and doesn't model parameter initialization is because there is none: the arguments in the outer `CXXConstructExpr` directly initialize the parameters of the base class constructor, and no copies are made. (Making a copy of the parameter is incorrect, at least if it's done in an observable way.) The derived class constructor doesn't even exist in the formal model. Eg, in: struct X { X *p = this; ~X() {} }; struct A { A(X x) : b(x.p == &x) {} bool b; }; struct B : A { using A::A; }; B b = X{}; ... `b.b` is initialized to `true`. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D74735/new/ https://reviews.llvm.org/D74735 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits