[clang-tools-extra] [clang-tidy] Fix a false positive when converting a bool to a signed integer type (PR #191696)

Zeyi Xu via cfe-commits cfe-commits at lists.llvm.org
Sun Apr 12 05:04:58 PDT 2026


================
@@ -402,6 +402,9 @@ void NarrowingConversionsCheck::handleIntegralCast(const ASTContext &Context,
       return;
     const BuiltinType *FromType = getBuiltinType(Rhs);
 
+    if (FromType->getKind() == BuiltinType::Bool)
----------------
zeyi2 wrote:

Also we already do similar dispatch in https://github.com/llvm/llvm-project/blob/b7febd772c57fc21a126a8e125d749df9e4a6a53/clang-tools-extra/clang-tidy/bugprone/NarrowingConversionsCheck.cpp#L522

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


More information about the cfe-commits mailing list