| // RUN: %check_clang_tidy %s bugprone-suspicious-semicolon %t |
| // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: potentially unintended semicolon [bugprone-suspicious-semicolon] |
| // CHECK-FIXES: if(x > 5) nop(); |
| // CHECK-MESSAGES: :[[@LINE-2]]:12: warning: potentially unintended semicolon [bugprone-suspicious-semicolon] |
| // CHECK-FIXES: if(x == 5){{$}} |
| // CHECK-MESSAGES: :[[@LINE-4]]:11: warning: potentially unintended semicolon |
| // CHECK-FIXES: if(x < 5){{$}} |
| for(int i = 0; i < x; ++i) |
| for(int i = 0; i < x; ++i); |
| // CHECK-MESSAGES: :[[@LINE-2]]:28: warning: potentially unintended semicolon |
| // CHECK-FIXES: for(int i = 0; i < x; ++i){{$}} |
| // CHECK-MESSAGES: :[[@LINE-2]]:16: warning: potentially unintended semicolon |
| // CHECK-FIXES: if(x % 5 == 1){{$}} |
| // CHECK-MESSAGES: :[[@LINE-2]]:21: warning: potentially unintended semicolon |
| // CHECK-FIXES: } else if (a != 1){{$}} |
| // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: potentially unintended semicolon |
| if (s == "(" || s != "'" || c == '"') { |
| return (c == ')' && c == '\''); |