brintos

brintos / llvm-project-archived public Read only

0
0
Text · 929 B · 0401caa Raw
20 lines · cpp
1// RUN: %check_clang_tidy %s misc-const-correctness %t \2// RUN: -config='{CheckOptions: {\3// RUN:   misc-const-correctness.AnalyzeValues: false,\4// RUN:   misc-const-correctness.AnalyzeReferences: false,\5// RUN:   misc-const-correctness.AnalyzePointers: true,\6// RUN:   misc-const-correctness.WarnPointersAsValues: true,\7// RUN:   misc-const-correctness.WarnPointersAsPointers: true,\8// RUN:   misc-const-correctness.TransformPointersAsValues: true,\9// RUN:   misc-const-correctness.TransformPointersAsPointers: true\10// RUN: }}' \11// RUN: -- -fno-delayed-template-parsing12 13void pointee_to_const() {14  int a[] = {1, 2};15  int *p_local0 = &a[0];16  // CHECK-MESSAGES: [[@LINE-1]]:3: warning: pointee of variable 'p_local0' of type 'int *' can be declared 'const'17  // CHECK-MESSAGES: [[@LINE-2]]:3: warning: variable 'p_local0' of type 'int *' can be declared 'const'18  // CHECK-FIXES: int  const*const p_local0 = &a[0];19}20