brintos

brintos / llvm-project-archived public Read only

0
0
Text · 801 B · ac898ba Raw
31 lines · cpp
1// RUN: %check_clang_tidy %s readability-braces-around-statements %t -- -config="{CheckOptions: {readability-braces-around-statements.ShortStatementLines: 4}}" --2 3void do_something(const char *) {}4 5bool cond(const char *) {6  return false;7}8 9void test() {10  if (cond("if1") /*comment*/) do_something("same-line");11 12  if (cond("if2"))13    do_something("single-line");14 15  if (cond("if3") /*comment*/)16    // some comment17    do_something("three"18                 "lines");19 20  if (cond("if4") /*comment*/)21    // some comment22    do_something("many"23                 "many"24                 "many"25                 "many"26                 "lines");27  // CHECK-MESSAGES: :[[@LINE-7]]:31: warning: statement should be inside braces28  // CHECK-FIXES: if (cond("if4") /*comment*/) {29  // CHECK-FIXES: }30}31