diff options
author | Adrian Prantl <aprantl@apple.com> | 2015-08-27 22:56:46 +0000 |
---|---|---|
committer | Adrian Prantl <aprantl@apple.com> | 2015-08-27 22:56:46 +0000 |
commit | 3a884fa9e33e66e7eca9b6ea06959d704b28bb21 (patch) | |
tree | dc36896dd718870b8515765fe5e1e005ecfd6837 /clang/lib/CodeGen/CGDebugInfo.cpp | |
parent | 02b7b56af82e265874914d9efe379914844510d6 (diff) | |
download | bcm5719-llvm-3a884fa9e33e66e7eca9b6ea06959d704b28bb21.tar.gz bcm5719-llvm-3a884fa9e33e66e7eca9b6ea06959d704b28bb21.zip |
CGDebugInfo: Instead of uniquing RetainedTypes, just refrain from retaining
them more than once. (NFC)
llvm-svn: 246231
Diffstat (limited to 'clang/lib/CodeGen/CGDebugInfo.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGDebugInfo.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp index 109829aa490..d9101f833c7 100644 --- a/clang/lib/CodeGen/CGDebugInfo.cpp +++ b/clang/lib/CodeGen/CGDebugInfo.cpp @@ -1407,6 +1407,12 @@ llvm::DIType *CGDebugInfo::getOrCreateStandaloneType(QualType D, assert(!D.isNull() && "null type"); llvm::DIType *T = getOrCreateType(D, getOrCreateFile(Loc)); assert(T && "could not create debug info for type"); + + // Composite types with UIDs were already retained by DIBuilder + // because they are only referenced by name in the IR. + if (auto *CTy = dyn_cast<llvm::DICompositeType>(T)) + if (!CTy->getIdentifier().empty()) + return T; RetainedTypes.push_back(D.getAsOpaquePtr()); return T; } @@ -3367,14 +3373,9 @@ void CGDebugInfo::finalize() { // We keep our own list of retained types, because we need to look // up the final type in the type cache. - llvm::DenseSet<void *> UniqueTypes; - UniqueTypes.resize(RetainedTypes.size() * 2); - for (auto &RT : RetainedTypes) { - if (!UniqueTypes.insert(RT).second) - continue; + for (auto &RT : RetainedTypes) if (auto MD = TypeCache[RT]) DBuilder.retainType(cast<llvm::DIType>(MD)); - } DBuilder.finalize(); } |