[clang] [analyzer] Unroll loops of compile-time upper-bounded loops (PR #169400)
Gábor Horváth via cfe-commits
cfe-commits at lists.llvm.org
Tue Nov 25 03:05:46 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"));
----------------
Xazax-hun wrote:
Could we run into any problems if the expression did not have an integer type?
E.g. one could have:
```
for (... ; loopVar < MyWeirdType{}; ...) ;
```
Where `MyWeirdType` has an overloaded `operator<`. Maybe it is fine as the overloaded operators would not be found by the matchers below.
https://github.com/llvm/llvm-project/pull/169400
More information about the cfe-commits
mailing list