43 "Failed to create file %s: %s", FilePath.
data(),
44 EC.message().c_str());
46 OS.write(FileBuffer.
data(), FileBuffer.
size());
49 "Failed writing to file %s", FilePath.
data());
60 assert(!ArchivePath.
empty() &&
"An archive file path must be non empty.");
66 MemberPath = MemberName;
80 auto Cached = ArchiveFiles.find(ArchivePath);
81 if (Cached != ArchiveFiles.end())
82 return Cached->second;
84 uint64_t FileSize = -1;
89 "Failed to get file size from archive %s: %s",
90 ArchivePath.
data(),
EC.message().c_str());
93 "Archive file size is too small %s",
97 ErrorOr<std::unique_ptr<MemoryBuffer>> MemBufferOrError =
101 if ((EC = MemBufferOrError.
getError()))
103 "Failed to read from archive %s: %s",
104 ArchivePath.
data(),
EC.message().c_str());
106 StringRef MemBuf = (*MemBufferOrError.
get()).getBuffer();
109 "Unknown format for archive %s",
115 ArchiveFiles[ArchivePath] = IsThin;
121void lto::DTLTO::removeTempFiles() {
122 for (
auto &Input : InputFiles) {
123 if (Input->isMemberOfArchive())
134Expected<std::shared_ptr<lto::InputFile>>
138 InputFiles.emplace_back(InputPtr.release());
139 std::shared_ptr<lto::InputFile> &
Input = InputFiles.back();
145 if (ArchivePath.
empty())
159 computeThinArchiveMemberPath(ArchivePath,
Input->getMemberName());
162 Input->memberOfArchive(
true);
166 std::string Seq = std::to_string(InputFiles.size());
182 if (
Input->isMemberOfArchive()) {
192Error lto::DTLTO::saveInputArchiveMembers() {
193 for (
auto &
Input : InputFiles) {
194 if (!
Input->isThinLTO())
196 if (
Error EC = saveInputArchiveMember(
Input.get()))
209 if (
Error EC = saveInputArchiveMembers())
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
Provides a library for accessing information about this process and other processes on the operating ...
This file defines the SmallString class.
Represents a module in a bitcode file.
void setModuleIdentifier(llvm::StringRef ModuleId)
std::error_code getError() const
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.
StringRef getBuffer() const
static ErrorOr< std::unique_ptr< MemoryBuffer > > getFileSlice(const Twine &Filename, uint64_t MapSize, uint64_t Offset, bool IsVolatile=false, std::optional< Align > Alignment=std::nullopt)
Map a subrange of the specified file as a MemoryBuffer.
SmallString - A SmallString is just a SmallVector with methods and accessors that make it work better...
StringRef str() const
Explicit conversion to StringRef.
StringRef - Represent a constant reference to a string, i.e.
std::string str() const
str - Get the contents as an std::string.
bool starts_with(StringRef Prefix) const
Check if this string starts with the given Prefix.
constexpr bool empty() const
empty - Check if the string is empty.
constexpr size_t size() const
size - Get the string size.
constexpr const char * data() const
data - Get a pointer to the start of the string (which may not be null terminated).
virtual LLVM_ABI llvm::Error handleArchiveInputs() override
virtual LLVM_ABI Expected< std::shared_ptr< lto::InputFile > > addInput(std::unique_ptr< lto::InputFile > InputPtr) override
A raw_ostream that writes to a file descriptor.
static LLVM_ABI Pid getProcessId()
Get the process's identifier.
const char ThinArchiveMagic[]
LLVM_ABI std::error_code remove(const Twine &path, bool IgnoreNonExisting=true)
Remove path.
std::error_code file_size(const Twine &Path, uint64_t &Result)
Get file size.
LLVM_ABI bool remove_dots(SmallVectorImpl< char > &path, bool remove_dot_dot=false, Style style=Style::native)
In-place remove any '.
LLVM_ABI StringRef parent_path(StringRef path LLVM_LIFETIME_BOUND, Style style=Style::native)
Get parent path.
LLVM_ABI bool is_relative(const Twine &path, Style style=Style::native)
Is path relative?
LLVM_ABI StringRef filename(StringRef path LLVM_LIFETIME_BOUND, Style style=Style::native)
Get filename.
LLVM_ABI void append(SmallVectorImpl< char > &path, const Twine &a, const Twine &b="", const Twine &c="", const Twine &d="")
Append to path.
This is an optimization pass for GlobalISel generic memory operations.
LLVM_ABI file_magic identify_magic(StringRef magic)
Identify the type of a binary file based on how magical it is.
LLVM_ABI std::error_code inconvertibleErrorCode()
The value returned by this function can be returned from convertToErrorCode for Error values where no...
std::string utohexstr(uint64_t X, bool LowerCase=false, unsigned Width=0)
Error createStringError(std::error_code EC, char const *Fmt, const Ts &... Vals)
Create formatted StringError object.
@ archive
ar style archive file