brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.2 KiB · 2cb0208 Raw
30 lines · cpp
1// RUN: %check_clang_tidy -check-suffix=REMOVE %s modernize-use-auto %t -- \2// RUN:   -config="{CheckOptions: {modernize-use-auto.RemoveStars: 'true', modernize-use-auto.MinTypeNameLength: '0'}}"3// RUN: %check_clang_tidy %s modernize-use-auto %t -- \4// RUN:   -config="{CheckOptions: {modernize-use-auto.RemoveStars: 'false', modernize-use-auto.MinTypeNameLength: '0'}}"5 6void pointerToFunction() {7  void (*(*(f1)))() = static_cast<void (**)()>(nullptr);8  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use auto when initializing9  // CHECK-FIXES-REMOVE: auto f1 = static_cast<void (**)()>(nullptr);10  // CHECK-FIXES: auto *f1 = static_cast<void (**)()>(nullptr);11}12 13void pointerToArray() {14  int(*a1)[2] = new int[10][2];15  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use auto when initializing16  // CHECK-FIXES-REMOVE: auto a1 = new int[10][2];17  // CHECK-FIXES: auto *a1 = new int[10][2];18}19 20void memberFunctionPointer() {21  class A {22    void f();23  };24  void(A::* a1)() = static_cast<void(A::*)()>(nullptr);25  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use auto when initializing26  // CHECK-FIXES-REMOVE: auto a1 = static_cast<void(A::*)()>(nullptr);27  // CHECK-FIXES: auto *a1 = static_cast<void(A::*)()>(nullptr);28}29 30