Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1 | //===- ArchiveWriter.h - ar archive file format writer ----------*- C++ -*-===// |
| 2 | // |
Andrew Walbran | 16937d0 | 2019-10-22 13:54:20 +0100 | [diff] [blame^] | 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 |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | // |
| 9 | // Declares the writeArchive function for writing an archive file. |
| 10 | // |
| 11 | //===----------------------------------------------------------------------===// |
| 12 | |
| 13 | #ifndef LLVM_OBJECT_ARCHIVEWRITER_H |
| 14 | #define LLVM_OBJECT_ARCHIVEWRITER_H |
| 15 | |
| 16 | #include "llvm/ADT/StringRef.h" |
| 17 | #include "llvm/Object/Archive.h" |
| 18 | #include "llvm/Support/Error.h" |
| 19 | #include "llvm/Support/FileSystem.h" |
| 20 | |
| 21 | namespace llvm { |
| 22 | |
| 23 | struct NewArchiveMember { |
| 24 | std::unique_ptr<MemoryBuffer> Buf; |
| 25 | StringRef MemberName; |
| 26 | sys::TimePoint<std::chrono::seconds> ModTime; |
| 27 | unsigned UID = 0, GID = 0, Perms = 0644; |
| 28 | |
| 29 | bool IsNew = false; |
| 30 | NewArchiveMember() = default; |
| 31 | NewArchiveMember(MemoryBufferRef BufRef); |
| 32 | |
| 33 | static Expected<NewArchiveMember> |
| 34 | getOldMember(const object::Archive::Child &OldMember, bool Deterministic); |
| 35 | |
| 36 | static Expected<NewArchiveMember> getFile(StringRef FileName, |
| 37 | bool Deterministic); |
| 38 | }; |
| 39 | |
| 40 | Error writeArchive(StringRef ArcName, ArrayRef<NewArchiveMember> NewMembers, |
| 41 | bool WriteSymtab, object::Archive::Kind Kind, |
| 42 | bool Deterministic, bool Thin, |
| 43 | std::unique_ptr<MemoryBuffer> OldArchiveBuf = nullptr); |
| 44 | } |
| 45 | |
| 46 | #endif |