[clang] [dataflow] Fix crash when InitListExpr is not a prvalue (PR #80970)
Paul Semel via cfe-commits
cfe-commits at lists.llvm.org
Thu Feb 8 07:09:01 PST 2024
================
@@ -648,6 +648,12 @@ class TransferVisitor : public ConstStmtVisitor<TransferVisitor> {
QualType Type = S->getType();
if (!Type->isStructureOrClassType()) {
+ // It is possible that InitListExpr is not a prvalue, in which case
+ // `setValue` will fail. In this case, we can just let the next
+ // transfer function handle the value creation.
+ if (!S->isPRValue())
+ return;
+
if (auto *Val = Env.createValue(Type))
Env.setValue(*S, *Val);
----------------
paulsemel wrote:
Done!
https://github.com/llvm/llvm-project/pull/80970
More information about the cfe-commits
mailing list