blob: f7b38d8d0fdd6e7fd6734950ffe7a26cc1ea7019 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
// RUN: $(dirname %s)/check_clang_tidy.sh %s readability-else-after-return %t
// REQUIRES: shell
void f(int a) {
if (a > 0)
return;
else // comment
// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: don't use else after return
// CHECK-FIXES: {{^}} // comment
return;
if (a > 0) {
return;
} else { // comment
// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: don't use else after return
// CHECK-FIXES: } // comment
return;
}
if (a > 0) {
f(0);
if (a > 10)
return;
} else {
return;
}
if (a > 0)
f(0);
else if (a > 10)
return;
else
f(0);
}
|