[Lldb-commits] [lldb] [LLDB][NativePDB] Use typedef compiler type for typedef types (PR #156250)

via lldb-commits lldb-commits at lists.llvm.org
Sun Aug 31 09:05:14 PDT 2025


================
@@ -2045,14 +2045,17 @@ TypeSP SymbolFileNativePDB::CreateTypedef(PdbGlobalSymId id) {
   if (!ts)
     return nullptr;
 
-  ts->GetNativePDBParser()->GetOrCreateTypedefDecl(id);
+  auto *typedef_decl = ts->GetNativePDBParser()->GetOrCreateTypedefDecl(id);
+
+  CompilerType ct = target_type->GetForwardCompilerType();
+  if (auto *clang = llvm::dyn_cast_or_null<TypeSystemClang>(ts.get()))
+    ct = clang->GetType(clang->getASTContext().getTypeDeclType(typedef_decl));
----------------
Nerixyz wrote:

This feels a bit wrong, because `PdbAstParser::GetOrCreateTypedefDecl` [already knows this compiler type](https://github.com/llvm/llvm-project/blob/2259a80c7d6d27879f4ecac31bafaf2cff778430/lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp#L743-L744). However, it returns a decl, so we need to go back through the AST to resolve the type.
The method isn't used elsewhere, so the return type could be changed to a `CompilerType`.

https://github.com/llvm/llvm-project/pull/156250


More information about the lldb-commits mailing list