[clang] [Clang] Added clang diagnostic when snprintf/vsnprintf uses sizeof(de… (PR #170637)
Oliver Hunt via cfe-commits
cfe-commits at lists.llvm.org
Mon Jan 19 13:02:49 PST 2026
================
@@ -1451,6 +1451,8 @@ void Sema::checkFortifiedBuiltinMemoryFunction(FunctionDecl *FD,
DestinationSize = ComputeSizeArgument(0);
const Expr *LenArg = TheCall->getArg(1)->IgnoreParenImpCasts();
const Expr *Dest = TheCall->getArg(0)->IgnoreParenImpCasts();
+ if (const auto *DestCast = dyn_cast_or_null<CastExpr>(Dest))
+ Dest = DestCast->getSubExprAsWritten();
----------------
ojhunt wrote:
Why as written rather than just `getSubExpr()`?
https://github.com/llvm/llvm-project/pull/170637
More information about the cfe-commits
mailing list