Update type cache when a type is completed.
Radar 9168773
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128150 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/CGDebugInfo.cpp b/lib/CodeGen/CGDebugInfo.cpp
index bf5e7a5..80bec0f 100644
--- a/lib/CodeGen/CGDebugInfo.cpp
+++ b/lib/CodeGen/CGDebugInfo.cpp
@@ -1396,7 +1396,7 @@
// Unwrap the type as needed for debug information.
Ty = UnwrapTypeForDebugInfo(Ty);
-
+
// Check for existing entry.
llvm::DenseMap<void *, llvm::WeakVH>::iterator it =
TypeCache.find(Ty.getAsOpaquePtr());
@@ -2205,3 +2205,17 @@
NameSpaceCache[NSDecl] = llvm::WeakVH(NS);
return NS;
}
+
+/// UpdateCompletedType - Update type cache because the type is now
+/// translated.
+void CGDebugInfo::UpdateCompletedType(const TagDecl *TD) {
+ QualType Ty = CGM.getContext().getTagDeclType(TD);
+
+ // If the type exist in type cache then remove it from the cache.
+ // There is no need to prepare debug info for the completed type
+ // right now. It will be generated on demand lazily.
+ llvm::DenseMap<void *, llvm::WeakVH>::iterator it =
+ TypeCache.find(Ty.getAsOpaquePtr());
+ if (it != TypeCache.end())
+ TypeCache.erase(it);
+}