[Lldb-commits] [lldb] [LLDB][NativePDB] Set IsDynmaicCXXType metadata for records (PR #155853)
Zequan Wu via lldb-commits
lldb-commits at lists.llvm.org
Tue Sep 2 15:02:52 PDT 2025
================
@@ -601,21 +601,26 @@ PdbAstBuilder::CreateModifierType(const ModifierRecord &modifier) {
}
clang::QualType PdbAstBuilder::CreateRecordType(PdbTypeSymId id,
- const TagRecord &record) {
+ const CVTagRecord &record) {
clang::DeclContext *context = nullptr;
std::string uname;
- std::tie(context, uname) = CreateDeclInfoForType(record, id.index);
+ std::tie(context, uname) = CreateDeclInfoForType(record.asTag(), id.index);
if (!context)
return {};
- clang::TagTypeKind ttk = TranslateUdtKind(record);
+ clang::TagTypeKind ttk = TranslateUdtKind(record.asTag());
lldb::AccessType access = (ttk == clang::TagTypeKind::Class)
? lldb::eAccessPrivate
: lldb::eAccessPublic;
ClangASTMetadata metadata;
metadata.SetUserID(toOpaqueUid(id));
- metadata.SetIsDynamicCXXType(false);
+ // If a class has a vtable, it is dynamic.
+ // Otherwise, we wait until the record is completed - it might have virtual
+ // bases.
+ if (record.contextKind() == CompilerContextKind::ClassOrStruct &&
+ !record.asClass().getVTableShape().isNoneType())
+ metadata.SetIsDynamicCXXType(true);
----------------
ZequanWu wrote:
Shouldn't we set it to false when the condition is false, like `metadata.SetIsDynamicCXXType(record.contextKind() == CompilerContextKind::ClassOrStruct && !record.asClass().getVTableShape().isNoneType())`? By default it's `std::nullopt`.
https://github.com/llvm/llvm-project/pull/155853
More information about the lldb-commits
mailing list