summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR/LLVMContextImpl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/IR/LLVMContextImpl.cpp')
-rw-r--r--llvm/lib/IR/LLVMContextImpl.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/lib/IR/LLVMContextImpl.cpp b/llvm/lib/IR/LLVMContextImpl.cpp
index f0ac4583dea..3c34ca55c22 100644
--- a/llvm/lib/IR/LLVMContextImpl.cpp
+++ b/llvm/lib/IR/LLVMContextImpl.cpp
@@ -48,6 +48,14 @@ LLVMContextImpl::~LLVMContextImpl() {
while (!OwnedModules.empty())
delete *OwnedModules.begin();
+#ifndef NDEBUG
+ // Check for metadata references from leaked Instructions.
+ for (auto &Pair : InstructionMetadata)
+ Pair.first->dump();
+ assert(InstructionMetadata.empty() &&
+ "Instructions with metadata have been leaked");
+#endif
+
// Drop references for MDNodes. Do this before Values get deleted to avoid
// unnecessary RAUW when nodes are still unresolved.
for (auto *I : DistinctMDNodes)
OpenPOWER on IntegriCloud