Home | History | Annotate | Download | only in Bitcode

Lines Matching defs:Archive

1 //===-- llvm/Bitcode/Archive.h - LLVM Bitcode Archive -----------*- C++ -*-===//
10 // This header file declares the Archive and ArchiveMember classes that provide
11 // manipulation of LLVM Archive files. The implementation is provided by the
12 // lib/Bitcode/Archive library. This library is used to read and write
13 // archive (*.a) files that contain LLVM bitcode files (or others).
31 class Archive; // Declared below
35 /// This class is the main class manipulated by users of the Archive class. It
36 /// holds information about one member of the Archive. It is also the element
37 /// stored by the Archive's ilist, the Archive's main abstraction. Because of
38 /// the special requirements of archive files, users are not permitted to
40 /// of the Archive class instead.
41 /// @brief This class represents a single archive member.
46 /// These flags are used internally by the archive member to specify various
63 /// @returns the parent Archive instance
64 /// @brief Get the archive associated with this member
65 Archive* getArchive() const { return parent; }
67 /// @returns the path to the Archive's file
68 /// @brief Get the path to the archive member
74 /// @brief Get the user associated with this archive member.
80 /// @brief Get the group associated with this archive member.
86 /// @brief Get the permission mode associated with this archive member.
89 /// This method returns the time at which the archive member was last
90 /// modified when it was not in the archive.
91 /// @brief Get the time of last modification of the archive member.
94 /// @returns the size of the archive member in bytes.
95 /// @brief Get the size of the archive member.
98 /// This method returns the total size of the archive member as it
105 /// archive member, if it is available. If the data has not been loaded
108 /// @brief Get the data content of the archive member
119 /// @returns true iff the archive member is the LLVM symbol table
123 /// @returns true iff the archive member is the ar(1) string table
127 /// @returns true iff the archive member is a bitcode file.
144 /// This method returns the status info (like Unix stat(2)) for the archive
149 /// @returns the status info for the archive member
150 /// @brief Obtain the status info for the archive member
153 /// This method causes the archive member to be replaced with the contents
158 /// @brief Replace contents of archive member with a new file.
165 Archive* parent; ///< Pointer to parent archive
168 unsigned flags; ///< Flags about the archive member
175 /// The default constructor is only used by the Archive's iplist when it
180 /// Used internally by the Archive class to construct an ArchiveMember.
181 /// The contents of the ArchiveMember are filled out by the Archive class.
182 explicit ArchiveMember(Archive *PAR);
184 // So Archive can construct an ArchiveMember
185 friend class llvm::Archive;
189 /// This class defines the interface to LLVM Archive files. The Archive class
190 /// presents the archive file as an ilist of ArchiveMember objects. The members
192 /// using editing methods on the Archive class (recommended). The Archive
193 /// class also provides several ways of accessing the archive file for various
199 class Archive {
205 /// the contents of the archive
206 /// @brief The ilist type of ArchiveMembers that Archive contains.
249 /// This method splices a \p src member from an archive (possibly \p this),
251 /// the archive is written, \p src will be written in its new location.
253 inline void splice(iterator dest, Archive& arch, iterator src)
256 /// This method erases a \p target member from the archive. When the
257 /// archive is written, it will no longer contain \p target. The associated
266 /// Create an empty archive file and associate it with the \p Filename. This
267 /// method does not actually create the archive disk file. It creates an
268 /// empty Archive object. If the writeToDisk method is called, the archive
270 /// the returned Archive object has at that time.
271 /// @returns An Archive* that represents the new archive file.
272 /// @brief Create an empty Archive.
273 static Archive* CreateEmpty(
274 const sys::Path& Filename,///< Name of the archive to (eventually) create.
278 /// Open an existing archive and load its contents in preparation for
280 /// on the contents of the archive file. You should use this form of open if
281 /// you intend to modify the archive or traverse its contents (e.g. for
283 /// @brief Open and load an archive file
284 static Archive* OpenAndLoad(
290 /// This method opens an existing archive file from \p Filename and reads in
291 /// its symbol table without reading in any of the archive's members. This
292 /// reduces both I/O and cpu time in opening the archive if it is to be used
294 /// exist and be an archive file or an error will be returned. This form
295 /// of opening the archive is intended for read-only operations that need to
297 /// members are not read by this method, the archive will appear empty upon
298 /// return. If editing operations are performed on the archive, they will
299 /// completely replace the contents of the archive! It is recommended that
300 /// if this form of opening the archive is used that only the symbol table
303 /// @returns an Archive* that represents the archive file, or null on error.
304 /// @brief Open an existing archive and load its symbols.
305 static Archive* OpenAndLoadSymbols(
306 const sys::Path& Filename, ///< Name of the archive file to open
311 /// This destructor cleans up the Archive object, releases all memory, and
312 /// closes files. It does nothing with the archive file on disk. If you
314 /// called, all changes to the archive will be lost.
315 /// @brief Destruct in-memory archive
316 ~Archive();
322 /// @returns the path to the archive file.
323 /// @brief Get the archive path.
327 /// on the Archive's iplist of ArchiveMember. However, it is recommended
333 /// This method allows direct query of the Archive's symbol table. The
340 /// there is purposefully no interface provided by Archive to look up
343 /// @returns the Archive's symbol table.
344 /// @brief Get the archive's symbol table
347 /// This method returns the offset in the archive file to the first "real"
348 /// file member. Archive files, on disk, have a signature and might have a
351 /// @returns the offset to the first "real" file member in the archive.
352 /// @brief Get the offset to the first "real" file member in the archive.
355 /// This method will scan the archive for bitcode modules, interpret them
361 /// @brief Instantiate all the bitcode modules located in the archive
364 /// This accessor looks up the \p symbol in the archive's symbol table and
367 /// archive into another module based on unresolved symbols. Note that the
369 /// is managed internally by the Archive class. It is possible that multiple
372 /// @returns The Module* found or null if the archive does not contain a
383 /// making one complete pass through the archive to resolve symbols but is
388 /// @brief Look up multiple symbols in the archive.
395 /// This method determines whether the archive is a properly formed llvm
396 /// bitcode archive. It first makes sure the symbol table has been loaded
397 /// and has a non-zero size. If it does, then it is an archive. If not,
398 /// then it tries to load all the bitcode modules of the archive. Finally,
400 /// @returns true if the archive is a proper llvm bitcode archive
401 /// @brief Determine whether the archive is a proper llvm bitcode archive.
408 /// This method is the only way to get the archive written to disk. It
410 /// or opened. The arguments provide options for writing the archive. If
411 /// \p CreateSymbolTable is true, the archive is scanned for bitcode files
414 /// archive members will have their path component stripped and the file
416 /// all archive members will be compressed before being written. If
420 /// @brief Write (possibly modified) archive contents to disk
427 /// This method adds a new file to the archive. The \p filename is examined
429 /// which is then inserted into the Archive object's ilist at the location
432 /// @brief Add a file to the archive.
443 /// @brief Construct an Archive for \p filename and optionally map it
445 explicit Archive(const sys::Path& filename, LLVMContext& C);
458 const char*End, ///< The pointer to the end of the archive
464 /// @brief Check that the archive signature is correct
469 /// @brief Load the entire archive.
497 /// @brief Maps archive into memory
500 /// @brief Frees all the members and unmaps the archive file.
515 sys::Path archPath; ///< Path to the archive file we read/write
517 MemoryBuffer *mapfile; ///< Raw Archive contents mapped into memory
530 Archive() LLVM_DELETED_FUNCTION;
531 Archive(const Archive&) LLVM_DELETED_FUNCTION;
532 Archive& operator=(const Archive&) LLVM_DELETED_FUNCTION;