Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 79 additions & 0 deletions .ci/linters/cocci/accessor_call_in_loop.cocci
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
/* Hoist accessor calls on loop-invariant variables out of loops */
@accessed@
identifier acc = {RAW, RAW_RO, LOGICAL, LOGICAL_RO, INTEGER, INTEGER_RO, REAL, REAL_RO, COMPLEX, COMPLEX_RO, STRING_PTR_RO};
idexpression x;
@@
acc(x)
@@
identifier acc = {RAW, RAW_RO, LOGICAL, LOGICAL_RO, INTEGER, INTEGER_RO, REAL, REAL_RO, COMPLEX, COMPLEX_RO, STRING_PTR_RO};
idexpression accessed.x;
expression I, e;
constant C;
statement S;
@@
(
for (...;...;x = e) S
|
for (...;...;...) {
... when any
x = e
... when any
}
|
while (...) {
... when any
x = e
... when any
}
|
do {
... when any
x = e
... when any
} while (...);
|
for (...;...;...) {
... when any
(
acc(x)[C]
|
* acc(x)[I]
)
... when any
}
|
while (...) {
... when any
(
acc(x)[C]
|
* acc(x)[I]
)
... when any
}
|
do {
... when any
(
acc(x)[C]
|
* acc(x)[I]
)
... when any
} while (...);
|
for (...; <+... acc(x)[C] ...+>; ...) S
|
while (<+... acc(x)[C] ...+>) S
|
for (...;
<+...
* acc(x)[I]
...+>;
...) S
|
while (
<+...
* acc(x)[I]
...+>) S
)
Loading