[llvm] r209603 - tools: use references rather than out pointers in COFFDumper
Saleem Abdulrasool
compnerd at compnerd.org
Sun May 25 13:26:33 PDT 2014
Author: compnerd
Date: Sun May 25 15:26:33 2014
New Revision: 209603
URL: http://llvm.org/viewvc/llvm-project?rev=209603&view=rev
Log:
tools: use references rather than out pointers in COFFDumper
Switch to use references for parameters that are guaranteed to be non-null.
Simplifies the code a slight bit in preparation for another change.
Modified:
llvm/trunk/tools/llvm-readobj/COFFDumper.cpp
Modified: llvm/trunk/tools/llvm-readobj/COFFDumper.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-readobj/COFFDumper.cpp?rev=209603&r1=209602&r2=209603&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-readobj/COFFDumper.cpp (original)
+++ llvm/trunk/tools/llvm-readobj/COFFDumper.cpp Sun May 25 15:26:33 2014
@@ -80,11 +80,8 @@ private:
void cacheRelocations();
- 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;
@@ -460,24 +457,17 @@ static std::string formatSymbol(const st
return Str.str();
}
-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;
- 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))
return EC;
- if (SectionPtr)
- *SectionPtr = Section;
- if (AddrPtr)
- *AddrPtr = Addr;
-
return object_error::success;
}
@@ -1063,7 +1053,7 @@ void COFFDumper::printRuntimeFunction(
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;
More information about the llvm-commits
mailing list