[llvm-branch-commits] [clang-tools-extra] [clang-tidy] treat unsigned char and signed char as char type by default in bugprone-unintended-char-ostream-output (PR #134870)

Donát Nagy via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Apr 9 04:31:35 PDT 2025


================
@@ -42,6 +42,14 @@ Or cast to char to explicitly indicate that output should be a character.
 Options
 -------
 
+.. option:: AllowedTypes
+
+  A semicolon-separated list of type names that will be treated as ``char``
+  type. It only contains the non canonical type names without the alias of type
+  names. Explicit casting to these types or use the variable defined with these
+  types will be ignored.
----------------
NagyDonat wrote:

```suggestion
  A semicolon-separated list of type names that will be treated like the ``char``
  type: the check will not report variables declared with with these types or
  explicit cast expressions to these types. Note that this distinguishes type
  aliases from the original type, so specifying e.g. ``unsigned char`` here
  will not suppress reports about ``uint8_t`` even if it is defined as a
  ``typedef`` alias for ``unsigned char``.
```

The sentence "It only contains the non canonical type names without the alias of type names." was very difficult to understand, so I suggested an alternative (more verbose and – let's hope – more clear) phrasing. However, I'm not 100% sure that I understood the intended meaning correctly, so please check it and correct it if it's misleading or inaccurate.

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


More information about the llvm-branch-commits mailing list