[clang] [analyzer] Unroll loops of compile-time upper-bounded loops (PR #169400)

Balázs Benics via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 25 03:26:04 PST 2025


================
@@ -84,15 +84,17 @@ ProgramStateRef processLoopEnd(const Stmt *LoopStmt, ProgramStateRef State) {
 
 static internal::Matcher<Stmt> simpleCondition(StringRef BindName,
                                                StringRef RefName) {
+  auto LoopVariable = ignoringParenImpCasts(
+      declRefExpr(to(varDecl(hasType(isInteger())).bind(BindName)))
+          .bind(RefName));
+  auto UpperBound = ignoringParenImpCasts(expr().bind("boundNum"));
----------------
steakhal wrote:

WDYT of this one https://github.com/llvm/llvm-project/pull/169400/commits/a7769ed2fa412b8dfab3897a10450f81a2e74aae

I had to apply some refactors to not confuse name lookups (the ambiguities were brought by the AST_MATCHER macro), which I didn't quite like.

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


More information about the cfe-commits mailing list