[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


================
@@ -0,0 +1,40 @@
+// RUN: %check_clang_tidy %s bugprone-unintended-char-ostream-output %t -check-suffix=WARN-EXPLICIT-CAST
+// RUN: %check_clang_tidy %s bugprone-unintended-char-ostream-output %t \
+// RUN:   -config='{CheckOptions: { \
+// RUN:       bugprone-unintended-char-ostream-output.WarnOnExplicitCast: false, \
----------------
vbvictor wrote:

Is the logic of this flag is inverted?
When we set `WarnOnExplicitCast` to _false_ according to docs we should not get diagnostics on cases like 
```cpp
os << static_cast<unsigned char>(v);
```
But here we do get diagnostics and CHECK-FIXES which is incorrect.

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


More information about the cfe-commits mailing list