[PATCH] D78482: [DebugInfo] Simplify DWARFUnit::determineStringOffsetsTableContribution(). NFC.

Igor Kudrin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 20 04:16:06 PDT 2020


ikudrin created this revision.
ikudrin added reviewers: dblaikie, jhenderson, probinson.
ikudrin added projects: LLVM, debug-info.
Herald added a subscriber: hiraditya.

The method is called from only one place and the call is already guarded by a condition which checks that `IsDWO` is `false`.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D78482

Files:
  llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp


Index: llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp
===================================================================
--- llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp
+++ llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp
@@ -962,18 +962,11 @@
 
 Expected<Optional<StrOffsetsContributionDescriptor>>
 DWARFUnit::determineStringOffsetsTableContribution(DWARFDataExtractor &DA) {
-  uint64_t Offset;
-  if (IsDWO) {
-    Offset = 0;
-    if (DA.getData().data() == nullptr)
-      return None;
-  } else {
-    auto OptOffset = toSectionOffset(getUnitDIE().find(DW_AT_str_offsets_base));
-    if (!OptOffset)
-      return None;
-    Offset = *OptOffset;
-  }
-  auto DescOrError = parseDWARFStringOffsetsTableHeader(DA, Header.getFormat(), Offset);
+  auto OptOffset = toSectionOffset(getUnitDIE().find(DW_AT_str_offsets_base));
+  if (!OptOffset)
+    return None;
+  auto DescOrError =
+      parseDWARFStringOffsetsTableHeader(DA, Header.getFormat(), *OptOffset);
   if (!DescOrError)
     return DescOrError.takeError();
   return *DescOrError;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D78482.258697.patch
Type: text/x-patch
Size: 1026 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200420/ff7be7f9/attachment.bin>


More information about the llvm-commits mailing list