[Alignment][NFC] Migrate Instructions to Align
[llvm-core.git] / include / llvm / Object / ArchiveWriter.h
blob9e6daf2da36e9b344228d961d473ea602bbad4e0
1 //===- ArchiveWriter.h - ar archive file format writer ----------*- 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 // Declares the writeArchive function for writing an archive file.
11 //===----------------------------------------------------------------------===//
13 #ifndef LLVM_OBJECT_ARCHIVEWRITER_H
14 #define LLVM_OBJECT_ARCHIVEWRITER_H
16 #include "llvm/ADT/StringRef.h"
17 #include "llvm/Object/Archive.h"
18 #include "llvm/Support/Error.h"
19 #include "llvm/Support/FileSystem.h"
21 namespace llvm {
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;
29 NewArchiveMember() = default;
30 NewArchiveMember(MemoryBufferRef BufRef);
32 static Expected<NewArchiveMember>
33 getOldMember(const object::Archive::Child &OldMember, bool Deterministic);
35 static Expected<NewArchiveMember> getFile(StringRef FileName,
36 bool Deterministic);
39 Expected<std::string> computeArchiveRelativePath(StringRef From, StringRef To);
41 Error writeArchive(StringRef ArcName, ArrayRef<NewArchiveMember> NewMembers,
42 bool WriteSymtab, object::Archive::Kind Kind,
43 bool Deterministic, bool Thin,
44 std::unique_ptr<MemoryBuffer> OldArchiveBuf = nullptr);
47 #endif