[clang] [Clang][Sema] Add -Wstringop-overread warning for source buffer overreads (PR #183004)
Erich Keane via cfe-commits
cfe-commits at lists.llvm.org
Tue Feb 24 14:58:19 PST 2026
================
@@ -1179,25 +1167,24 @@ void Sema::checkFortifiedBuiltinMemoryFunction(FunctionDecl *FD,
if (NewIndex >= TheCall->getNumArgs())
return std::nullopt;
return NewIndex;
- };
+ }
- auto ComputeExplicitObjectSizeArgument =
- [&](unsigned Index) -> std::optional<llvm::APSInt> {
+ std::optional<llvm::APSInt>
+ ComputeExplicitObjectSizeArgument(unsigned Index) {
std::optional<unsigned> IndexOptional = TranslateIndex(Index);
if (!IndexOptional)
return std::nullopt;
unsigned NewIndex = *IndexOptional;
Expr::EvalResult Result;
Expr *SizeArg = TheCall->getArg(NewIndex);
- if (!SizeArg->EvaluateAsInt(Result, getASTContext()))
+ if (!SizeArg->EvaluateAsInt(Result, S.getASTContext()))
return std::nullopt;
llvm::APSInt Integer = Result.Val.getInt();
Integer.setIsUnsigned(true);
----------------
erichkeane wrote:
What is going on here? Why are we changing the sign?
https://github.com/llvm/llvm-project/pull/183004
More information about the cfe-commits
mailing list