[PATCH] D48596: [SymbolFile] Implement GetCompleteObjCClass for .debug_names

Jonas Devlieghere via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 26 08:49:51 PDT 2018


JDevlieghere created this revision.
JDevlieghere added reviewers: labath, aprantl, clayborg.

When running the test suite with .debug_names a bunch of tests were failing. Part of that is solved by implementing the missing GetCompleteObjCClass in DebugNamesDWARFIndex.


Repository:
  rL LLVM

https://reviews.llvm.org/D48596

Files:
  source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
  source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.h


Index: source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.h
===================================================================
--- source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.h
+++ source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.h
@@ -31,7 +31,7 @@
   void GetGlobalVariables(const DWARFUnit &cu, DIEArray &offsets) override;
   void GetObjCMethods(ConstString class_name, DIEArray &offsets) override {}
   void GetCompleteObjCClass(ConstString class_name, bool must_be_implementation,
-                            DIEArray &offsets) override {}
+                            DIEArray &offsets) override;
   void GetTypes(ConstString name, DIEArray &offsets) override;
   void GetTypes(const DWARFDeclContext &context, DIEArray &offsets) override;
   void GetNamespaces(ConstString name, DIEArray &offsets) override;
Index: source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
===================================================================
--- source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
+++ source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
@@ -146,6 +146,39 @@
   }
 }
 
+void DebugNamesDWARFIndex::GetCompleteObjCClass(ConstString class_name,
+                                                bool must_be_implementation,
+                                                DIEArray &offsets) {
+  m_fallback.GetCompleteObjCClass(class_name, must_be_implementation, offsets);
+
+  for (const DebugNames::Entry &entry :
+       m_debug_names_up->equal_range(class_name.GetStringRef())) {
+    if (entry.tag() != DW_TAG_structure_type &&
+        entry.tag() != DW_TAG_class_type)
+      continue;
+
+    DIERef ref = ToDIERef(entry);
+    if (!ref)
+      continue;
+
+    DWARFUnit *cu = m_debug_info.GetCompileUnit(ref.cu_offset);
+    if (!cu || !cu->Supports_DW_AT_APPLE_objc_complete_type()) {
+      offsets.push_back(ref);
+      continue;
+    }
+
+    // FIXME: We should return DWARFDIEs so we don't have to resolve it twice.
+    DWARFDIE die = m_debug_info.GetDIE(ref);
+    if (!die) {
+      offsets.push_back(ref);
+      continue;
+    }
+
+    if (die.GetAttributeValueAsUnsigned(DW_AT_APPLE_objc_complete_type, 1))
+      offsets.push_back(ref);
+  }
+}
+
 void DebugNamesDWARFIndex::GetTypes(ConstString name, DIEArray &offsets) {
   m_fallback.GetTypes(name, offsets);
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D48596.152898.patch
Type: text/x-patch
Size: 2334 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180626/c1f21861/attachment.bin>


More information about the llvm-commits mailing list