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

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

Differential Revision: https://reviews.llvm.org/D78482
This commit is contained in:
Igor Kudrin 2020-04-22 12:11:17 +07:00
parent 8dc790b933
commit 1f48e22df8
1 changed files with 7 additions and 12 deletions

View File

@ -962,18 +962,12 @@ parseDWARFStringOffsetsTableHeader(DWARFDataExtractor &DA,
Expected<Optional<StrOffsetsContributionDescriptor>> Expected<Optional<StrOffsetsContributionDescriptor>>
DWARFUnit::determineStringOffsetsTableContribution(DWARFDataExtractor &DA) { DWARFUnit::determineStringOffsetsTableContribution(DWARFDataExtractor &DA) {
uint64_t Offset; assert(!IsDWO);
if (IsDWO) {
Offset = 0;
if (DA.getData().data() == nullptr)
return None;
} else {
auto OptOffset = toSectionOffset(getUnitDIE().find(DW_AT_str_offsets_base)); auto OptOffset = toSectionOffset(getUnitDIE().find(DW_AT_str_offsets_base));
if (!OptOffset) if (!OptOffset)
return None; return None;
Offset = *OptOffset; auto DescOrError =
} parseDWARFStringOffsetsTableHeader(DA, Header.getFormat(), *OptOffset);
auto DescOrError = parseDWARFStringOffsetsTableHeader(DA, Header.getFormat(), Offset);
if (!DescOrError) if (!DescOrError)
return DescOrError.takeError(); return DescOrError.takeError();
return *DescOrError; return *DescOrError;
@ -981,6 +975,7 @@ DWARFUnit::determineStringOffsetsTableContribution(DWARFDataExtractor &DA) {
Expected<Optional<StrOffsetsContributionDescriptor>> Expected<Optional<StrOffsetsContributionDescriptor>>
DWARFUnit::determineStringOffsetsTableContributionDWO(DWARFDataExtractor & DA) { DWARFUnit::determineStringOffsetsTableContributionDWO(DWARFDataExtractor & DA) {
assert(IsDWO);
uint64_t Offset = 0; uint64_t Offset = 0;
auto IndexEntry = Header.getIndexEntry(); auto IndexEntry = Header.getIndexEntry();
const auto *C = const auto *C =