On Wed, 2020-01-08 at 04:02 -0500, David Malcolm wrote: > Needs review. Used by diagnostic_path patch and in various places > in the analyzer. > > msebor raised some concerns about the v1 version of this patch here: > https://gcc.gnu.org/ml/gcc-patches/2019-12/msg00221.html > which I believe I addressed in v4: > https://gcc.gnu.org/ml/gcc-patches/2019-12/msg01319.html > > Changed in v4: added DISABLE_COPY_AND_ASSIGN > > This patch adds a class auto_delete_vec<T>, a subclass of auto_vec <T *> > that deletes all of its elements on destruction; it's used in many > places later in the kit. > > This is a crude way for a vec to "own" the objects it points to > and clean up automatically (essentially a workaround for not being able > to use unique_ptr, due to C++98). > > gcc/ChangeLog: > * vec.c (class selftest::count_dtor): New class. > (selftest::test_auto_delete_vec): New test. > (selftest::vec_c_tests): Call it. > * vec.h (class auto_delete_vec): New class template. > (auto_delete_vec<T>::~auto_delete_vec): New dtor. Just to be clear because my earlier message referenced this patch from an earlier thread, this is OK.
jeff >