Author: adrian Date: Thu Sep 10 20:03:19 2015 New Revision: 247368 URL: http://llvm.org/viewvc/llvm-project?rev=247368&view=rev Log: Cleanup: Let CGDebugInfo::ModuleRefCache use a TrackingMDNode (NFC).
Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp cfe/trunk/lib/CodeGen/CGDebugInfo.h Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=247368&r1=247367&r2=247368&view=diff ============================================================================== --- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original) +++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Thu Sep 10 20:03:19 2015 @@ -1638,9 +1638,9 @@ llvm::DIType *CGDebugInfo::CreateType(co llvm::DIModule * CGDebugInfo::getOrCreateModuleRef(ExternalASTSource::ASTSourceDescriptor Mod) { - auto it = ModuleRefCache.find(Mod.Signature); - if (it != ModuleRefCache.end()) - return it->second; + auto &ModRef = ModuleRefCache[Mod.Signature]; + if (ModRef) + return cast<llvm::DIModule>(ModRef); // Macro definitions that were defined with "-D" on the command line. SmallString<128> ConfigMacros; @@ -1669,12 +1669,12 @@ CGDebugInfo::getOrCreateModuleRef(Extern TheCU->getSourceLanguage(), internString(Mod.ModuleName), internString(Mod.Path), TheCU->getProducer(), true, StringRef(), 0, internString(Mod.ASTFile), llvm::DIBuilder::FullDebug, Mod.Signature); - llvm::DIModule *ModuleRef = + llvm::DIModule *M = DIB.createModule(CU, Mod.ModuleName, ConfigMacros, internString(Mod.Path), internString(CGM.getHeaderSearchOpts().Sysroot)); DIB.finalize(); - ModuleRefCache.insert(std::make_pair(Mod.Signature, ModuleRef)); - return ModuleRef; + ModRef.reset(M); + return M; } llvm::DIType *CGDebugInfo::CreateTypeDefinition(const ObjCInterfaceType *Ty, Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.h?rev=247368&r1=247367&r2=247368&view=diff ============================================================================== --- cfe/trunk/lib/CodeGen/CGDebugInfo.h (original) +++ cfe/trunk/lib/CodeGen/CGDebugInfo.h Thu Sep 10 20:03:19 2015 @@ -84,7 +84,7 @@ class CGDebugInfo { llvm::SmallVector<ObjCInterfaceCacheEntry, 32> ObjCInterfaceCache; /// Cache of references to AST files such as PCHs or modules. - llvm::DenseMap<uint64_t, llvm::DIModule *> ModuleRefCache; + llvm::DenseMap<uint64_t, llvm::TrackingMDRef> ModuleRefCache; /// List of interfaces we want to keep even if orphaned. std::vector<void *> RetainedTypes; _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits