================
@@ -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
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to