JonasToth added inline comments.

================
Comment at: 
clang-tools-extra/test/clang-tidy/checkers/misc/const-correctness-pointer-as-values.cpp:27-30
+  for (const int *p_local1 : p_local0) {
+  // CHECK-MESSAGES: [[@LINE-1]]:8: warning: variable 'p_local1' of type 
'const int *' can be declared 'const'
+  // CHECK-FIXES: for (const int *const p_local1 : p_local0)
+  }
----------------
njames93 wrote:
> Wouldn't this behaviour be expected before the changes added in this patch, 
> as p_local1 isn't an array type.
the behaviour for `p_local1` does not change with the patch and is tested/moved 
here.

only `p_local0` has a behaviour change. this test file activates the analysis 
for `pointers-as-values`, so it must be diagnosed in this test file.
in the other test-file `-values.cpp` `p_local0` is not diagnosed, making it 
`np_local0`.

originally, the tests for the range based for loops lived in the `values` part 
of the tests. As this is incorrect for the pointer-arrays I moved them into 
this file instead (for pointer arrays).
the tests here mostly verify that the variables are properly matched and 
filtered. The actual analysis has its own unit tests for these cases.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D130793/new/

https://reviews.llvm.org/D130793

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to