[Lldb-commits] [lldb] 7858677 - Rename ParseTypeFromDWO to ParseTypeFromClangModule (NFC)

Adrian Prantl via lldb-commits lldb-commits at lists.llvm.org
Wed Nov 13 13:37:52 PST 2019


Author: Adrian Prantl
Date: 2019-11-13T13:37:43-08:00
New Revision: 78586775f7b26813740096024949907848e7ccc1

URL: https://github.com/llvm/llvm-project/commit/78586775f7b26813740096024949907848e7ccc1
DIFF: https://github.com/llvm/llvm-project/commit/78586775f7b26813740096024949907848e7ccc1.diff

LOG: Rename ParseTypeFromDWO to ParseTypeFromClangModule (NFC)

Because that is what this function really does. The old name is
misleading.

Added: 
    

Modified: 
    lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
    lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h

Removed: 
    


################################################################################
diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
index b129f999a288..f992a49a6dbc 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -135,25 +135,26 @@ static bool IsClangModuleFwdDecl(const DWARFDIE &Die) {
   return false;
 }
 
-TypeSP DWARFASTParserClang::ParseTypeFromDWO(const DWARFDIE &die, Log *log) {
+TypeSP DWARFASTParserClang::ParseTypeFromClangModule(const DWARFDIE &die,
+                                                     Log *log) {
   ModuleSP dwo_module_sp = die.GetContainingDWOModule();
   if (!dwo_module_sp)
     return TypeSP();
 
-  // If this type comes from a Clang module, look in the DWARF section
-  // of the pcm file in the module cache. Clang generates DWO skeleton
-  // units as breadcrumbs to find them.
+  // If this type comes from a Clang module, recursively look in the
+  // DWARF section of the .pcm file in the module cache. Clang
+  // generates DWO skeleton units as breadcrumbs to find them.
   llvm::SmallVector<CompilerContext, 4> decl_context;
   die.GetDeclContext(decl_context);
-  TypeMap dwo_types;
+  TypeMap pcm_types;
 
   // The type in the Clang module must have the same language as the current CU.
   LanguageSet languages;
   languages.Insert(die.GetCU()->GetLanguageType());
   llvm::DenseSet<SymbolFile *> searched_symbol_files;
   dwo_module_sp->GetSymbolFile()->FindTypes(decl_context, languages,
-                                            searched_symbol_files, dwo_types);
-  if (dwo_types.Empty()) {
+                                            searched_symbol_files, pcm_types);
+  if (pcm_types.Empty()) {
     if (!IsClangModuleFwdDecl(die))
       return TypeSP();
 
@@ -164,34 +165,33 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWO(const DWARFDIE &die, Log *log) {
       if (!name_module.second)
         continue;
       name_module.second->GetSymbolFile()->FindTypes(
-          decl_context, languages, searched_symbol_files, dwo_types);
-      if (dwo_types.GetSize())
+          decl_context, languages, searched_symbol_files, pcm_types);
+      if (pcm_types.GetSize())
         break;
     }
   }
 
-  if (dwo_types.GetSize() != 1)
+  if (pcm_types.GetSize() != 1)
     return TypeSP();
 
   // We found a real definition for this type in the Clang module, so lets use
   // it and cache the fact that we found a complete type for this die.
-  TypeSP dwo_type_sp = dwo_types.GetTypeAtIndex(0);
-  if (!dwo_type_sp)
+  TypeSP pcm_type_sp = pcm_types.GetTypeAtIndex(0);
+  if (!pcm_type_sp)
     return TypeSP();
 
-  lldb_private::CompilerType dwo_type = dwo_type_sp->GetForwardCompilerType();
-
+  lldb_private::CompilerType pcm_type = pcm_type_sp->GetForwardCompilerType();
   lldb_private::CompilerType type =
-      GetClangASTImporter().CopyType(m_ast, dwo_type);
+      GetClangASTImporter().CopyType(m_ast, pcm_type);
 
   if (!type)
     return TypeSP();
 
   SymbolFileDWARF *dwarf = die.GetDWARF();
   TypeSP type_sp(new Type(
-      die.GetID(), dwarf, dwo_type_sp->GetName(), dwo_type_sp->GetByteSize(),
+      die.GetID(), dwarf, pcm_type_sp->GetName(), pcm_type_sp->GetByteSize(),
       nullptr, LLDB_INVALID_UID, Type::eEncodingInvalid,
-      &dwo_type_sp->GetDeclaration(), type, Type::eResolveStateForward));
+      &pcm_type_sp->GetDeclaration(), type, Type::eResolveStateForward));
 
   dwarf->GetTypeList().Insert(type_sp);
   dwarf->GetDIEToType()[die.GetDIE()] = type_sp.get();
@@ -382,13 +382,12 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc,
 
     dwarf->GetObjectFile()->GetModule()->LogMessage(
         log,
-        "SymbolFileDWARF::ParseType (die = 0x%8.8x, decl_ctx = %p (die "
-        "0x%8.8x)) %s name = '%s')",
+        "DWARFASTParserClang::ParseTypeFromDWARF "
+        "(die = 0x%8.8x, decl_ctx = %p (die 0x%8.8x)) %s name = '%s')",
         die.GetOffset(), static_cast<void *>(context), context_die.GetOffset(),
         die.GetTagAsCString(), die.GetName());
   }
 
-
   Type *type_ptr = dwarf->GetDIEToType().lookup(die.GetDIE());
   if (type_ptr == DIE_IS_BEING_PARSED)
     return nullptr;
@@ -462,7 +461,7 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc,
       // contain those
       if (encoding_die &&
           encoding_die.GetAttributeValueAsUnsigned(DW_AT_declaration, 0) == 1) {
-        type_sp = ParseTypeFromDWO(die, log);
+        type_sp = ParseTypeFromClangModule(die, log);
         if (type_sp)
           return type_sp;
       }
@@ -644,7 +643,7 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc,
 
   case DW_TAG_enumeration_type: {
     if (attrs.is_forward_declaration) {
-      type_sp = ParseTypeFromDWO(die, log);
+      type_sp = ParseTypeFromClangModule(die, log);
       if (type_sp)
         return type_sp;
 
@@ -1443,9 +1442,9 @@ DWARFASTParserClang::ParseStructureLikeDIE(const DWARFDIE &die,
           attrs.name.GetCString());
     }
 
-    // See if the type comes from a DWO module and if so, track down that
-    // type.
-    type_sp = ParseTypeFromDWO(die, log);
+    // See if the type comes from a Clang module and if so, track down
+    // that type.
+    type_sp = ParseTypeFromClangModule(die, log);
     if (type_sp)
       return type_sp;
 

diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h
index 1f46178108bd..c439ba68b146 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h
@@ -159,7 +159,9 @@ class DWARFASTParserClang : public DWARFASTParser {
   UpdateSymbolContextScopeForType(const lldb_private::SymbolContext &sc,
                                   const DWARFDIE &die, lldb::TypeSP type_sp);
 
-  lldb::TypeSP ParseTypeFromDWO(const DWARFDIE &die, lldb_private::Log *log);
+  /// Follow Clang Module Skeleton CU references to find a type definition.
+  lldb::TypeSP ParseTypeFromClangModule(const DWARFDIE &die,
+                                        lldb_private::Log *log);
 
   // Return true if this type is a declaration to a type in an external
   // module.


        


More information about the lldb-commits mailing list