LLVM: lib/ObjCopy/Archive.cpp Source File (original) (raw)
1
2
3
4
5
6
7
8
16
17using namespace llvm;
20
24 std::vector NewArchiveMembers;
28 if (!ChildNameOrErr)
30
32 if (!ChildOrErr)
35
38
40 return std::move(E);
41
44 if (!Member)
46
47 Member->Buf = std::make_unique(
48 std::move(Buffer), ChildNameOrErr.get());
49 Member->MemberName = Member->Buf->getBufferIdentifier();
50 NewArchiveMembers.push_back(std::move(*Member));
51 }
52 if (Err)
54 std::move(Err));
55 return std::move(NewArchiveMembers);
56}
57
58
59
64 bool Thin) {
68
70 Deterministic, Thin))
72
73 if (!Thin)
75
77
78
79
80
81
82
83
87 if (!FB)
89 std::copy(Member.Buf->getBufferStart(), Member.Buf->getBufferEnd(),
90 (*FB)->getBufferStart());
91 if (Error E = (*FB)->commit())
92 return E;
93 }
95}
96
101 if (!NewArchiveMembersOrErr)
102 return NewArchiveMembersOrErr.takeError();
109}
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
static Error deepWriteArchive(StringRef ArcName, ArrayRef< NewArchiveMember > NewMembers, SymtabWritingMode WriteSymtab, object::Archive::Kind Kind, bool Deterministic, bool Thin)
Definition Archive.cpp:60
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
const T & front() const
front - Get the first element.
bool empty() const
empty - Check if the array is empty.
Lightweight error class with error context and mandatory checking.
static ErrorSuccess success()
Create a success value.
Tagged union holding either a T or a Error.
Error takeError()
Take ownership of the stored error.
reference get()
Returns a reference to the stored T value.
static LLVM_ABI Expected< std::unique_ptr< FileOutputBuffer > > create(StringRef FilePath, size_t Size, unsigned Flags=0)
Factory method to create an OutputBuffer object which manages a read/write buffer of the specified si...
@ F_executable
Set the 'x' bit on the resulting file.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
StringRef - Represent a constant reference to a string, i.e.
virtual const CommonConfig & getCommonConfig() const =0
iterator_range< child_iterator > children(Error &Err, bool SkipInternal=true) const
bool hasSymbolTable() const
StringRef getFileName() const
A raw_ostream that writes to an SmallVector or SmallString.
LLVM_ABI Error executeObjcopyOnBinary(const MultiFormatConfig &Config, object::Binary &In, raw_ostream &Out)
Applies the transformations described by Config to In and writes the result into Out.
LLVM_ABI Error executeObjcopyOnArchive(const MultiFormatConfig &Config, const object::Archive &Ar)
Applies the transformations described by Config to each member in archive Ar.
Definition Archive.cpp:97
Expected< std::vector< NewArchiveMember > > createNewArchiveMembers(const MultiFormatConfig &Config, const object::Archive &Ar)
Applies the transformations described by Config to each member in archive Ar.
Definition Archive.cpp:22
This is an optimization pass for GlobalISel generic memory operations.
Error createFileError(const Twine &F, Error E)
Concatenate a source file path and/or name with an Error.
LLVM_ABI Error writeArchive(StringRef ArcName, ArrayRef< NewArchiveMember > NewMembers, SymtabWritingMode WriteSymtab, object::Archive::Kind Kind, bool Deterministic, bool Thin, std::unique_ptr< MemoryBuffer > OldArchiveBuf=nullptr, std::optional< bool > IsEC=std::nullopt, function_ref< void(Error)> Warn=warnToStderr)
static LLVM_ABI Expected< NewArchiveMember > getOldMember(const object::Archive::Child &OldMember, bool Deterministic)
bool DeterministicArchives