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

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


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff origin/main HEAD --extensions cpp,h -- clang/test/Analysis/pack_indexing.cpp clang/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h clang/lib/StaticAnalyzer/Core/ExprEngine.cpp --diff_from_common_commit
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp b/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp
index 6c9e46dcc..573580fed 100644
--- a/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp
+++ b/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp
@@ -3473,14 +3473,16 @@ void ExprEngine::VisitPackIndexingExpr(const PackIndexingExpr *E,
 
   if (const auto *DE = dyn_cast<DeclRefExpr>(E->getSelectedExpr())) {
     VisitCommonDeclRefExpr(E, DE->getDecl(), Pred, Dst);
-  } else if (const auto *SNTTPE = dyn_cast<SubstNonTypeTemplateParmExpr>(E->getSelectedExpr())) {
+  } else if (const auto *SNTTPE =
+                 dyn_cast<SubstNonTypeTemplateParmExpr>(E->getSelectedExpr())) {
     (void)SNTTPE;
     // FIXME: handle this case
     StmtNodeBuilder Bldr(Pred, Dst, *currBldrCtx);
     const ExplodedNode *node = Bldr.generateSink(E, Pred, Pred->getState());
     Engine.addAbortedBlock(node, currBldrCtx->getBlock());
   } else {
-    llvm_unreachable("Unexpected selected expression in pack indexing expression");
+    llvm_unreachable(
+        "Unexpected selected expression in pack indexing expression");
   }
 }
 

``````````

</details>


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


More information about the cfe-commits mailing list