[clang] [clang][dataflow] Correctly handle `InitListExpr` of union type. (PR #82348)
via cfe-commits
cfe-commits at lists.llvm.org
Wed Feb 21 00:13:35 PST 2024
================
@@ -731,6 +723,18 @@ class TransferVisitor : public ConstStmtVisitor<TransferVisitor> {
FieldLocs.insert({Field, &Loc});
}
+ // In the case of a union, we don't in general have initializers for all
+ // of the fields. Create storage locations for the remaining fields (but
+ // don't associate them with values).
+ if (Type->isUnionType()) {
+ for (const FieldDecl *Field :
+ Env.getDataflowAnalysisContext().getModeledFields(Type)) {
+ if (!FieldLocs.contains(Field))
+ FieldLocs.insert(
----------------
martinboehme wrote:
Good idea -- done!
https://github.com/llvm/llvm-project/pull/82348
More information about the cfe-commits
mailing list