[llvm] r249709 - Handle Archive::getNumberOfSymbols being called in an archive with no symbols.
Rafael Espindola via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 8 11:06:20 PDT 2015
Author: rafael
Date: Thu Oct 8 13:06:20 2015
New Revision: 249709
URL: http://llvm.org/viewvc/llvm-project?rev=249709&view=rev
Log:
Handle Archive::getNumberOfSymbols being called in an archive with no symbols.
No change in llvm, but will be tested from lld.
Modified:
llvm/trunk/lib/Object/Archive.cpp
Modified: llvm/trunk/lib/Object/Archive.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Object/Archive.cpp?rev=249709&r1=249708&r2=249709&view=diff
==============================================================================
--- llvm/trunk/lib/Object/Archive.cpp (original)
+++ llvm/trunk/lib/Object/Archive.cpp Thu Oct 8 13:06:20 2015
@@ -510,12 +510,12 @@ Archive::symbol_iterator Archive::symbol
}
Archive::symbol_iterator Archive::symbol_end() const {
- if (!hasSymbolTable())
- return symbol_iterator(Symbol(this, 0, 0));
return symbol_iterator(Symbol(this, getNumberOfSymbols(), 0));
}
uint32_t Archive::getNumberOfSymbols() const {
+ if (!hasSymbolTable())
+ return 0;
const char *buf = getSymbolTable().begin();
if (kind() == K_GNU)
return read32be(buf);
More information about the llvm-commits
mailing list