[Lldb-commits] [lldb] [LLDB][NativePDB] Resolve declaration for tag types (PR #152579)
Michael Buch via lldb-commits
lldb-commits at lists.llvm.org
Mon Aug 11 23:48:39 PDT 2025
================
@@ -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
More information about the lldb-commits
mailing list