[Lldb-commits] [PATCH] D75488: Preserve the owning module information from DWARF in the synthesized AST

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Mar 5 01:41:28 PST 2020


labath added a comment.

Thanks for splitting this up. This does make things much easier to understand.

I don't have any real objections to this, but I have some "thoughts" in inline comments.



================
Comment at: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp:214-215
       &pcm_type_sp->GetDeclaration(), type, Type::ResolveState::Forward));
+  TypePayloadClang(type_sp->GetPayload())
+      .SetOwningModuleID(GetOwningModuleID(die));
 
----------------
Did you deliberately not include the payload as an argument to the Type constructor? I can understand not wanting to add a extra argument to that constructor, but OTOH, having this in the constructor would make it harder to forget setting the module id when creating a type elsewhere. (And it's always nice to have immutable members if it is possible.)


================
Comment at: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp:221-237
+  if (tag_decl) {
+    TypeSystemClang::SetOwningModule(tag_decl, owning_module);
+    if (auto *rd = llvm::dyn_cast<clang::RecordDecl>(tag_decl))
+      for (clang::FieldDecl *fd : rd->fields())
+        TypeSystemClang::SetOwningModule(fd, owning_module);
+    if (auto *ed = llvm::dyn_cast<clang::EnumDecl>(tag_decl))
+      for (clang::EnumConstantDecl *ecd : ed->enumerators())
----------------
I don't know how feasible this is, but it has occurred to me that this is basically repeating the same structure iteration that would be done as a part of the import a couple of lines above. If would be nice if the importer could somehow set this property automatically.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D75488/new/

https://reviews.llvm.org/D75488





More information about the lldb-commits mailing list