Switch to use references for parameters that are guaranteed to be non-null.
Simplifies the code a slight bit in preparation for another change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@209603
91177308-0d34-0410-b5e6-
96231b3b80d8
- error_code getSection(
- const std::vector<RelocationRef> &Rels,
- uint64_t Offset,
- const coff_section **Section,
- uint64_t *AddrPtr);
+ error_code getSection(const std::vector<RelocationRef> &Rels, uint64_t Offset,
+ const coff_section *&Section, uint64_t &AddrPtr);
typedef DenseMap<const coff_section*, std::vector<RelocationRef> > RelocMapTy;
typedef DenseMap<const coff_section*, std::vector<RelocationRef> > RelocMapTy;
-error_code COFFDumper::getSection(
- const std::vector<RelocationRef> &Rels, uint64_t Offset,
- const coff_section **SectionPtr, uint64_t *AddrPtr) {
-
+error_code COFFDumper::getSection(const std::vector<RelocationRef> &Rels,
+ uint64_t Offset,
+ const coff_section *&SectionPtr,
+ uint64_t &AddrPtr) {
SymbolRef Sym;
if (error_code EC = resolveSymbol(Rels, Offset, Sym))
return EC;
SymbolRef Sym;
if (error_code EC = resolveSymbol(Rels, Offset, Sym))
return EC;
- const coff_section *Section;
- uint64_t Addr;
- if (error_code EC = resolveSectionAndAddress(Obj, Sym, Section, Addr))
+ if (error_code EC = resolveSectionAndAddress(Obj, Sym, SectionPtr, AddrPtr))
- if (SectionPtr)
- *SectionPtr = Section;
- if (AddrPtr)
- *AddrPtr = Addr;
-
return object_error::success;
}
return object_error::success;
}
const coff_section* XData = nullptr;
uint64_t UnwindInfoOffset = 0;
const coff_section* XData = nullptr;
uint64_t UnwindInfoOffset = 0;
- if (error(getSection(Rels, OffsetInSection + 8, &XData, &UnwindInfoOffset)))
+ if (error(getSection(Rels, OffsetInSection + 8, XData, UnwindInfoOffset)))
return;
ArrayRef<uint8_t> XContents;
return;
ArrayRef<uint8_t> XContents;