[llvm] [lldb] Add support for parsing type unit entries in .debug_names. (PR #72952)

via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 21 11:13:21 PST 2023


================
@@ -621,7 +621,10 @@ std::optional<uint64_t> DWARFDebugNames::Entry::getCUIndex() const {
   if (std::optional<DWARFFormValue> Off = lookup(dwarf::DW_IDX_compile_unit))
     return Off->getAsUnsignedConstant();
   // In a per-CU index, the entries without a DW_IDX_compile_unit attribute
-  // implicitly refer to the single CU.
+  // implicitly refer to the single CU, but only if we don't have a
----------------
jeffreytan81 wrote:

I wonder why do we really need this check? 
With this check, when there is no `DW_IDX_compile_unit` but `DW_IDX_type_unit` presents, `getCUIndex` will return `nullopt`. Per my understanding, this is split dwarf (per-CU index) + TU scenario which we should return `0` instead of `nulptr`, right?

https://github.com/llvm/llvm-project/pull/72952


More information about the llvm-commits mailing list