IR: Fix a use-after-free in RAUW
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>
Wed, 14 Jan 2015 19:56:10 +0000 (19:56 +0000)
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>
Wed, 14 Jan 2015 19:56:10 +0000 (19:56 +0000)
commit9e4a11f46c4611662d28cec1f2c008ad0ed24023
treee1c1135b52a478a2ecc492aa6e1da4d6a607143f
parent9ea8dfef834f22738897e2fc7822a16ab7a24832
IR: Fix a use-after-free in RAUW

Happened pretty commonly during `LLVMContext` teardown when `clang -g`
hit an error.  This fixes the use-after-free.  Next I'll clean up
teardown so that it's not RAUW'ing when metadata-tracked values are
deleted (only really causes a problem if the graph is mid-construction
when teardown starts, but it's still unnecessary work).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226029 91177308-0d34-0410-b5e6-96231b3b80d8
lib/IR/Metadata.cpp
unittests/IR/MetadataTest.cpp