[clang-tools-extra] [clang-tidy] added `IgnoreAliasing` option to `readability-qualified-auto check` (PR #147060)
Baranov Victor via cfe-commits
cfe-commits at lists.llvm.org
Tue Jul 15 11:20:02 PDT 2025
================
@@ -96,3 +96,49 @@ Note in the LLVM alias, the default value is `false`.
matched against only the type name (i.e. ``Type``). E.g. to suppress reports
for ``std::array`` iterators use `std::array<.*>::(const_)?iterator` string.
The default is an empty string.
+
+.. option:: IgnoreAliasing
+
+ If set to `true` the check will use the underlying type to determine the type
+ that ``auto`` is deduced to.
+ If set to `false` the check will not look beyond the first type alias.
+ Default value is `true`.
+
+.. code-block:: c++
+
+ using IntPtr = int*;
+ IntPtr foo();
+
+ auto bar = foo();
+
+If :option:`IgnoreAliasing` is set to `true`, it will be transformed into:
+
+.. code-block:: c++
+
+ auto *bar = foo();
+
+Otherwise no changes will occur.
+
+Limitations
+-----------
+
+When :option:`IgnoreAliasing` is set to `false`, there are cases where
+Clang has not preserved the type alias and the underlying type will be used so
+false positives may occur.
+For example:
+
+.. code-block:: c++
+
+ #include <vector>
+
+ void change(int&);
+
----------------
vbvictor wrote:
```suggestion
```
Maybe we could remove these lines and make `for-loop` just empty.
I suppose illustration will still be valid.
My point is that we should make examples short and precise
https://github.com/llvm/llvm-project/pull/147060
More information about the cfe-commits
mailing list