[all-commits] [llvm/llvm-project] 4ade8b: [AST] Fix bug in UnresolvedSet::erase of last element

john-brawn-arm via All-commits all-commits at lists.llvm.org
Wed Jul 5 08:10:48 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 4ade8b7ed9976303b23cff3525223826e65b46e7
      https://github.com/llvm/llvm-project/commit/4ade8b7ed9976303b23cff3525223826e65b46e7
  Author: John Brawn <john.brawn at arm.com>
  Date:   2023-07-05 (Wed, 05 Jul 2023)

  Changed paths:
    M clang/include/clang/AST/UnresolvedSet.h
    M clang/unittests/AST/CMakeLists.txt
    A clang/unittests/AST/UnresolvedSetTest.cpp

  Log Message:
  -----------
  [AST] Fix bug in UnresolvedSet::erase of last element

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.

Differential Revision: https://reviews.llvm.org/D154502




More information about the All-commits mailing list