summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2014-05-07 06:18:00 +0000
committerDavid Blaikie <dblaikie@gmail.com>2014-05-07 06:18:00 +0000
commit5944d9ce3e53a479ca2e780a54eb1309e31da097 (patch)
tree35eb2487a3ba8a13db2f76259c846092f097a002 /clang/lib/CodeGen
parentaa6dd5bbb0419bac9a8ab2e0ef6545a56796b9a8 (diff)
downloadbcm5719-llvm-5944d9ce3e53a479ca2e780a54eb1309e31da097.tar.gz
bcm5719-llvm-5944d9ce3e53a479ca2e780a54eb1309e31da097.zip
PR19562: Fix memory leak when ObjC interface types cause the creation of further interfaces.
llvm-svn: 208161
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r--clang/lib/CodeGen/CGDebugInfo.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp
index b62cc2546fb..5aeeaa41436 100644
--- a/clang/lib/CodeGen/CGDebugInfo.cpp
+++ b/clang/lib/CodeGen/CGDebugInfo.cpp
@@ -3332,11 +3332,15 @@ void CGDebugInfo::finalize() {
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.Type->getDecl()->getDefinition()
? CreateTypeDefinition(E.Type, E.Unit)
: E.Decl);
+ }
// We keep our own list of retained types, because we need to look
// up the final type in the type cache.
OpenPOWER on IntegriCloud