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

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


================
@@ -3447,6 +3461,22 @@ void ExprEngine::VisitArrayInitLoopExpr(const ArrayInitLoopExpr *Ex,
   getCheckerManager().runCheckersForPostStmt(Dst, EvalSet, Ex, *this);
 }
 
+void ExprEngine::VisitPackIndexingExpr(const PackIndexingExpr *E,
+                                       ExplodedNode *Pred,
+                                       ExplodedNodeSet &Dst) {
+  if (!E->isFullySubstituted()) {
+    llvm_unreachable("Unsubstituted pack indexing expression");
+  }
+
+  if (const auto *DRE = dyn_cast<DeclRefExpr>(E->getSelectedExpr())) {
+    VisitCommonDeclRefExpr(E, DRE->getDecl(), Pred, Dst);
+    return;
+  }
+
+  StmtNodeBuilder Bldr(Pred, Dst, *currBldrCtx);
+  Bldr.generateSink(E, Pred, Pred->getState());
----------------
lbonn wrote:

Looking at #149759, I have found the SubstNonTypeTemplateParmExpr case. I am not completely sure how to handle it properly yet (I am not so familiar Analyzer and clang in general), so I have added back a sink node in this case following the pattern in other parts of partially implemented ExprEngine.cpp.

If you think a `SimpleProgramPointTag` would still help, I can also change it to that but I did not see it for partially implemented paths?

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


More information about the cfe-commits mailing list