summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Object
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Object')
-rw-r--r--llvm/lib/Object/Archive.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/llvm/lib/Object/Archive.cpp b/llvm/lib/Object/Archive.cpp
index 2870584cdcf..73761fa73db 100644
--- a/llvm/lib/Object/Archive.cpp
+++ b/llvm/lib/Object/Archive.cpp
@@ -752,7 +752,7 @@ Archive::Archive(MemoryBufferRef Source, Error &Err)
Archive::child_iterator Archive::child_begin(Error &Err,
bool SkipInternal) const {
- if (Data.getBufferSize() == 8) // empty archive.
+ if (isEmpty())
return child_end();
if (SkipInternal)
@@ -968,4 +968,7 @@ Expected<Optional<Archive::Child>> Archive::findSym(StringRef name) const {
return Optional<Child>();
}
+// Returns true if archive file contains no member file.
+bool Archive::isEmpty() const { return Data.getBufferSize() == 8; }
+
bool Archive::hasSymbolTable() const { return !SymbolTable.empty(); }
OpenPOWER on IntegriCloud