LLVM  15.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/StringRef.h"
19 #include "llvm/Object/Binary.h"
20 #include "llvm/Support/Chrono.h"
21 #include "llvm/Support/Error.h"
24 #include <cassert>
25 #include <cstdint>
26 #include <memory>
27 #include <string>
28 #include <vector>
29 
30 namespace llvm {
31 
32 template <typename T> class Optional;
33 
34 namespace object {
35 
36 const char ArchiveMagic[] = "!<arch>\n";
37 const char ThinArchiveMagic[] = "!<thin>\n";
38 const char BigArchiveMagic[] = "<bigaf>\n";
39 
40 class Archive;
41 
43 protected:
45 
46 public:
47  friend class Archive;
48  virtual std::unique_ptr<AbstractArchiveMemberHeader> clone() const = 0;
49  virtual ~AbstractArchiveMemberHeader() = default;
50 
51  /// Get the name without looking up long names.
52  virtual Expected<StringRef> getRawName() const = 0;
53  virtual StringRef getRawAccessMode() const = 0;
54  virtual StringRef getRawLastModified() const = 0;
55  virtual StringRef getRawUID() const = 0;
56  virtual StringRef getRawGID() const = 0;
57 
58  /// Get the name looking up long names.
59  virtual Expected<StringRef> getName(uint64_t Size) const = 0;
60  virtual Expected<uint64_t> getSize() const = 0;
61  virtual uint64_t getOffset() const = 0;
62 
63  /// Get next file member location.
64  virtual Expected<const char *> getNextChildLoc() const = 0;
65  virtual Expected<bool> isThin() const = 0;
66 
69  Expected<unsigned> getUID() const;
70  Expected<unsigned> getGID() const;
71 
72  /// Returns the size in bytes of the format-defined member header of the
73  /// concrete archive type.
74  virtual uint64_t getSizeOf() const = 0;
75 
76  const Archive *Parent;
77 };
78 
79 template <typename T>
81 public:
82  CommonArchiveMemberHeader(const Archive *Parent, const T *RawHeaderPtr)
83  : AbstractArchiveMemberHeader(Parent), ArMemHdr(RawHeaderPtr){};
84  StringRef getRawAccessMode() const override;
85  StringRef getRawLastModified() const override;
86  StringRef getRawUID() const override;
87  StringRef getRawGID() const override;
88 
89  uint64_t getOffset() const override;
90  uint64_t getSizeOf() const override { return sizeof(T); }
91 
92  T const *ArMemHdr;
93 };
94 
96  char Name[16];
97  char LastModified[12];
98  char UID[6];
99  char GID[6];
100  char AccessMode[8];
101  char Size[10]; ///< Size of data, not including header or padding.
102  char Terminator[2];
103 };
104 
105 class ArchiveMemberHeader : public CommonArchiveMemberHeader<UnixArMemHdrType> {
106 public:
107  ArchiveMemberHeader(const Archive *Parent, const char *RawHeaderPtr,
108  uint64_t Size, Error *Err);
109 
110  std::unique_ptr<AbstractArchiveMemberHeader> clone() const override {
111  return std::make_unique<ArchiveMemberHeader>(*this);
112  }
113 
114  Expected<StringRef> getRawName() const override;
115 
116  Expected<StringRef> getName(uint64_t Size) const override;
117  Expected<uint64_t> getSize() const override;
118  Expected<const char *> getNextChildLoc() const override;
119  Expected<bool> isThin() const override;
120 };
121 
122 // File Member Header
124  char Size[20]; // File member size in decimal
125  char NextOffset[20]; // Next member offset in decimal
126  char PrevOffset[20]; // Previous member offset in decimal
127  char LastModified[12];
128  char UID[12];
129  char GID[12];
130  char AccessMode[12];
131  char NameLen[4]; // File member name length in decimal
132  union {
133  char Name[2]; // Start of member name
134  char Terminator[2];
135  };
136 };
137 
138 // Define file member header of AIX big archive.
140  : public CommonArchiveMemberHeader<BigArMemHdrType> {
141 
142 public:
143  BigArchiveMemberHeader(Archive const *Parent, const char *RawHeaderPtr,
144  uint64_t Size, Error *Err);
145  std::unique_ptr<AbstractArchiveMemberHeader> clone() const override {
146  return std::make_unique<BigArchiveMemberHeader>(*this);
147  }
148 
149  Expected<StringRef> getRawName() const override;
151 
152  Expected<StringRef> getName(uint64_t Size) const override;
153  Expected<uint64_t> getSize() const override;
154  Expected<const char *> getNextChildLoc() const override;
156  Expected<bool> isThin() const override { return false; }
157 };
158 
159 class Archive : public Binary {
160  virtual void anchor();
161 
162 public:
163  class Child {
164  friend Archive;
166 
167  const Archive *Parent;
168  std::unique_ptr<AbstractArchiveMemberHeader> Header;
169  /// Includes header but not padding byte.
170  StringRef Data;
171  /// Offset from Data to the start of the file.
172  uint16_t StartOfFile;
173 
174  Expected<bool> isThinMember() const;
175 
176  public:
177  Child(const Archive *Parent, const char *Start, Error *Err);
178  Child(const Archive *Parent, StringRef Data, uint16_t StartOfFile);
179 
180  Child(const Child &C)
181  : Parent(C.Parent), Data(C.Data), StartOfFile(C.StartOfFile) {
182  if (C.Header)
183  Header = C.Header->clone();
184  }
185 
186  Child(Child &&C) {
187  Parent = std::move(C.Parent);
188  Header = std::move(C.Header);
189  Data = C.Data;
190  StartOfFile = C.StartOfFile;
191  }
192 
193  Child &operator=(Child &&C) noexcept {
194  if (&C == this)
195  return *this;
196 
197  Parent = std::move(C.Parent);
198  Header = std::move(C.Header);
199  Data = C.Data;
200  StartOfFile = C.StartOfFile;
201 
202  return *this;
203  }
204 
205  Child &operator=(const Child &C) {
206  if (&C == this)
207  return *this;
208 
209  Parent = C.Parent;
210  if (C.Header)
211  Header = C.Header->clone();
212  Data = C.Data;
213  StartOfFile = C.StartOfFile;
214 
215  return *this;
216  }
217 
218  bool operator==(const Child &other) const {
219  assert(!Parent || !other.Parent || Parent == other.Parent);
220  return Data.begin() == other.Data.begin();
221  }
222 
223  const Archive *getParent() const { return Parent; }
224  Expected<Child> getNext() const;
225 
228  Expected<StringRef> getRawName() const { return Header->getRawName(); }
229 
231  return Header->getLastModified();
232  }
233 
235  return Header->getRawLastModified();
236  }
237 
238  Expected<unsigned> getUID() const { return Header->getUID(); }
239  Expected<unsigned> getGID() const { return Header->getGID(); }
240 
242  return Header->getAccessMode();
243  }
244 
245  /// \return the size of the archive member without the header or padding.
246  Expected<uint64_t> getSize() const;
247  /// \return the size in the archive header for this member.
249 
251  uint64_t getChildOffset() const;
252  uint64_t getDataOffset() const { return getChildOffset() + StartOfFile; }
253 
255 
257  getAsBinary(LLVMContext *Context = nullptr) const;
258  };
259 
261  Child C;
262 
263  public:
264  ChildFallibleIterator() : C(Child(nullptr, nullptr, nullptr)) {}
266 
267  const Child *operator->() const { return &C; }
268  const Child &operator*() const { return C; }
269 
270  bool operator==(const ChildFallibleIterator &other) const {
271  // Ignore errors here: If an error occurred during increment then getNext
272  // will have been set to child_end(), and the following comparison should
273  // do the right thing.
274  return C == other.C;
275  }
276 
277  bool operator!=(const ChildFallibleIterator &other) const {
278  return !(*this == other);
279  }
280 
281  Error inc() {
282  auto NextChild = C.getNext();
283  if (!NextChild)
284  return NextChild.takeError();
285  C = std::move(*NextChild);
286  return Error::success();
287  }
288  };
289 
291 
292  class Symbol {
293  const Archive *Parent;
294  uint32_t SymbolIndex;
295  uint32_t StringIndex; // Extra index to the string.
296 
297  public:
298  Symbol(const Archive *p, uint32_t symi, uint32_t stri)
299  : Parent(p), SymbolIndex(symi), StringIndex(stri) {}
300 
301  bool operator==(const Symbol &other) const {
302  return (Parent == other.Parent) && (SymbolIndex == other.SymbolIndex);
303  }
304 
305  StringRef getName() const;
306  Expected<Child> getMember() const;
307  Symbol getNext() const;
308  };
309 
311  Symbol symbol;
312 
313  public:
314  symbol_iterator(const Symbol &s) : symbol(s) {}
315 
316  const Symbol *operator->() const { return &symbol; }
317  const Symbol &operator*() const { return symbol; }
318 
319  bool operator==(const symbol_iterator &other) const {
320  return symbol == other.symbol;
321  }
322 
323  bool operator!=(const symbol_iterator &other) const {
324  return !(*this == other);
325  }
326 
327  symbol_iterator &operator++() { // Preincrement
328  symbol = symbol.getNext();
329  return *this;
330  }
331  };
332 
335 
336  /// Size field is 10 decimal digits long
337  static const uint64_t MaxMemberSize = 9999999999;
338 
340 
341  Kind kind() const { return (Kind)Format; }
342  bool isThin() const { return IsThin; }
344 
345  child_iterator child_begin(Error &Err, bool SkipInternal = true) const;
346  child_iterator child_end() const;
348  bool SkipInternal = true) const {
349  return make_range(child_begin(Err, SkipInternal), child_end());
350  }
351 
353  symbol_iterator symbol_end() const;
355  return make_range(symbol_begin(), symbol_end());
356  }
357 
358  static bool classof(Binary const *v) { return v->isArchive(); }
359 
360  // check if a symbol is in the archive
362 
363  virtual bool isEmpty() const;
364  bool hasSymbolTable() const;
365  StringRef getSymbolTable() const { return SymbolTable; }
366  StringRef getStringTable() const { return StringTable; }
368  virtual uint64_t getFirstChildOffset() const { return getArchiveMagicLen(); }
369 
370  std::vector<std::unique_ptr<MemoryBuffer>> takeThinBuffers() {
371  return std::move(ThinBuffers);
372  }
373 
374  std::unique_ptr<AbstractArchiveMemberHeader>
375  createArchiveMemberHeader(const char *RawHeaderPtr, uint64_t Size,
376  Error *Err) const;
377 
378 protected:
380  void setFirstRegular(const Child &C);
381 
382 private:
383  StringRef SymbolTable;
384  StringRef StringTable;
385 
386  StringRef FirstRegularData;
387  uint16_t FirstRegularStartOfFile = -1;
388 
389  unsigned Format : 3;
390  unsigned IsThin : 1;
391  mutable std::vector<std::unique_ptr<MemoryBuffer>> ThinBuffers;
392 };
393 
394 class BigArchive : public Archive {
395 public:
396  /// Fixed-Length Header.
397  struct FixLenHdr {
398  char Magic[sizeof(BigArchiveMagic) - 1]; ///< Big archive magic string.
399  char MemOffset[20]; ///< Offset to member table.
400  char GlobSymOffset[20]; ///< Offset to global symbol table.
401  char
402  GlobSym64Offset[20]; ///< Offset global symbol table for 64-bit objects.
403  char FirstChildOffset[20]; ///< Offset to first archive member.
404  char LastChildOffset[20]; ///< Offset to last archive member.
405  char FreeOffset[20]; ///< Offset to first mem on free list.
406  };
407 
411 
412 public:
414  uint64_t getFirstChildOffset() const override { return FirstChildOffset; }
416  bool isEmpty() const override {
417  return Data.getBufferSize() == sizeof(FixLenHdr);
418  };
419 };
420 
421 } // end namespace object
422 } // end namespace llvm
423 
424 #endif // LLVM_OBJECT_ARCHIVE_H
llvm::Check::Size
@ Size
Definition: FileCheck.h:77
llvm::object::CommonArchiveMemberHeader::getRawLastModified
StringRef getRawLastModified() const override
Definition: Archive.cpp:76
MemoryBuffer.h
llvm::object::Archive::K_GNU64
@ K_GNU64
Definition: Archive.h:339
llvm::object::CommonArchiveMemberHeader::getRawUID
StringRef getRawUID() const override
Definition: Archive.cpp:80
llvm::object::UnixArMemHdrType::GID
char GID[6]
Definition: Archive.h:99
llvm::object::BigArchive::getFirstChildOffset
uint64_t getFirstChildOffset() const override
Definition: Archive.h:414
llvm::object::Archive::K_COFF
@ K_COFF
Definition: Archive.h:339
llvm::object::Archive::Kind
Kind
Definition: Archive.h:339
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:17
llvm::object::Archive::K_BSD
@ K_BSD
Definition: Archive.h:339
llvm::make_range
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
Definition: iterator_range.h:53
llvm::object::BigArMemHdrType::Name
char Name[2]
Definition: Archive.h:133
llvm::object::Archive::Child::getAsBinary
Expected< std::unique_ptr< Binary > > getAsBinary(LLVMContext *Context=nullptr) const
Definition: Archive.cpp:647
llvm::object::Archive::Child::getNext
Expected< Child > getNext() const
Definition: Archive.cpp:584
FileSystem.h
llvm::object::Archive::Child::operator==
bool operator==(const Child &other) const
Definition: Archive.h:218
llvm::object::Archive::Child::operator=
Child & operator=(Child &&C) noexcept
Definition: Archive.h:193
llvm::object::Archive::child_end
child_iterator child_end() const
Definition: Archive.cpp:957
llvm::object::Archive::Archive
Archive(MemoryBufferRef Source, Error &Err)
Definition: Archive.cpp:698
llvm::object::CommonArchiveMemberHeader::CommonArchiveMemberHeader
CommonArchiveMemberHeader(const Archive *Parent, const T *RawHeaderPtr)
Definition: Archive.h:82
llvm::object::BigArchive::FixLenHdr::GlobSym64Offset
char GlobSym64Offset[20]
Offset global symbol table for 64-bit objects.
Definition: Archive.h:402
llvm::object::Archive::children
iterator_range< child_iterator > children(Error &Err, bool SkipInternal=true) const
Definition: Archive.h:347
llvm::object::Archive::Child::Child
Child(const Archive *Parent, const char *Start, Error *Err)
Definition: Archive.cpp:458
llvm::object::BigArchive::isEmpty
bool isEmpty() const override
Definition: Archive.h:416
StringRef.h
llvm::object::BigArchiveMemberHeader
Definition: Archive.h:139
llvm::object::Archive::Child::operator=
Child & operator=(const Child &C)
Definition: Archive.h:205
llvm::object::AbstractArchiveMemberHeader::AbstractArchiveMemberHeader
AbstractArchiveMemberHeader(const Archive *Parent)
Definition: Archive.h:44
llvm::object::Archive::setFirstRegular
void setFirstRegular(const Child &C)
Definition: Archive.cpp:693
llvm::object::Archive::Child::getFullName
Expected< std::string > getFullName() const
Definition: Archive.cpp:544
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:329
llvm::object::Archive::symbol_iterator::operator==
bool operator==(const symbol_iterator &other) const
Definition: Archive.h:319
llvm::object::Archive::getStringTable
StringRef getStringTable() const
Definition: Archive.h:366
llvm::object::Archive::symbol_iterator::operator*
const Symbol & operator*() const
Definition: Archive.h:317
Error.h
llvm::object::Archive::symbol_iterator::symbol_iterator
symbol_iterator(const Symbol &s)
Definition: Archive.h:314
llvm::object::Archive::K_GNU
@ K_GNU
Definition: Archive.h:339
llvm::object::AbstractArchiveMemberHeader::Parent
const Archive * Parent
Definition: Archive.h:76
llvm::object::Archive::ChildFallibleIterator
Definition: Archive.h:260
llvm::object::Archive::getNumberOfSymbols
uint32_t getNumberOfSymbols() const
Definition: Archive.cpp:1124
llvm::object::Binary::Data
MemoryBufferRef Data
Definition: Binary.h:37
llvm::object::AbstractArchiveMemberHeader::clone
virtual std::unique_ptr< AbstractArchiveMemberHeader > clone() const =0
llvm::object::Archive::ChildFallibleIterator::inc
Error inc()
Definition: Archive.h:281
llvm::object::Archive::symbol_begin
symbol_iterator symbol_begin() const
Definition: Archive.cpp:1064
T
#define T
Definition: Mips16ISelLowering.cpp:341
llvm::MemoryBufferRef::getBufferSize
size_t getBufferSize() const
Definition: MemoryBufferRef.h:37
llvm::object::CommonArchiveMemberHeader::getRawGID
StringRef getRawGID() const override
Definition: Archive.cpp:84
llvm::object::BigArchiveMemberHeader::getRawNameSize
Expected< uint64_t > getRawNameSize() const
Definition: Archive.cpp:365
llvm::object::Archive::Symbol
Definition: Archive.h:292
llvm::object::Archive::Child::getGID
Expected< unsigned > getGID() const
Definition: Archive.h:239
llvm::Expected
Tagged union holding either a T or a Error.
Definition: APFloat.h:41
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:267
llvm::object::Archive::Symbol::getName
StringRef getName() const
Definition: Archive.cpp:961
llvm::object::Archive::symbol_iterator
Definition: Archive.h:310
Chrono.h
Context
LLVMContext & Context
Definition: NVVMIntrRange.cpp:66
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:90
llvm::object::Archive::Symbol::Symbol
Symbol(const Archive *p, uint32_t symi, uint32_t stri)
Definition: Archive.h:298
llvm::object::ArchiveMagic
const char ArchiveMagic[]
Definition: Archive.h:36
llvm::object::Archive
Definition: Archive.h:159
llvm::object::AbstractArchiveMemberHeader::getLastModified
Expected< sys::TimePoint< std::chrono::seconds > > getLastModified() const
Definition: Archive.cpp:384
llvm::object::ThinArchiveMagic
const char ThinArchiveMagic[]
Definition: Archive.h:37
llvm::object::BigArchive::FixLenHdr::FirstChildOffset
char FirstChildOffset[20]
Offset to first archive member.
Definition: Archive.h:403
llvm::object::BigArchiveMemberHeader::clone
std::unique_ptr< AbstractArchiveMemberHeader > clone() const override
Definition: Archive.h:145
llvm::object::BigArchiveMemberHeader::getName
Expected< StringRef > getName(uint64_t Size) const override
Get the name looking up long names.
Definition: Archive.cpp:343
llvm::object::Archive::getArchiveMagicLen
uint64_t getArchiveMagicLen() const
Definition: Archive.cpp:683
llvm::object::BigArchiveMagic
const char BigArchiveMagic[]
Definition: Archive.h:38
llvm::object::Binary::isArchive
bool isArchive() const
Definition: Binary.h:114
llvm::object::Archive::Child::Child
Child(const Child &C)
Definition: Archive.h:180
llvm::object::Archive::isEmpty
virtual bool isEmpty() const
Definition: Archive.cpp:1159
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:370
llvm::object::BigArchive
Definition: Archive.h:394
llvm::object::Archive::MaxMemberSize
static const uint64_t MaxMemberSize
Size field is 10 decimal digits long.
Definition: Archive.h:337
llvm::object::Archive::getFirstChildOffset
virtual uint64_t getFirstChildOffset() const
Definition: Archive.h:368
llvm::object::BigArMemHdrType::Terminator
char Terminator[2]
Definition: Archive.h:134
llvm::object::UnixArMemHdrType
Definition: Archive.h:95
llvm::object::Archive::symbol_iterator::operator!=
bool operator!=(const symbol_iterator &other) const
Definition: Archive.h:323
llvm::object::AbstractArchiveMemberHeader::getGID
Expected< unsigned > getGID() const
Definition: Archive.cpp:401
llvm::object::Archive::getSymbolTable
StringRef getSymbolTable() const
Definition: Archive.h:365
fallible_iterator.h
llvm::object::ArchiveMemberHeader::getSize
Expected< uint64_t > getSize() const override
Definition: Archive.cpp:347
llvm::object::BigArchive::FixLenHdr::MemOffset
char MemOffset[20]
Offset to member table.
Definition: Archive.h:399
llvm::object::Archive::Child::getBuffer
Expected< StringRef > getBuffer() const
Definition: Archive.cpp:562
llvm::object::CommonArchiveMemberHeader
Definition: Archive.h:80
llvm::object::Archive::ChildFallibleIterator::ChildFallibleIterator
ChildFallibleIterator()
Definition: Archive.h:264
llvm::object::BigArMemHdrType
Definition: Archive.h:123
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:230
llvm::object::Archive::isThin
bool isThin() const
Definition: Archive.h:342
llvm::object::BigArMemHdrType::AccessMode
char AccessMode[12]
Definition: Archive.h:130
llvm::object::Archive::Child::getDataOffset
uint64_t getDataOffset() const
Definition: Archive.h:252
llvm::object::UnixArMemHdrType::Terminator
char Terminator[2]
Definition: Archive.h:102
llvm::object::BigArchive::getLastChildOffset
uint64_t getLastChildOffset() const
Definition: Archive.h:415
llvm::object::AbstractArchiveMemberHeader
Definition: Archive.h:42
llvm::object::UnixArMemHdrType::LastModified
char LastModified[12]
Definition: Archive.h:97
llvm::object::Archive::Child::getRawName
Expected< StringRef > getRawName() const
Definition: Archive.h:228
llvm::object::Archive::Child::getUID
Expected< unsigned > getUID() const
Definition: Archive.h:238
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:358
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:186
llvm::object::Archive::K_DARWIN64
@ K_DARWIN64
Definition: Archive.h:339
llvm::object::UnixArMemHdrType::AccessMode
char AccessMode[8]
Definition: Archive.h:100
uint64_t
llvm::object::CommonArchiveMemberHeader::getOffset
uint64_t getOffset() const override
Definition: Archive.cpp:88
llvm::object::symbol_iterator
Definition: ObjectFile.h:207
llvm::object::Archive::ChildFallibleIterator::ChildFallibleIterator
ChildFallibleIterator(const Child &C)
Definition: Archive.h:265
llvm::object::Archive::symbol_end
symbol_iterator symbol_end() const
Definition: Archive.cpp:1120
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:68
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:110
llvm::object::Archive::Child::getAccessMode
Expected< sys::fs::perms > getAccessMode() const
Definition: Archive.h:241
llvm::object::BigArchiveMemberHeader::getNextChildLoc
Expected< const char * > getNextChildLoc() const override
Get next file member location.
Definition: Archive.cpp:441
llvm::object::BigArchive::FixLenHdr::FreeOffset
char FreeOffset[20]
Offset to first mem on free list.
Definition: Archive.h:405
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
llvm::object::BigArMemHdrType::NameLen
char NameLen[4]
Definition: Archive.h:131
llvm::object::Archive::hasSymbolTable
bool hasSymbolTable() const
Definition: Archive.cpp:1163
llvm::object::Archive::ChildFallibleIterator::operator==
bool operator==(const ChildFallibleIterator &other) const
Definition: Archive.h:270
llvm::object::AbstractArchiveMemberHeader::getRawLastModified
virtual StringRef getRawLastModified() const =0
llvm::object::BigArchiveMemberHeader::isThin
Expected< bool > isThin() const override
Definition: Archive.h:156
iterator_range.h
llvm::object::Archive::child_begin
child_iterator child_begin(Error &Err, bool SkipInternal=true) const
Definition: Archive.cpp:941
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:101
llvm::object::Archive::Child::getRawSize
Expected< uint64_t > getRawSize() const
Definition: Archive.cpp:538
llvm::object::BigArchiveMemberHeader::getNextOffset
Expected< uint64_t > getNextOffset() const
Definition: Archive.cpp:370
llvm::object::Archive::Symbol::getMember
Expected< Child > getMember() const
Definition: Archive.cpp:965
llvm::object::Archive::findSym
Expected< Optional< Child > > findSym(StringRef name) const
Definition: Archive.cpp:1142
llvm::object::Archive::Child::getRawLastModified
StringRef getRawLastModified() const
Definition: Archive.h:234
llvm::object::BigArMemHdrType::UID
char UID[12]
Definition: Archive.h:128
llvm::object::Archive::symbol_iterator::operator++
symbol_iterator & operator++()
Definition: Archive.h:327
llvm::object::Archive::K_AIXBIG
@ K_AIXBIG
Definition: Archive.h:339
llvm::Sched::Source
@ Source
Definition: TargetLowering.h:99
llvm::object::BigArchive::BigArchive
BigArchive(MemoryBufferRef Source, Error &Err)
Definition: Archive.cpp:1165
llvm::object::AbstractArchiveMemberHeader::~AbstractArchiveMemberHeader
virtual ~AbstractArchiveMemberHeader()=default
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:58
llvm::object::UnixArMemHdrType::Name
char Name[16]
Definition: Archive.h:96
llvm::object::Binary
Definition: Binary.h:32
llvm::object::BigArchive::FixLenHdr::Magic
char Magic[sizeof(BigArchiveMagic) - 1]
Big archive magic string.
Definition: Archive.h:398
llvm::object::BigArchive::FixLenHdr::LastChildOffset
char LastChildOffset[20]
Offset to last archive member.
Definition: Archive.h:404
uint32_t
llvm::object::ArchiveMemberHeader::getNextChildLoc
Expected< const char * > getNextChildLoc() const override
Get next file member location.
Definition: Archive.cpp:416
llvm::object::Archive::Child::getName
Expected< StringRef > getName() const
Definition: Archive.cpp:622
llvm::object::Archive::ChildFallibleIterator::operator*
const Child & operator*() const
Definition: Archive.h:268
llvm::object::BigArchive::FirstChildOffset
uint64_t FirstChildOffset
Definition: Archive.h:409
llvm::object::Archive::Child
Definition: Archive.h:163
llvm::object::Archive::Symbol::operator==
bool operator==(const Symbol &other) const
Definition: Archive.h:301
llvm::object::AbstractArchiveMemberHeader::getRawName
virtual Expected< StringRef > getRawName() const =0
Get the name without looking up long names.
llvm::object::BigArchive::ArFixLenHdr
const FixLenHdr * ArFixLenHdr
Definition: Archive.h:408
llvm::cl::Optional
@ Optional
Definition: CommandLine.h:115
llvm::object::Archive::Symbol::getNext
Symbol getNext() const
Definition: Archive.cpp:1025
llvm::object::BigArchive::FixLenHdr::GlobSymOffset
char GlobSymOffset[20]
Offset to global symbol table.
Definition: Archive.h:400
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:615
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:674
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:316
llvm::Error
Lightweight error class with error context and mandatory checking.
Definition: Error.h:155
llvm::object::Archive::kind
Kind kind() const
Definition: Archive.h:341
llvm::object::BigArMemHdrType::Size
char Size[20]
Definition: Archive.h:124
llvm::object::AbstractArchiveMemberHeader::getUID
Expected< unsigned > getUID() const
Definition: Archive.cpp:394
llvm::object::BigArchive::FixLenHdr
Fixed-Length Header.
Definition: Archive.h:397
llvm::object::UnixArMemHdrType::UID
char UID[6]
Definition: Archive.h:98
llvm::object::BigArchive::LastChildOffset
uint64_t LastChildOffset
Definition: Archive.h:410
llvm::object::ArchiveMemberHeader::isThin
Expected< bool > isThin() const override
Definition: Archive.cpp:408
llvm::object::Archive::K_DARWIN
@ K_DARWIN
Definition: Archive.h:339
llvm::object::BigArMemHdrType::LastModified
char LastModified[12]
Definition: Archive.h:127
llvm::object::AbstractArchiveMemberHeader::getSize
virtual Expected< uint64_t > getSize() const =0
llvm::object::Archive::Child::getSize
Expected< uint64_t > getSize() const
Definition: Archive.cpp:532
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:129
llvm::object::Archive::getDefaultKindForHost
static object::Archive::Kind getDefaultKindForHost()
Definition: Archive.cpp:933
llvm::object::ArchiveMemberHeader
Definition: Archive.h:105
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:290
llvm::object::BigArchiveMemberHeader::getSize
Expected< uint64_t > getSize() const override
Definition: Archive.cpp:352
llvm::object::CommonArchiveMemberHeader::ArMemHdr
const T * ArMemHdr
Definition: Archive.h:92
llvm::object::BigArMemHdrType::PrevOffset
char PrevOffset[20]
Definition: Archive.h:126
llvm::object::Archive::Child::getMemoryBufferRef
Expected< MemoryBufferRef > getMemoryBufferRef() const
Definition: Archive.cpp:635
llvm::object::AbstractArchiveMemberHeader::getRawAccessMode
virtual StringRef getRawAccessMode() const =0
llvm::object::Archive::Child::getParent
const Archive * getParent() const
Definition: Archive.h:223
llvm::object::CommonArchiveMemberHeader::getRawAccessMode
StringRef getRawAccessMode() const override
Definition: Archive.cpp:71
llvm::object::BigArMemHdrType::NextOffset
char NextOffset[20]
Definition: Archive.h:125
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:354
llvm::StringRef::begin
iterator begin() const
Definition: StringRef.h:128
llvm::object::Archive::create
static Expected< std::unique_ptr< Archive > > create(MemoryBufferRef Source)
Definition: Archive.cpp:658
llvm::object::AbstractArchiveMemberHeader::getAccessMode
Expected< sys::fs::perms > getAccessMode() const
Definition: Archive.cpp:375
llvm::object::Archive::ChildFallibleIterator::operator!=
bool operator!=(const ChildFallibleIterator &other) const
Definition: Archive.h:277
llvm::object::AbstractArchiveMemberHeader::getRawGID
virtual StringRef getRawGID() const =0