[PATCH] D130260: [clangd] Make forwarding parameter detection logic resilient
Tobias Ribizel via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Jul 22 03:11:56 PDT 2022
upsj accepted this revision.
upsj added a comment.
This revision is now accepted and ready to land.
Not sure I qualify as a suitable reviewer, but this looks really good to me, save for maybe a small safety measure :)
================
Comment at: clang-tools-extra/clangd/AST.cpp:833-837
+ auto ParamEnd = It + Parameters.size() - 1;
+ assert(std::distance(Args.begin(), ParamEnd) <
+ std::distance(Args.begin(), Args.end()) &&
+ "Only functions with greater than or equal number of parameters "
+ "should be checked.");
----------------
I think it would be safer to check this explicitly, since advancing the iterator past its end might be UB (depending on the implementation).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D130260/new/
https://reviews.llvm.org/D130260
More information about the cfe-commits
mailing list