brintos

brintos / llvm-project-archived public Read only

0
0
Text · 796 B · 8985697 Raw
22 lines · cpp
1// RUN: %check_clang_tidy -std=c++11,c++14,c++17,c++20 %s misc-const-correctness %t -- \2// RUN:   -config="{CheckOptions: {\3// RUN:     misc-const-correctness.TransformValues: true, \4// RUN:     misc-const-correctness.WarnPointersAsValues: false, \5// RUN:     misc-const-correctness.WarnPointersAsPointers: false, \6// RUN:     misc-const-correctness.TransformPointersAsValues: false \7// RUN:   }}" -- -fno-delayed-template-parsing8 9 10double &non_const_ref_return() {11  double p_local0 = 0.0;12  // CHECK-MESSAGES: [[@LINE-1]]:3: warning: variable 'p_local0' of type 'double' can be declared 'const'13  // CHECK-FIXES: double const p_local0 = 0.0;14  double np_local0 = 42.42;15  return np_local0;16}17 18double *&return_non_const_pointer_ref() {19  double *np_local0 = nullptr;20  return np_local0;21}22