[PATCH] D154502: [AST] Fix bug in UnresolvedSet::erase of last element

John Brawn via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 5 05:28:22 PDT 2023


john.brawn created this revision.
john.brawn added reviewers: dexonsmith, rsmith, rjmccall.
Herald added a project: All.
john.brawn requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

UnresolvedSet::erase works by popping the last element then replacing the element to be erased with that element. When the element to be erased is itself the last element this leads to writing past the end of the set, causing an assertion failure.

Fix this by making erase of the last element just pop that element.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D154502

Files:
  clang/include/clang/AST/UnresolvedSet.h
  clang/unittests/AST/CMakeLists.txt
  clang/unittests/AST/UnresolvedSetTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D154502.537309.patch
Type: text/x-patch
Size: 3928 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230705/ca13e02c/attachment.bin>


More information about the cfe-commits mailing list