forked from OSchip/llvm-project
PR19562: Fix memory leak when ObjC interface types cause the creation of further interfaces.
llvm-svn: 208161
This commit is contained in:
parent
aa6dd5bbb0
commit
5944d9ce3e
|
@ -3332,11 +3332,15 @@ void CGDebugInfo::finalize() {
|
||||||
Ty.replaceAllUsesWith(CGM.getLLVMContext(), RepTy);
|
Ty.replaceAllUsesWith(CGM.getLLVMContext(), RepTy);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto E : ObjCInterfaceCache)
|
// Creating types might create further types - invalidating the current
|
||||||
|
// element and the size(), so don't cache/reference them.
|
||||||
|
for (size_t i = 0; i != ObjCInterfaceCache.size(); ++i) {
|
||||||
|
ObjCInterfaceCacheEntry E = ObjCInterfaceCache[i];
|
||||||
E.Decl.replaceAllUsesWith(CGM.getLLVMContext(),
|
E.Decl.replaceAllUsesWith(CGM.getLLVMContext(),
|
||||||
E.Type->getDecl()->getDefinition()
|
E.Type->getDecl()->getDefinition()
|
||||||
? CreateTypeDefinition(E.Type, E.Unit)
|
? CreateTypeDefinition(E.Type, E.Unit)
|
||||||
: E.Decl);
|
: E.Decl);
|
||||||
|
}
|
||||||
|
|
||||||
// We keep our own list of retained types, because we need to look
|
// We keep our own list of retained types, because we need to look
|
||||||
// up the final type in the type cache.
|
// up the final type in the type cache.
|
||||||
|
|
Loading…
Reference in New Issue