LLVM  14.0.0git
Archive.h
Go to the documentation of this file.
1 //===- Archive.h - ar archive file format -----------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file declares the ar archive file format class.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef LLVM_OBJECT_ARCHIVE_H
14 #define LLVM_OBJECT_ARCHIVE_H
15 
16 #include "llvm/ADT/Optional.h"
17 #include "llvm/ADT/StringRef.h"
20 #include "llvm/Object/Binary.h"
21 #include "llvm/Support/Chrono.h"
22 #include "llvm/Support/Error.h"
25 #include <algorithm>
26 #include <cassert>
27 #include <cstdint>
28 #include <memory>
29 #include <string>
30 #include <vector>
31 
32 namespace llvm {
33 namespace object {
34 
35 const char ArchiveMagic[] = "!<arch>\n";
36 const char ThinArchiveMagic[] = "!<thin>\n";
37 const char BigArchiveMagic[] = "<bigaf>\n";
38 
39 class Archive;
40 
42 protected:
44 
45 public:
46  friend class Archive;
47  virtual std::unique_ptr<AbstractArchiveMemberHeader> clone() const = 0;
49 
50  /// Get the name without looking up long names.
51  virtual Expected<StringRef> getRawName() const = 0;
52  virtual StringRef getRawAccessMode() const = 0;
53  virtual StringRef getRawLastModified() const = 0;
54  virtual StringRef getRawUID() const = 0;
55  virtual StringRef getRawGID() const = 0;
56 
57  /// Get the name looking up long names.
58  virtual Expected<StringRef> getName(uint64_t Size) const = 0;
59  virtual Expected<uint64_t> getSize() const = 0;
60  virtual uint64_t getOffset() const = 0;
61 
62  /// Get next file member location.
63  virtual Expected<const char *> getNextChildLoc() const = 0;
64  virtual Expected<bool> isThin() const = 0;
65 
68  Expected<unsigned> getUID() const;
69  Expected<unsigned> getGID() const;
70 
71  /// Returns the size in bytes of the format-defined member header of the
72  /// concrete archive type.
73  virtual uint64_t getSizeOf() const = 0;
74 
75  const Archive *Parent;
76 };
77 
78 template <typename T>
80 public:
81  CommonArchiveMemberHeader(const Archive *Parent, const T *RawHeaderPtr)
82  : AbstractArchiveMemberHeader(Parent), ArMemHdr(RawHeaderPtr){};
83  StringRef getRawAccessMode() const override;
84  StringRef getRawLastModified() const override;
85  StringRef getRawUID() const override;
86  StringRef getRawGID() const override;
87 
88  uint64_t getOffset() const override;
89  uint64_t getSizeOf() const override { return sizeof(T); }
90 
91  T const *ArMemHdr;
92 };
93 
95  char Name[16];
96  char LastModified[12];
97  char UID[6];
98  char GID[6];
99  char AccessMode[8];
100  char Size[10]; ///< Size of data, not including header or padding.
101  char Terminator[2];
102 };
103 
104 class ArchiveMemberHeader : public CommonArchiveMemberHeader<UnixArMemHdrType> {
105 public:
106  ArchiveMemberHeader(const Archive *Parent, const char *RawHeaderPtr,
107  uint64_t Size, Error *Err);
108 
109  std::unique_ptr<AbstractArchiveMemberHeader> clone() const override {
110  return std::make_unique<ArchiveMemberHeader>(*this);
111  }
112 
113  Expected<StringRef> getRawName() const override;
114 
115  Expected<StringRef> getName(uint64_t Size) const override;
116  Expected<uint64_t> getSize() const override;
117  Expected<const char *> getNextChildLoc() const override;
118  Expected<bool> isThin() const override;
119 };
120 
121 // File Member Header
123  char Size[20]; // File member size in decimal
124  char NextOffset[20]; // Next member offset in decimal
125  char PrevOffset[20]; // Previous member offset in decimal
126  char LastModified[12];
127  char UID[12];
128  char GID[12];
129  char AccessMode[12];
130  char NameLen[4]; // File member name length in decimal
131  union {
132  char Name[2]; // Start of member name
133  char Terminator[2];
134  };
135 };
136 
137 // Define file member header of AIX big archive.
139  : public CommonArchiveMemberHeader<BigArMemHdrType> {
140 
141 public:
142  BigArchiveMemberHeader(Archive const *Parent, const char *RawHeaderPtr,
143  uint64_t Size, Error *Err);
144  std::unique_ptr<AbstractArchiveMemberHeader> clone() const override {
145  return std::make_unique<BigArchiveMemberHeader>(*this);
146  }
147 
148  Expected<StringRef> getRawName() const override;
150 
151  Expected<StringRef> getName(uint64_t Size) const override;
152  Expected<uint64_t> getSize() const override;
153  Expected<const char *> getNextChildLoc() const override;
155  Expected<bool> isThin() const override { return false; }
156 };
157 
158 class Archive : public Binary {
159  virtual void anchor();
160 
161 public:
162  class Child {
163  friend Archive;
165 
166  const Archive *Parent;
167  std::unique_ptr<AbstractArchiveMemberHeader> Header;
168  /// Includes header but not padding byte.
169  StringRef Data;
170  /// Offset from Data to the start of the file.
171  uint16_t StartOfFile;
172 
173  Expected<bool> isThinMember() const;
174 
175  public:
176  Child(const Archive *Parent, const char *Start, Error *Err);
177  Child(const Archive *Parent, StringRef Data, uint16_t StartOfFile);
178 
179  Child(const Child &C)
180  : Parent(C.Parent), Data(C.Data), StartOfFile(C.StartOfFile) {
181  if (C.Header)
182  Header = C.Header->clone();
183  }
184 
185  Child(Child &&C) {
186  Parent = std::move(C.Parent);
187  Header = std::move(C.Header);
188  Data = C.Data;
189  StartOfFile = C.StartOfFile;
190  }
191 
192  Child &operator=(Child &&C) noexcept {
193  if (&C == this)
194  return *this;
195 
196  Parent = std::move(C.Parent);
197  Header = std::move(C.Header);
198  Data = C.Data;
199  StartOfFile = C.StartOfFile;
200 
201  return *this;
202  }
203 
204  Child &operator=(const Child &C) {
205  if (&C == this)
206  return *this;
207 
208  Parent = C.Parent;
209  if (C.Header)
210  Header = C.Header->clone();
211  Data = C.Data;
212  StartOfFile = C.StartOfFile;
213 
214  return *this;
215  }
216 
217  bool operator==(const Child &other) const {
218  assert(!Parent || !other.Parent || Parent == other.Parent);
219  return Data.begin() == other.Data.begin();
220  }
221 
222  const Archive *getParent() const { return Parent; }
223  Expected<Child> getNext() const;
224 
227  Expected<StringRef> getRawName() const { return Header->getRawName(); }
228 
230  return Header->getLastModified();
231  }
232 
234  return Header->getRawLastModified();
235  }
236 
237  Expected<unsigned> getUID() const { return Header->getUID(); }
238  Expected<unsigned> getGID() const { return Header->getGID(); }
239 
241  return Header->getAccessMode();
242  }
243 
244  /// \return the size of the archive member without the header or padding.
245  Expected<uint64_t> getSize() const;
246  /// \return the size in the archive header for this member.
248 
250  uint64_t getChildOffset() const;
251  uint64_t getDataOffset() const { return getChildOffset() + StartOfFile; }
252 
254 
256  getAsBinary(LLVMContext *Context = nullptr) const;
257  };
258 
260  Child C;
261 
262  public:
263  ChildFallibleIterator() : C(Child(nullptr, nullptr, nullptr)) {}
265 
266  const Child *operator->() const { return &C; }
267  const Child &operator*() const { return C; }
268 
269  bool operator==(const ChildFallibleIterator &other) const {
270  // Ignore errors here: If an error occurred during increment then getNext
271  // will have been set to child_end(), and the following comparison should
272  // do the right thing.
273  return C == other.C;
274  }
275 
276  bool operator!=(const ChildFallibleIterator &other) const {
277  return !(*this == other);
278  }
279 
280  Error inc() {
281  auto NextChild = C.getNext();
282  if (!NextChild)
283  return NextChild.takeError();
284  C = std::move(*NextChild);
285  return Error::success();
286  }
287  };
288 
290 
291  class Symbol {
292  const Archive *Parent;
293  uint32_t SymbolIndex;
294  uint32_t StringIndex; // Extra index to the string.
295 
296  public:
297  Symbol(const Archive *p, uint32_t symi, uint32_t stri)
298  : Parent(p), SymbolIndex(symi), StringIndex(stri) {}
299 
300  bool operator==(const Symbol &other) const {
301  return (Parent == other.Parent) && (SymbolIndex == other.SymbolIndex);
302  }
303 
304  StringRef getName() const;
305  Expected<Child> getMember() const;
306  Symbol getNext() const;
307  };
308 
310  Symbol symbol;
311 
312  public:
313  symbol_iterator(const Symbol &s) : symbol(s) {}
314 
315  const Symbol *operator->() const { return &symbol; }
316  const Symbol &operator*() const { return symbol; }
317 
318  bool operator==(const symbol_iterator &other) const {
319  return symbol == other.symbol;
320  }
321 
322  bool operator!=(const symbol_iterator &other) const {
323  return !(*this == other);
324  }
325 
326  symbol_iterator &operator++() { // Preincrement
327  symbol = symbol.getNext();
328  return *this;
329  }
330  };
331 
334 
335  /// Size field is 10 decimal digits long
336  static const uint64_t MaxMemberSize = 9999999999;
337 
339 
340  Kind kind() const { return (Kind)Format; }
341  bool isThin() const { return IsThin; }
342 
343  child_iterator child_begin(Error &Err, bool SkipInternal = true) const;
344  child_iterator child_end() const;
346  bool SkipInternal = true) const {
347  return make_range(child_begin(Err, SkipInternal), child_end());
348  }
349 
351  symbol_iterator symbol_end() const;
353  return make_range(symbol_begin(), symbol_end());
354  }
355 
356  static bool classof(Binary const *v) { return v->isArchive(); }
357 
358  // check if a symbol is in the archive
360 
361  bool isEmpty() const;
362  bool hasSymbolTable() const;
363  StringRef getSymbolTable() const { return SymbolTable; }
364  StringRef getStringTable() const { return StringTable; }
366  virtual uint64_t getFirstChildOffset() const { return getArchiveMagicLen(); }
367 
368  std::vector<std::unique_ptr<MemoryBuffer>> takeThinBuffers() {
369  return std::move(ThinBuffers);
370  }
371 
372  std::unique_ptr<AbstractArchiveMemberHeader>
373  createArchiveMemberHeader(const char *RawHeaderPtr, uint64_t Size,
374  Error *Err) const;
375 
376 protected:
378  void setFirstRegular(const Child &C);
379 
380 private:
381  StringRef SymbolTable;
382  StringRef StringTable;
383 
384  StringRef FirstRegularData;
385  uint16_t FirstRegularStartOfFile = -1;
386 
387  unsigned Format : 3;
388  unsigned IsThin : 1;
389  mutable std::vector<std::unique_ptr<MemoryBuffer>> ThinBuffers;
390 };
391 
392 class BigArchive : public Archive {
393  /// Fixed-Length Header.
394  struct FixLenHdr {
395  char Magic[sizeof(BigArchiveMagic) - 1]; ///< Big archive magic string.
396  char MemOffset[20]; ///< Offset to member table.
397  char GlobSymOffset[20]; ///< Offset to global symbol table.
398  char
399  GlobSym64Offset[20]; ///< Offset global symbol table for 64-bit objects.
400  char FirstChildOffset[20]; ///< Offset to first archive member.
401  char LastChildOffset[20]; ///< Offset to last archive member.
402  char FreeOffset[20]; ///< Offset to first mem on free list.
403  };
404 
405  const FixLenHdr *ArFixLenHdr;
406  uint64_t FirstChildOffset = 0;
407  uint64_t LastChildOffset = 0;
408 
409 public:
411  uint64_t getFirstChildOffset() const override { return FirstChildOffset; }
412  uint64_t getLastChildOffset() const { return LastChildOffset; }
413 };
414 
415 } // end namespace object
416 } // end namespace llvm
417 
418 #endif // LLVM_OBJECT_ARCHIVE_H
llvm::Check::Size
@ Size
Definition: FileCheck.h:73
llvm::object::CommonArchiveMemberHeader::getRawLastModified
StringRef getRawLastModified() const override
Definition: Archive.cpp:76
MemoryBuffer.h
llvm::object::Archive::K_GNU64
@ K_GNU64
Definition: Archive.h:338
llvm::object::CommonArchiveMemberHeader::getRawUID
StringRef getRawUID() const override
Definition: Archive.cpp:80
llvm::object::UnixArMemHdrType::GID
char GID[6]
Definition: Archive.h:98
llvm::object::BigArchive::getFirstChildOffset
uint64_t getFirstChildOffset() const override
Definition: Archive.h:411
llvm::object::Archive::K_COFF
@ K_COFF
Definition: Archive.h:338
llvm::object::Archive::Kind
Kind
Definition: Archive.h:338
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AllocatorList.h:23
llvm::object::Archive::K_BSD
@ K_BSD
Definition: Archive.h:338
llvm::make_range
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
Definition: iterator_range.h:53
Optional.h
llvm::object::BigArMemHdrType::Name
char Name[2]
Definition: Archive.h:132
llvm::object::Archive::Child::getAsBinary
Expected< std::unique_ptr< Binary > > getAsBinary(LLVMContext *Context=nullptr) const
Definition: Archive.cpp:639
llvm::object::Archive::Child::getNext
Expected< Child > getNext() const
Definition: Archive.cpp:576
FileSystem.h
llvm::object::Archive::Child::operator==
bool operator==(const Child &other) const
Definition: Archive.h:217
llvm::object::Archive::Child::operator=
Child & operator=(Child &&C) noexcept
Definition: Archive.h:192
llvm::object::Archive::child_end
child_iterator child_end() const
Definition: Archive.cpp:941
llvm::object::Archive::Archive
Archive(MemoryBufferRef Source, Error &Err)
Definition: Archive.cpp:690
llvm::object::CommonArchiveMemberHeader::CommonArchiveMemberHeader
CommonArchiveMemberHeader(const Archive *Parent, const T *RawHeaderPtr)
Definition: Archive.h:81
llvm::object::Archive::children
iterator_range< child_iterator > children(Error &Err, bool SkipInternal=true) const
Definition: Archive.h:345
llvm::object::Archive::Child::Child
Child(const Archive *Parent, const char *Start, Error *Err)
Definition: Archive.cpp:450
StringRef.h
llvm::object::BigArchiveMemberHeader
Definition: Archive.h:138
llvm::object::Archive::Child::operator=
Child & operator=(const Child &C)
Definition: Archive.h:204
llvm::object::AbstractArchiveMemberHeader::AbstractArchiveMemberHeader
AbstractArchiveMemberHeader(const Archive *Parent)
Definition: Archive.h:43
llvm::object::Archive::setFirstRegular
void setFirstRegular(const Child &C)
Definition: Archive.cpp:685
llvm::object::Archive::Child::getFullName
Expected< std::string > getFullName() const
Definition: Archive.cpp:536
llvm::object::ArchiveMemberHeader::getRawName
Expected< StringRef > getRawName() const override
Get the name without looking up long names.
Definition: Archive.cpp:145
llvm::Error::success
static ErrorSuccess success()
Create a success value.
Definition: Error.h:330
llvm::object::Archive::symbol_iterator::operator==
bool operator==(const symbol_iterator &other) const
Definition: Archive.h:318
llvm::object::Archive::getStringTable
StringRef getStringTable() const
Definition: Archive.h:364
llvm::object::Archive::symbol_iterator::operator*
const Symbol & operator*() const
Definition: Archive.h:316
Error.h
llvm::object::Archive::symbol_iterator::symbol_iterator
symbol_iterator(const Symbol &s)
Definition: Archive.h:313
llvm::object::Archive::K_GNU
@ K_GNU
Definition: Archive.h:338
llvm::object::AbstractArchiveMemberHeader::Parent
const Archive * Parent
Definition: Archive.h:75
llvm::object::Archive::ChildFallibleIterator
Definition: Archive.h:259
llvm::object::Archive::getNumberOfSymbols
uint32_t getNumberOfSymbols() const
Definition: Archive.cpp:1108
llvm::object::AbstractArchiveMemberHeader::clone
virtual std::unique_ptr< AbstractArchiveMemberHeader > clone() const =0
llvm::object::Archive::ChildFallibleIterator::inc
Error inc()
Definition: Archive.h:280
llvm::object::Archive::symbol_begin
symbol_iterator symbol_begin() const
Definition: Archive.cpp:1048
T
#define T
Definition: Mips16ISelLowering.cpp:341
llvm::object::AbstractArchiveMemberHeader::~AbstractArchiveMemberHeader
virtual ~AbstractArchiveMemberHeader()
Definition: Archive.h:48
llvm::object::CommonArchiveMemberHeader::getRawGID
StringRef getRawGID() const override
Definition: Archive.cpp:84
llvm::object::BigArchiveMemberHeader::getRawNameSize
Expected< uint64_t > getRawNameSize() const
Definition: Archive.cpp:357
llvm::object::Archive::Symbol
Definition: Archive.h:291
llvm::object::Archive::Child::getGID
Expected< unsigned > getGID() const
Definition: Archive.h:238
llvm::Expected
Tagged union holding either a T or a Error.
Definition: APFloat.h:42
llvm::object::AbstractArchiveMemberHeader::getOffset
virtual uint64_t getOffset() const =0
llvm::Data
@ Data
Definition: SIMachineScheduler.h:55
p
the resulting code requires compare and branches when and if * p
Definition: README.txt:396
llvm::MemoryBufferRef
Definition: MemoryBufferRef.h:22
llvm::object::Archive::ChildFallibleIterator::operator->
const Child * operator->() const
Definition: Archive.h:266
llvm::object::Archive::Symbol::getName
StringRef getName() const
Definition: Archive.cpp:945
Context
ManagedStatic< detail::RecordContext > Context
Definition: Record.cpp:96
llvm::object::Archive::symbol_iterator
Definition: Archive.h:309
Chrono.h
llvm::object::AbstractArchiveMemberHeader::getRawUID
virtual StringRef getRawUID() const =0
llvm::object::CommonArchiveMemberHeader::getSizeOf
uint64_t getSizeOf() const override
Returns the size in bytes of the format-defined member header of the concrete archive type.
Definition: Archive.h:89
llvm::object::Archive::Symbol::Symbol
Symbol(const Archive *p, uint32_t symi, uint32_t stri)
Definition: Archive.h:297
llvm::object::ArchiveMagic
const char ArchiveMagic[]
Definition: Archive.h:35
llvm::object::Archive
Definition: Archive.h:158
llvm::object::AbstractArchiveMemberHeader::getLastModified
Expected< sys::TimePoint< std::chrono::seconds > > getLastModified() const
Definition: Archive.cpp:376
llvm::object::ThinArchiveMagic
const char ThinArchiveMagic[]
Definition: Archive.h:36
llvm::object::BigArchiveMemberHeader::clone
std::unique_ptr< AbstractArchiveMemberHeader > clone() const override
Definition: Archive.h:144
llvm::object::BigArchiveMemberHeader::getName
Expected< StringRef > getName(uint64_t Size) const override
Get the name looking up long names.
Definition: Archive.cpp:335
llvm::object::Archive::getArchiveMagicLen
uint64_t getArchiveMagicLen() const
Definition: Archive.cpp:675
llvm::object::BigArchiveMagic
const char BigArchiveMagic[]
Definition: Archive.h:37
llvm::object::Binary::isArchive
bool isArchive() const
Definition: Binary.h:112
llvm::object::Archive::Child::Child
Child(const Child &C)
Definition: Archive.h:179
llvm::object::Archive::isEmpty
bool isEmpty() const
Definition: Archive.cpp:1143
C
(vector float) vec_cmpeq(*A, *B) C
Definition: README_ALTIVEC.txt:86
llvm::object::Archive::takeThinBuffers
std::vector< std::unique_ptr< MemoryBuffer > > takeThinBuffers()
Definition: Archive.h:368
llvm::object::BigArchive
Definition: Archive.h:392
llvm::object::Archive::MaxMemberSize
static const uint64_t MaxMemberSize
Size field is 10 decimal digits long.
Definition: Archive.h:336
llvm::object::Archive::getFirstChildOffset
virtual uint64_t getFirstChildOffset() const
Definition: Archive.h:366
llvm::object::BigArMemHdrType::Terminator
char Terminator[2]
Definition: Archive.h:133
llvm::object::UnixArMemHdrType
Definition: Archive.h:94
llvm::object::Archive::symbol_iterator::operator!=
bool operator!=(const symbol_iterator &other) const
Definition: Archive.h:322
llvm::object::AbstractArchiveMemberHeader::getGID
Expected< unsigned > getGID() const
Definition: Archive.cpp:393
llvm::object::Archive::getSymbolTable
StringRef getSymbolTable() const
Definition: Archive.h:363
fallible_iterator.h
llvm::object::ArchiveMemberHeader::getSize
Expected< uint64_t > getSize() const override
Definition: Archive.cpp:339
llvm::object::Archive::Child::getBuffer
Expected< StringRef > getBuffer() const
Definition: Archive.cpp:554
llvm::object::CommonArchiveMemberHeader
Definition: Archive.h:79
llvm::object::Archive::ChildFallibleIterator::ChildFallibleIterator
ChildFallibleIterator()
Definition: Archive.h:263
llvm::object::BigArMemHdrType
Definition: Archive.h:122
llvm::object::AbstractArchiveMemberHeader::isThin
virtual Expected< bool > isThin() const =0
llvm::object::Archive::Child::getLastModified
Expected< sys::TimePoint< std::chrono::seconds > > getLastModified() const
Definition: Archive.h:229
llvm::object::Archive::isThin
bool isThin() const
Definition: Archive.h:341
llvm::object::BigArMemHdrType::AccessMode
char AccessMode[12]
Definition: Archive.h:129
llvm::object::Archive::Child::getDataOffset
uint64_t getDataOffset() const
Definition: Archive.h:251
llvm::object::UnixArMemHdrType::Terminator
char Terminator[2]
Definition: Archive.h:101
llvm::object::BigArchive::getLastChildOffset
uint64_t getLastChildOffset() const
Definition: Archive.h:412
llvm::object::AbstractArchiveMemberHeader
Definition: Archive.h:41
llvm::object::UnixArMemHdrType::LastModified
char LastModified[12]
Definition: Archive.h:96
llvm::object::Archive::Child::getRawName
Expected< StringRef > getRawName() const
Definition: Archive.h:227
llvm::object::Archive::Child::getUID
Expected< unsigned > getUID() const
Definition: Archive.h:237
llvm::object::AbstractArchiveMemberHeader::getSizeOf
virtual uint64_t getSizeOf() const =0
Returns the size in bytes of the format-defined member header of the concrete archive type.
llvm::object::Archive::classof
static bool classof(Binary const *v)
Definition: Archive.h:356
object
bar al al movzbl eax ret Missed when stored in a memory object
Definition: README.txt:1411
llvm::object::Archive::Child::Child
Child(Child &&C)
Definition: Archive.h:185
llvm::object::Archive::K_DARWIN64
@ K_DARWIN64
Definition: Archive.h:338
llvm::object::UnixArMemHdrType::AccessMode
char AccessMode[8]
Definition: Archive.h:99
uint64_t
llvm::object::CommonArchiveMemberHeader::getOffset
uint64_t getOffset() const override
Definition: Archive.cpp:88
llvm::object::symbol_iterator
Definition: ObjectFile.h:206
llvm::object::Archive::ChildFallibleIterator::ChildFallibleIterator
ChildFallibleIterator(const Child &C)
Definition: Archive.h:264
llvm::object::Archive::symbol_end
symbol_iterator symbol_end() const
Definition: Archive.cpp:1104
s
multiplies can be turned into SHL s
Definition: README.txt:370
move
compiles ldr LCPI1_0 ldr ldr mov lsr tst moveq r1 ldr LCPI1_1 and r0 bx lr It would be better to do something like to fold the shift into the conditional move
Definition: README.txt:546
llvm::LLVMContext
This is an important class for using LLVM in a threaded context.
Definition: LLVMContext.h:67
llvm::object::BigArchiveMemberHeader::getRawName
Expected< StringRef > getRawName() const override
Get the name without looking up long names.
Definition: Archive.cpp:206
llvm::object::ArchiveMemberHeader::clone
std::unique_ptr< AbstractArchiveMemberHeader > clone() const override
Definition: Archive.h:109
llvm::object::Archive::Child::getAccessMode
Expected< sys::fs::perms > getAccessMode() const
Definition: Archive.h:240
llvm::object::BigArchiveMemberHeader::getNextChildLoc
Expected< const char * > getNextChildLoc() const override
Get next file member location.
Definition: Archive.cpp:433
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
llvm::object::BigArMemHdrType::NameLen
char NameLen[4]
Definition: Archive.h:130
llvm::object::Archive::hasSymbolTable
bool hasSymbolTable() const
Definition: Archive.cpp:1147
llvm::object::Archive::ChildFallibleIterator::operator==
bool operator==(const ChildFallibleIterator &other) const
Definition: Archive.h:269
llvm::object::AbstractArchiveMemberHeader::getRawLastModified
virtual StringRef getRawLastModified() const =0
llvm::object::BigArchiveMemberHeader::isThin
Expected< bool > isThin() const override
Definition: Archive.h:155
iterator_range.h
llvm::object::Archive::child_begin
child_iterator child_begin(Error &Err, bool SkipInternal=true) const
Definition: Archive.cpp:925
llvm::fallible_iterator
A wrapper class for fallible iterators.
Definition: fallible_iterator.h:68
llvm::object::UnixArMemHdrType::Size
char Size[10]
Size of data, not including header or padding.
Definition: Archive.h:100
llvm::object::Archive::Child::getRawSize
Expected< uint64_t > getRawSize() const
Definition: Archive.cpp:530
llvm::object::BigArchiveMemberHeader::getNextOffset
Expected< uint64_t > getNextOffset() const
Definition: Archive.cpp:362
llvm::object::Archive::Symbol::getMember
Expected< Child > getMember() const
Definition: Archive.cpp:949
llvm::object::Archive::findSym
Expected< Optional< Child > > findSym(StringRef name) const
Definition: Archive.cpp:1126
llvm::object::Archive::Child::getRawLastModified
StringRef getRawLastModified() const
Definition: Archive.h:233
llvm::object::BigArMemHdrType::UID
char UID[12]
Definition: Archive.h:127
llvm::object::Archive::symbol_iterator::operator++
symbol_iterator & operator++()
Definition: Archive.h:326
llvm::object::Archive::K_AIXBIG
@ K_AIXBIG
Definition: Archive.h:338
llvm::Sched::Source
@ Source
Definition: TargetLowering.h:99
llvm::object::BigArchive::BigArchive
BigArchive(MemoryBufferRef Source, Error &Err)
Definition: Archive.cpp:1149
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:57
llvm::object::UnixArMemHdrType::Name
char Name[16]
Definition: Archive.h:95
llvm::msf::Magic
static const char Magic[]
Definition: MSFCommon.h:23
llvm::object::Binary
Definition: Binary.h:32
uint32_t
llvm::object::ArchiveMemberHeader::getNextChildLoc
Expected< const char * > getNextChildLoc() const override
Get next file member location.
Definition: Archive.cpp:408
llvm::object::Archive::Child::getName
Expected< StringRef > getName() const
Definition: Archive.cpp:614
llvm::object::Archive::ChildFallibleIterator::operator*
const Child & operator*() const
Definition: Archive.h:267
llvm::object::Archive::Child
Definition: Archive.h:162
llvm::object::Archive::Symbol::operator==
bool operator==(const Symbol &other) const
Definition: Archive.h:300
llvm::object::AbstractArchiveMemberHeader::getRawName
virtual Expected< StringRef > getRawName() const =0
Get the name without looking up long names.
llvm::object::Archive::Symbol::getNext
Symbol getNext() const
Definition: Archive.cpp:1009
llvm::object::ArchiveMemberHeader::ArchiveMemberHeader
ArchiveMemberHeader(const Archive *Parent, const char *RawHeaderPtr, uint64_t Size, Error *Err)
Definition: Archive.cpp:95
name
static const char * name
Definition: SVEIntrinsicOpts.cpp:74
llvm::object::Archive::Child::getChildOffset
uint64_t getChildOffset() const
Definition: Archive.cpp:607
llvm::object::AbstractArchiveMemberHeader::getName
virtual Expected< StringRef > getName(uint64_t Size) const =0
Get the name looking up long names.
uint16_t
llvm::object::Archive::createArchiveMemberHeader
std::unique_ptr< AbstractArchiveMemberHeader > createArchiveMemberHeader(const char *RawHeaderPtr, uint64_t Size, Error *Err) const
Definition: Archive.cpp:666
llvm::object::AbstractArchiveMemberHeader::getNextChildLoc
virtual Expected< const char * > getNextChildLoc() const =0
Get next file member location.
llvm::object::Archive::symbol_iterator::operator->
const Symbol * operator->() const
Definition: Archive.h:315
llvm::Error
Lightweight error class with error context and mandatory checking.
Definition: Error.h:156
llvm::object::Archive::kind
Kind kind() const
Definition: Archive.h:340
llvm::object::BigArMemHdrType::Size
char Size[20]
Definition: Archive.h:123
llvm::object::AbstractArchiveMemberHeader::getUID
Expected< unsigned > getUID() const
Definition: Archive.cpp:386
llvm::object::UnixArMemHdrType::UID
char UID[6]
Definition: Archive.h:97
llvm::object::ArchiveMemberHeader::isThin
Expected< bool > isThin() const override
Definition: Archive.cpp:400
llvm::object::Archive::K_DARWIN
@ K_DARWIN
Definition: Archive.h:338
llvm::object::BigArMemHdrType::LastModified
char LastModified[12]
Definition: Archive.h:126
llvm::object::AbstractArchiveMemberHeader::getSize
virtual Expected< uint64_t > getSize() const =0
llvm::object::Archive::Child::getSize
Expected< uint64_t > getSize() const
Definition: Archive.cpp:524
llvm::object::BigArchiveMemberHeader::BigArchiveMemberHeader
BigArchiveMemberHeader(Archive const *Parent, const char *RawHeaderPtr, uint64_t Size, Error *Err)
Definition: Archive.cpp:130
Binary.h
llvm::object::BigArMemHdrType::GID
char GID[12]
Definition: Archive.h:128
llvm::object::ArchiveMemberHeader
Definition: Archive.h:104
llvm::iterator_range
A range adaptor for a pair of iterators.
Definition: iterator_range.h:30
llvm::object::Archive::child_iterator
fallible_iterator< ChildFallibleIterator > child_iterator
Definition: Archive.h:289
llvm::object::BigArchiveMemberHeader::getSize
Expected< uint64_t > getSize() const override
Definition: Archive.cpp:344
llvm::object::CommonArchiveMemberHeader::ArMemHdr
const T * ArMemHdr
Definition: Archive.h:91
llvm::object::BigArMemHdrType::PrevOffset
char PrevOffset[20]
Definition: Archive.h:125
llvm::object::Archive::Child::getMemoryBufferRef
Expected< MemoryBufferRef > getMemoryBufferRef() const
Definition: Archive.cpp:627
llvm::object::AbstractArchiveMemberHeader::getRawAccessMode
virtual StringRef getRawAccessMode() const =0
llvm::object::Archive::Child::getParent
const Archive * getParent() const
Definition: Archive.h:222
llvm::object::CommonArchiveMemberHeader::getRawAccessMode
StringRef getRawAccessMode() const override
Definition: Archive.cpp:71
llvm::object::BigArMemHdrType::NextOffset
char NextOffset[20]
Definition: Archive.h:124
llvm::object::ArchiveMemberHeader::getName
Expected< StringRef > getName(uint64_t Size) const override
Get the name looking up long names.
Definition: Archive.cpp:235
llvm::object::Archive::symbols
iterator_range< symbol_iterator > symbols() const
Definition: Archive.h:352
llvm::StringRef::begin
iterator begin() const
Definition: StringRef.h:127
llvm::object::Archive::create
static Expected< std::unique_ptr< Archive > > create(MemoryBufferRef Source)
Definition: Archive.cpp:650
llvm::object::AbstractArchiveMemberHeader::getAccessMode
Expected< sys::fs::perms > getAccessMode() const
Definition: Archive.cpp:367
llvm::object::Archive::ChildFallibleIterator::operator!=
bool operator!=(const ChildFallibleIterator &other) const
Definition: Archive.h:276
llvm::object::AbstractArchiveMemberHeader::getRawGID
virtual StringRef getRawGID() const =0