[PATCH] D130260: [clangd] Make forwarding parameter detection logic resilient

Ilya Biryukov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 22 03:37:26 PDT 2022


ilya-biryukov added inline comments.


================
Comment at: clang-tools-extra/clangd/AST.cpp:833
+        // Check that this expands all the way until the last parameter.
+        auto ParamEnd = It + Parameters.size() - 1;
+        assert(std::distance(Args.begin(), ParamEnd) <
----------------
upsj wrote:
> I think it would be safer to check this explicitly, since advancing the iterator past its end might be UB (depending on the implementation).
This could crash in `foo(1, args...)`, right?


================
Comment at: clang-tools-extra/clangd/AST.cpp:879
+    // forwarded arg.
+    // FIXME: Maybe mark that in the AST as so, this might skip explicit calls
+    // too.
----------------
NIT: should fit in a single line


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