diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2013-07-09 12:22:05 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2013-07-09 12:22:05 +0000 |
commit | c5f8757c727975e9a9d6247cc68fb79d7f4cff8f (patch) | |
tree | 7851ece1a9029e1367e60920d06a3cdbab3d5fee /lib | |
parent | 12f45c3782c0d01bcf9973bbc23dba2b17ce54cb (diff) | |
download | external_llvm-c5f8757c727975e9a9d6247cc68fb79d7f4cff8f.zip external_llvm-c5f8757c727975e9a9d6247cc68fb79d7f4cff8f.tar.gz external_llvm-c5f8757c727975e9a9d6247cc68fb79d7f4cff8f.tar.bz2 |
Add getHeader helper and move ToHeader to the cpp file.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185933 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Object/Archive.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/Object/Archive.cpp b/lib/Object/Archive.cpp index c8a9692..14b21fd 100644 --- a/lib/Object/Archive.cpp +++ b/lib/Object/Archive.cpp @@ -61,12 +61,16 @@ uint64_t ArchiveMemberHeader::getSize() const { return ret; } +static const ArchiveMemberHeader *toHeader(const char *base) { + return reinterpret_cast<const ArchiveMemberHeader *>(base); +} + Archive::Child::Child(const Archive *Parent, const char *Start) : Parent(Parent) { if (!Start) return; - const ArchiveMemberHeader *Header = ToHeader(Start); + const ArchiveMemberHeader *Header = toHeader(Start); Data = StringRef(Start, sizeof(ArchiveMemberHeader) + Header->getSize()); // Setup StartOfFile and PaddingBytes. @@ -270,7 +274,7 @@ Archive::child_iterator Archive::begin_children(bool skip_internal) const { const char *Loc = Data->getBufferStart() + strlen(Magic); Child c(this, Loc); // Skip internals at the beginning of an archive. - if (skip_internal && isInternalMember(*ToHeader(Loc))) + if (skip_internal && isInternalMember(*toHeader(Loc))) return c.getNext(); return c; } |