[clang] [analyzer] Support pack indexing expressions (PR #173186)

via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 23 04:20:19 PST 2025


================
@@ -3296,6 +3302,14 @@ void ExprEngine::VisitCommonDeclRefExpr(const Expr *Ex, const NamedDecl *D,
 
     SVal V = UnknownVal();
 
+    // For pack indexing expressions. Binding is not available here but through
+    // the expanded expressions in the PackIndexingExpr node.
+    if (BD->isParameterPack()) {
+      Bldr.generateNode(Ex, Pred, state->BindExpr(Ex, LCtx, V), nullptr,
----------------
lbonn wrote:

In this path, binding is actually absent (`getBinding()` returns null) and it fails at the next line `dyn_cast<MemberExpr>(BD->getBinding())` without this change.

>From my limited understanding, it is not about a sub-region of the pack here. We reach this node which is unsubstituted and instead we have to find the substitution in the `PackIndexingExpr::getSelectedExpr`. But I may be wrong!

In any case, I have removed UnknownVal here and added back a FIXME.

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


More information about the cfe-commits mailing list