[llvm] r217648 - Object: Small cleanup in COFFObjectFile::getSymbol
David Majnemer
david.majnemer at gmail.com
Thu Sep 11 16:42:10 PDT 2014
Author: majnemer
Date: Thu Sep 11 18:42:10 2014
New Revision: 217648
URL: http://llvm.org/viewvc/llvm-project?rev=217648&view=rev
Log:
Object: Small cleanup in COFFObjectFile::getSymbol
NFC.
Modified:
llvm/trunk/include/llvm/Object/COFF.h
Modified: llvm/trunk/include/llvm/Object/COFF.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Object/COFF.h?rev=217648&r1=217647&r2=217648&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Object/COFF.h (original)
+++ llvm/trunk/include/llvm/Object/COFF.h Thu Sep 11 18:42:10 2014
@@ -569,10 +569,10 @@ public:
template <typename coff_symbol_type>
std::error_code getSymbol(uint32_t Index,
const coff_symbol_type *&Res) const {
- if (Index < getNumberOfSymbols())
- Res = reinterpret_cast<coff_symbol_type *>(getSymbolTable()) + Index;
- else
+ if (Index >= getNumberOfSymbols())
return object_error::parse_failed;
+
+ Res = reinterpret_cast<coff_symbol_type *>(getSymbolTable()) + Index;
return object_error::success;
}
ErrorOr<COFFSymbolRef> getSymbol(uint32_t index) const {
More information about the llvm-commits
mailing list