================ @@ -2441,3 +2440,55 @@ SymbolFileNativePDB::GetContextForType(TypeIndex ti) { } return ctx; } + +void SymbolFileNativePDB::CacheUdtDeclarations() { + if (m_has_cached_udt_declatations) + return; + m_has_cached_udt_declatations = true; + + for (CVType cvt : m_index->ipi().typeArray()) { + if (cvt.kind() != LF_UDT_MOD_SRC_LINE) + continue; + + UdtModSourceLineRecord udt_mod_src; + llvm::cantFail(TypeDeserializer::deserializeAs(cvt, udt_mod_src)); + // Some types might be contributed by multiple modules. We assume that they + // all point to the same file and line because we can only provide one + // location. + m_udt_declarations.try_emplace(udt_mod_src.UDT, + udt_mod_src.SourceFile.getIndex(), + udt_mod_src.LineNumber); + } +} + +Declaration SymbolFileNativePDB::ResolveUdtDeclaration(PdbTypeSymId type_id) { + CacheUdtDeclarations(); ---------------- Michael137 wrote:
Could use a `std::once_flag` here instead of `m_has_cached_udt_declatations` to ensure this runs just once. https://github.com/llvm/llvm-project/pull/152579 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits