[PATCH] D104887: [clang] Evaluate strlen of strcpy argument for -Wfortify-source.

2021-07-28 Thread George Burgess IV via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rGe12e02df09a9: [clang] Evaluate strlen of strcpy argument for -Wfortify-source. (authored by mbenfield, committed by gbiv). Repository: rG LLVM Git

[PATCH] D104887: [clang] Evaluate strlen of strcpy argument for -Wfortify-source.

2021-07-20 Thread George Burgess IV via Phabricator via cfe-commits
george.burgess.iv accepted this revision. george.burgess.iv added a comment. This revision is now accepted and ready to land. lgtm -- thanks! please give a day for other reviewers to add any last minute comments, then i think we can land this. Comment at: clang/lib/Sema/SemaC

[PATCH] D104887: [clang] Evaluate strlen of strcpy argument for -Wfortify-source.

2021-07-19 Thread Michael Benfield via Phabricator via cfe-commits
mbenfield updated this revision to Diff 359955. mbenfield added a comment. Rebase. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D104887/new/ https://reviews.llvm.org/D104887 Files: clang/include/clang/AST/Expr.h clang/include/clang/Basic/Diagn

[PATCH] D104887: [clang] Evaluate strlen of strcpy argument for -Wfortify-source.

2021-07-18 Thread Michael Benfield via Phabricator via cfe-commits
mbenfield updated this revision to Diff 359655. mbenfield added a comment. Rebased and addressed comments. - Renamed ComputeCheckVariantSize. - const Expr *. - Changed existing test case to write only one excess byte. - Added new, non-diagnosing test case. Repository: rG LLVM Github Monore

[PATCH] D104887: [clang] Evaluate strlen of strcpy argument for -Wfortify-source.

2021-07-16 Thread Michael Benfield via Phabricator via cfe-commits
mbenfield added inline comments. Comment at: clang/lib/Sema/SemaChecking.cpp:739 DiagID = diag::warn_fortify_source_size_mismatch; -SizeIndex = TheCall->getNumArgs() - 1; -ObjectIndex = 0; +SourceSize = ComputeCheckVariantSize(TheCall->getNumArgs() - 1); +Des

[PATCH] D104887: [clang] Evaluate strlen of strcpy argument for -Wfortify-source.

2021-07-16 Thread Michael Benfield via Phabricator via cfe-commits
mbenfield added inline comments. Comment at: clang/lib/AST/ExprConstant.cpp:15737 + +// Fall through to slow path. + } cjdb wrote: > This comment is slightly different to the RHS: does that mean that a > diagnostic might not be issued? I just didn't find th

[PATCH] D104887: [clang] Evaluate strlen of strcpy argument for -Wfortify-source.

2021-07-15 Thread Christopher Di Bella via Phabricator via cfe-commits
cjdb added a comment. Thanks for getting around to this! Just a nit and a clarifying question. Comment at: clang/include/clang/Basic/DiagnosticSemaKinds.td:821 + "'%0' will always overflow; destination buffer has size %1," + " but the source string has length %2 (including nu

[PATCH] D104887: [clang] Evaluate strlen of strcpy argument for -Wfortify-source.

2021-07-14 Thread George Burgess IV via Phabricator via cfe-commits
george.burgess.iv added a comment. thanks for this! mostly just nits from me Comment at: clang/lib/AST/ExprConstant.cpp:15755 + +bool Expr::tryEvaluateStrLen(uint64_t &Result, ASTContext &Ctx) const { + Expr::EvalStatus Status; Looks like this is the second "t

[PATCH] D104887: [clang] Evaluate strlen of strcpy argument for -Wfortify-source.

2021-07-13 Thread Michael Benfield via Phabricator via cfe-commits
mbenfield updated this revision to Diff 358309. mbenfield added a comment. undo commenting out in source_location.cpp Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D104887/new/ https://reviews.llvm.org/D104887 Files: clang/include/clang/AST/Expr.

[PATCH] D104887: [clang] Evaluate strlen of strcpy argument for -Wfortify-source.

2021-07-07 Thread Michael Benfield via Phabricator via cfe-commits
mbenfield updated this revision to Diff 357077. mbenfield added a comment. fix failing tests Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D104887/new/ https://reviews.llvm.org/D104887 Files: clang/include/clang/AST/Expr.h clang/include/clang/B

[PATCH] D104887: [clang] Evaluate strlen of strcpy argument for -Wfortify-source.

2021-06-25 Thread Michael Benfield via Phabricator via cfe-commits
mbenfield updated this revision to Diff 354563. mbenfield added a comment. Accommodate the fact that APSInt::toString(unsigned) was removed. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D104887/new/ https://reviews.llvm.org/D104887 Files: clang/

[PATCH] D104887: [clang] Evaluate strlen of strcpy argument for -Wfortify-source.

2021-06-24 Thread Michael Benfield via Phabricator via cfe-commits
mbenfield created this revision. mbenfield added reviewers: george.burgess.iv, cjdb, rsmith. mbenfield requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. Also introduce Expr::tryEvaluateStrLen. Repository: rG LLVM Github Monorepo https://