blob: f7b38d8d0fdd6e7fd6734950ffe7a26cc1ea7019 [file] [log] [blame]
// 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);
}