[clang] [clang] Add diagnostic for usage of implicit constructor with pointer to bool convertion (PR #143990)
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Thu Jun 26 07:25:11 PDT 2025
================
@@ -11767,6 +11767,25 @@ static void CheckImplicitArgumentConversions(Sema &S, const CallExpr *TheCall,
SourceLocation CC) {
for (unsigned I = 0, N = TheCall->getNumArgs(); I < N; ++I) {
const Expr *CurrA = TheCall->getArg(I);
+
+ if (auto *MTE = dyn_cast<MaterializeTemporaryExpr>(CurrA))
+ // We shouldnt skip over any node here as it may be an attempt to silence
+ // the warning
+ if (auto *CCE = dyn_cast<CXXConstructExpr>(MTE->getSubExpr()))
----------------
AaronBallman wrote:
```suggestion
if (const auto *MTE = dyn_cast<MaterializeTemporaryExpr>(CurrA))
// We shouldnt skip over any node here as it may be an attempt to silence
// the warning.
if (const auto *CCE = dyn_cast<CXXConstructExpr>(MTE->getSubExpr()))
```
A few nits with the const correctness and the full stop at the end of the comment.
https://github.com/llvm/llvm-project/pull/143990
More information about the cfe-commits
mailing list