[clang] [analyzer] Support parenthesized list initialization (CXXParenListInitExpr) (PR #148988)

Balazs Benics via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 17 10:31:12 PDT 2025


================
@@ -4114,3 +4124,35 @@ void *ProgramStateTrait<ReplayWithoutInlining>::GDMIndex() {
 }
 
 void ExprEngine::anchor() { }
+
+void ExprEngine::ConstructInitList(const Expr *E, ArrayRef<Expr *> Args,
+                                   bool IsTransparent, ExplodedNode *Pred,
+                                   ExplodedNodeSet &Dst) {
+  assert((isa<InitListExpr>(E) || isa<CXXParenListInitExpr>(E)) &&
+         "Expected InitListExpr or CXXParenListInitExpr");
+
+  const LocationContext *LC = Pred->getLocationContext();
+
+  StmtNodeBuilder B(Pred, Dst, *currBldrCtx);
+  ProgramStateRef S = Pred->getState();
+  QualType T = E->getType().getCanonicalType();
+
+  bool IsCompound =
+      E->isPRValue() && (T->isArrayType() || T->isRecordType() ||
+                         T->isAnyComplexType() || T->isVectorType());
----------------
steakhal wrote:

By judging the name `IsCompound`, I was expecting `E->isPRValue()` being separated.

https://github.com/llvm/llvm-project/pull/148988


More information about the cfe-commits mailing list