summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Object/Archive.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2013-07-29 12:40:31 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2013-07-29 12:40:31 +0000
commitb6b5f52ee87159a061ac87178a568e0b840a4f7a (patch)
treeb3dbb5ec9d29f78be073b6b82a003c48bb5be4a3 /llvm/lib/Object/Archive.cpp
parent2c9c89b21d272eafb19f993c9e7c055d87a4e7fb (diff)
downloadbcm5719-llvm-b6b5f52ee87159a061ac87178a568e0b840a4f7a.tar.gz
bcm5719-llvm-b6b5f52ee87159a061ac87178a568e0b840a4f7a.zip
Add support for the 's' operation to llvm-ar.
If no other operation is specified, 's' becomes an operation instead of an modifier. The s operation just creates a symbol table. It is the same as running ranlib. We assume the archive was created by a sane ar (like llvm-ar or gnu ar) and if the symbol table is present, then it is current. We use that to optimize the most common case: a broken build system that thinks it has to run ranlib. llvm-svn: 187353
Diffstat (limited to 'llvm/lib/Object/Archive.cpp')
-rw-r--r--llvm/lib/Object/Archive.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/llvm/lib/Object/Archive.cpp b/llvm/lib/Object/Archive.cpp
index c6cf219c09b..71efca2b186 100644
--- a/llvm/lib/Object/Archive.cpp
+++ b/llvm/lib/Object/Archive.cpp
@@ -385,7 +385,7 @@ Archive::Symbol Archive::Symbol::getNext() const {
}
Archive::symbol_iterator Archive::begin_symbols() const {
- if (SymbolTable == end_children())
+ if (!hasSymbolTable())
return symbol_iterator(Symbol(this, 0, 0));
const char *buf = SymbolTable->getBuffer().begin();
@@ -408,7 +408,7 @@ Archive::symbol_iterator Archive::begin_symbols() const {
}
Archive::symbol_iterator Archive::end_symbols() const {
- if (SymbolTable == end_children())
+ if (!hasSymbolTable())
return symbol_iterator(Symbol(this, 0, 0));
const char *buf = SymbolTable->getBuffer().begin();
@@ -444,3 +444,7 @@ Archive::child_iterator Archive::findSym(StringRef name) const {
}
return end_children();
}
+
+bool Archive::hasSymbolTable() const {
+ return SymbolTable != end_children();
+}
OpenPOWER on IntegriCloud