brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.1 KiB · 58eced4 Raw
25 lines · cpp
1// RUN: %check_clang_tidy -std=c++17 %s modernize-avoid-c-arrays %t2 3namespace X {4// Not main.5int main(int argc, char *argv[], char *argw[]) {6  // CHECK-MESSAGES: :[[@LINE-1]]:20: warning: do not declare C-style arrays, use 'std::array' or 'std::vector' instead7  // CHECK-MESSAGES: :[[@LINE-2]]:34: warning: do not declare C-style arrays, use 'std::array' or 'std::vector' instead8  int f4[] = {1, 2};9  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: do not declare C-style arrays, use 'std::array' instead10  return 0;11}12}13 14int main(int argc, char *argv[], char *argw[]) {15  int f5[] = {1, 2};16  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: do not declare C-style arrays, use 'std::array' instead17 18  auto main = [](int argc, char *argv[], char *argw[]) {19    // CHECK-MESSAGES: :[[@LINE-1]]:28: warning: do not declare C-style arrays, use 'std::array' or 'std::vector' instead20    // CHECK-MESSAGES: :[[@LINE-2]]:42: warning: do not declare C-style arrays, use 'std::array' or 'std::vector' instead21    int f6[] = {1, 2};22    // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: do not declare C-style arrays, use 'std::array' instead23  };24}25