From: Saleem Abdulrasool Date: Sun, 25 May 2014 20:26:33 +0000 (+0000) Subject: tools: use references rather than out pointers in COFFDumper X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3617c96d4602300c4758cd89a59720fcfb0acfe4;p=platform%2Fupstream%2Fllvm.git 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. llvm-svn: 209603 --- diff --git a/llvm/tools/llvm-readobj/COFFDumper.cpp b/llvm/tools/llvm-readobj/COFFDumper.cpp index 188e9f8..aec41c7 100644 --- a/llvm/tools/llvm-readobj/COFFDumper.cpp +++ b/llvm/tools/llvm-readobj/COFFDumper.cpp @@ -80,11 +80,8 @@ private: void cacheRelocations(); - error_code getSection( - const std::vector &Rels, - uint64_t Offset, - const coff_section **Section, - uint64_t *AddrPtr); + error_code getSection(const std::vector &Rels, uint64_t Offset, + const coff_section *&Section, uint64_t &AddrPtr); typedef DenseMap > RelocMapTy; @@ -460,24 +457,17 @@ static std::string formatSymbol(const std::vector &Rels, return Str.str(); } -error_code COFFDumper::getSection( - const std::vector &Rels, uint64_t Offset, - const coff_section **SectionPtr, uint64_t *AddrPtr) { - +error_code COFFDumper::getSection(const std::vector &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 XContents;