2c196bbc6bd897b3dcc1d87a3baac28e1e88df41 asserted that
SmallVector::push_back doesn't invalidate the parameter when it needs
to grow. Do the same for resize, append, assign, insert, and
emplace_back.
Details
Details
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
| llvm/include/llvm/ADT/SmallVector.h | ||
|---|---|---|
| 774 | Do you need the SFINAE and the two implementation? | |
Comment Actions
Updates:
- Per @mehdi_amini's suggestion, check all arguments of emplace_back.
- Check ranges in the iterator range versions of assign, append, and insert.
| llvm/include/llvm/ADT/SmallVector.h | ||
|---|---|---|
| 774 | In fact we can also check for internal references in the multi-argument versions of emplace_back. The new patch does this... thanks! | |
Comment Actions
Running check-all for llvm/clang/clang-tools-extra hit three more assertions, now fixed (since splitting the patch out from https://reviews.llvm.org/D91467 I'd just run ADTTests until now):
- Two MCInst::insert calls.
- One emplace_back call with an internal reference.
I'll commit in a minute.
Do you need the SFINAE and the two implementation?
Wouldn't it always be valid to call this->assertSafeToAdd(&Arg);?