================
@@ -465,7 +465,12 @@ class ResultObjectVisitor : public
AnalysisASTVisitor<ResultObjectVisitor> {
}
if (auto *DIE = dyn_cast<CXXDefaultInitExpr>(E)) {
- PropagateResultObject(DIE->getExpr(), Loc);
+ // If it has a rewritten init, we should propagate to that. If it
doesn't,
+ // then the CXXDefaultInitExpr is the only initializer available during
+ // the analysis as the underlying Expr is only traversed as a child of
the
+ // Decl being initialized, which is not usually in the CFG.
+ if (DIE->hasRewrittenInit())
----------------
bazuzi wrote:
I was working off of a now-out-of-date understanding of CFG-building (from this
version:
https://github.com/llvm/llvm-project/blob/905b402a5d8f1490d668f40942390ebd6e87aa8f/clang/lib/Analysis/CFG.cpp)
where the underlying initializer was added to the CFG only when the init was
rewritten. That functionality was then reverted.
Additional complexity comes in from the CFG-building option
AddCXXDefaultInitExprInCtors, which is set true for dataflow analyses, causing
the underlying initializers to be included in CFGs for constructors only.
It seemed to me that we don't want to propagate if the underlying initializer
is not included in the CFG, but detection of that characteristic is not
directly available.
@martinboehme and @ymand this is a continuation of our discussions.
https://github.com/llvm/llvm-project/pull/99236
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits