blob: 504043f30860c70afc72d23da11d176fd18feee5 (
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
36
|
// RUN: %check_clang_tidy %s readability-braces-around-statements %t -- -config="{CheckOptions: [{key: readability-braces-around-statements.ShortStatementLines, value: 1}]}" --
void do_something(const char *) {}
bool cond(const char *) {
return false;
}
void test() {
if (cond("if1") /*comment*/) do_something("same-line");
if (cond("if2"))
do_something("single-line");
// CHECK-MESSAGES: :[[@LINE-2]]:19: warning: statement should be inside braces
// CHECK-FIXES: if (cond("if2")) {
// CHECK-FIXES: }
if (cond("if3") /*comment*/)
// some comment
do_something("three"
"lines");
// CHECK-MESSAGES: :[[@LINE-4]]:31: warning: statement should be inside braces
// CHECK-FIXES: if (cond("if3") /*comment*/) {
// CHECK-FIXES: }
if (cond("if4") /*comment*/)
// some comment
do_something("many"
"many"
"many"
"many"
"lines");
// CHECK-MESSAGES: :[[@LINE-7]]:31: warning: statement should be inside braces
// CHECK-FIXES: if (cond("if4") /*comment*/) {
// CHECK-FIXES: }
}
|