[clang-tools-extra] [clang-tidy][bugprone-unintended-char-ostream-output] add `WarnOnExplicitCast` option (PR #133639)

Baranov Victor via cfe-commits cfe-commits at lists.llvm.org
Sun Mar 30 10:33:36 PDT 2025


================
@@ -39,6 +39,17 @@ Or cast to char to explicitly indicate that output should be a character.
 
   std::cout << static_cast<char>(v);
 
+Options
+-------
+
+.. option:: WarnOnExplicitCast
+
+  When `WarnOnExplicitCast` is set to `false`, the check will not warn when
+  output of ostream is explicitly cast to a ``unsigned char`` or ``signed char``.
+  Attention: Explicit casting cannot solve the any problem if the value is not
+  character.
----------------
vbvictor wrote:

```suggestion
  a character.
```

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


More information about the cfe-commits mailing list