Code & Deploy
siGit Code
Git Hosting
Toggle menu
Code
Code Review
Models
Repos
Sign in
Sign in
@samitouri
/
QOSamiQemu
QOSamiQemu
/
scripts
/
coccinelle
/
return_directly.cocci
Code
Commits
Issues
Pulls
Sessions
CI/CD
master
master
cocci
18 lines
233 Bytes
Copy permalink
Copy
Raw
1
// replace 'R = X; return R;' with 'return X;'
2
@@
3
identifier VAR;
4
expression E;
5
type T;
6
identifier F;
7
@@
8
T F(...)
9
{
10
...
11
- T VAR;
12
... when != VAR
13
14
- VAR = (E);
15
- return VAR;
16
+ return E;
17
... when != VAR
18
}