aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Object
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
commitcf48cf23de9207e4000df91aadc0beaa0989e33d (patch)
tree422e2b36c02d0c68da9bded48e086b254cc8f060 /lib/Object
parentc63dce3c59ac24b2656e06f7017cd4dce4bf733c (diff)
downloadexternal_llvm-cf48cf23de9207e4000df91aadc0beaa0989e33d.zip
external_llvm-cf48cf23de9207e4000df91aadc0beaa0989e33d.tar.gz
external_llvm-cf48cf23de9207e4000df91aadc0beaa0989e33d.tar.bz2
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187353 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Object')
-rw-r--r--lib/Object/Archive.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/Object/Archive.cpp b/lib/Object/Archive.cpp
index c6cf219..71efca2 100644
--- a/lib/Object/Archive.cpp
+++ b/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();
+}