LLVM  15.0.0git
ArchiveWriter.h
Go to the documentation of this file.
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.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef LLVM_OBJECT_ARCHIVEWRITER_H
14 #define LLVM_OBJECT_ARCHIVEWRITER_H
15 
16 #include "llvm/Object/Archive.h"
17 
18 namespace llvm {
19 
21  std::unique_ptr<MemoryBuffer> Buf;
24  unsigned UID = 0, GID = 0, Perms = 0644;
25 
26  NewArchiveMember() = default;
28 
29  // Detect the archive format from the object or bitcode file. This helps
30  // assume the archive format when creating or editing archives in the case
31  // one isn't explicitly set.
33 
35  getOldMember(const object::Archive::Child &OldMember, bool Deterministic);
36 
38  bool Deterministic);
39 };
40 
42 
44  bool WriteSymtab, object::Archive::Kind Kind,
45  bool Deterministic, bool Thin,
46  std::unique_ptr<MemoryBuffer> OldArchiveBuf = nullptr);
47 
48 // writeArchiveToBuffer is similar to writeArchive but returns the Archive in a
49 // buffer instead of writing it out to a file.
51 writeArchiveToBuffer(ArrayRef<NewArchiveMember> NewMembers, bool WriteSymtab,
52  object::Archive::Kind Kind, bool Deterministic, bool Thin);
53 }
54 
55 #endif
llvm::NewArchiveMember
Definition: ArchiveWriter.h:20
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::NewArchiveMember::getFile
static Expected< NewArchiveMember > getFile(StringRef FileName, bool Deterministic)
Definition: ArchiveWriter.cpp:115
llvm::NewArchiveMember::Buf
std::unique_ptr< MemoryBuffer > Buf
Definition: ArchiveWriter.h:21
llvm::NewArchiveMember::ModTime
sys::TimePoint< std::chrono::seconds > ModTime
Definition: ArchiveWriter.h:23
llvm::Expected
Tagged union holding either a T or a Error.
Definition: APFloat.h:41
llvm::MemoryBufferRef
Definition: MemoryBufferRef.h:22
llvm::sys::TimePoint
std::chrono::time_point< std::chrono::system_clock, D > TimePoint
A time point on the system clock.
Definition: Chrono.h:34
llvm::writeArchive
Error writeArchive(StringRef ArcName, ArrayRef< NewArchiveMember > NewMembers, bool WriteSymtab, object::Archive::Kind Kind, bool Deterministic, bool Thin, std::unique_ptr< MemoryBuffer > OldArchiveBuf=nullptr)
Definition: ArchiveWriter.cpp:823
llvm::NewArchiveMember::detectKindFromObject
object::Archive::Kind detectKindFromObject() const
Definition: ArchiveWriter.cpp:50
llvm::lltok::Kind
Kind
Definition: LLToken.h:18
llvm::NewArchiveMember::NewArchiveMember
NewArchiveMember()=default
llvm::computeArchiveRelativePath
Expected< std::string > computeArchiveRelativePath(StringRef From, StringRef To)
Definition: ArchiveWriter.cpp:629
llvm::ArrayRef
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: APInt.h:32
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:58
Archive.h
llvm::object::Archive::Child
Definition: Archive.h:163
llvm::NewArchiveMember::MemberName
StringRef MemberName
Definition: ArchiveWriter.h:22
llvm::Error
Lightweight error class with error context and mandatory checking.
Definition: Error.h:155
llvm::NewArchiveMember::Perms
unsigned Perms
Definition: ArchiveWriter.h:24
llvm::NewArchiveMember::UID
unsigned UID
Definition: ArchiveWriter.h:24
llvm::NewArchiveMember::GID
unsigned GID
Definition: ArchiveWriter.h:24
From
BlockVerifier::State From
Definition: BlockVerifier.cpp:55
llvm::NewArchiveMember::getOldMember
static Expected< NewArchiveMember > getOldMember(const object::Archive::Child &OldMember, bool Deterministic)
Definition: ArchiveWriter.cpp:85
llvm::writeArchiveToBuffer
Expected< std::unique_ptr< MemoryBuffer > > writeArchiveToBuffer(ArrayRef< NewArchiveMember > NewMembers, bool WriteSymtab, object::Archive::Kind Kind, bool Deterministic, bool Thin)
Definition: ArchiveWriter.cpp:856