diff options
author | Pete Cooper <peter_cooper@apple.com> | 2016-03-22 21:08:39 +0000 |
---|---|---|
committer | Pete Cooper <peter_cooper@apple.com> | 2016-03-22 21:08:39 +0000 |
commit | 85698f2568a26363c88405171e033826aed45ff3 (patch) | |
tree | 4d7f9eb5c7342902d1436d7466c0b88ab11b9495 | |
parent | 660764a060805dc4bb85d4d693fd58b54c800e41 (diff) | |
download | bcm5719-llvm-85698f2568a26363c88405171e033826aed45ff3.tar.gz bcm5719-llvm-85698f2568a26363c88405171e033826aed45ff3.zip |
Fix operator= on OwningAtomPtr to call destructor when needed.
If the LHS of 'a = b' already had an atom in it then we wouldn't
call the destructor. This happens when we use something like
std::remove_if which is done in the CompactUnwindPass. Should fix
the leaks on the mach-o/unwind-info-simple-x86_64.yaml test case.
Lang and I are going to take a look at removing OwningAtomPtr in
favour of a std::unique_ptr but just trying to get the bots green
so we have a good baseline first.
llvm-svn: 264097
-rw-r--r-- | lld/include/lld/Core/Atom.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/lld/include/lld/Core/Atom.h b/lld/include/lld/Core/Atom.h index cab89ef5296..42ca2bb8af8 100644 --- a/lld/include/lld/Core/Atom.h +++ b/lld/include/lld/Core/Atom.h @@ -100,6 +100,8 @@ public: } void operator=(OwningAtomPtr&& ptr) { + if (atom) + runDestructor(atom); atom = ptr.atom; ptr.atom = nullptr; } |