[clang-tools-extra] [clang-tidy] support pointee mutation check in misc-const-correctness (PR #130494)

Baranov Victor via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 11 10:31:04 PDT 2025


================
@@ -0,0 +1,50 @@
+// RUN: %check_clang_tidy %s misc-const-correctness %t \
----------------
vbvictor wrote:

I tried running test on small code with both of the options enabled.
```cpp
  int a[] = {1, 2};
  int *p_local0 = &a[0];
```
transformed to
```cpp
  int a[] = {1, 2};
  int *const p_local0 = &a[0];
```
However, when i run with two separate parameter i can get both `const` keywords.
```cpp
  int *const p_local0 = &a[0]; // With TransformPointersAsValues = true
  int const* p_local0 = &a[0]; // With TransformPointersAsPointers = true
```


https://github.com/llvm/llvm-project/pull/130494


More information about the cfe-commits mailing list