Skip to content

Commit dd39fa0

Browse files
committed
C++: Support C++20 range-based for initializers
1 parent da3ff48 commit dd39fa0

31 files changed

+9498
-195
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
class Element extends @element {
2+
string toString() { none() }
3+
}
4+
5+
class Expr extends @expr {
6+
string toString() { none() }
7+
}
8+
9+
class Stmt extends @stmt {
10+
string toString() { none() }
11+
}
12+
13+
predicate isStmtWithInitializer(Stmt stmt) { exists(int kind | stmts(stmt, kind, _) | kind = 29) }
14+
15+
from Expr child, int index, int index_new, Element parent
16+
where
17+
exprparents(child, index, parent) and
18+
if isStmtWithInitializer(parent) then index_new = index - 1 else index_new = index
19+
select child, index_new, parent
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
class Stmt extends @stmt {
2+
string toString() { none() }
3+
}
4+
5+
from Stmt f, Stmt i
6+
where
7+
for_initialization(f, i) and
8+
f instanceof @stmt_for
9+
select f, i

0 commit comments

Comments
 (0)