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;
125Expected<std::shared_ptr<lto::InputFile>>
130 InputFiles.emplace_back(InputPtr.release());
131 std::shared_ptr<lto::InputFile> &
Input = InputFiles.back();
138 if (ArchivePath.
empty() && !
Input->isFatLTOObject())
148 Input->isFatLTOObject() ?
false : isThinArchive(ArchivePath);
152 if (*UseThinMember) {
155 computeThinArchiveMemberPath(ArchivePath,
Input->getMemberName());
158 Input->setSerializeForDistribution(
true);
162 std::string Seq = std::to_string(InputFiles.size());
180 if (
Input->getSerializeForDistribution()) {
181 TimeTraceScope TimeScope(
"Serialize bitcode input for DTLTO", ModuleId);
194Error lto::DTLTO::saveInputArchiveMembers() {
195 for (
auto &
Input : InputFiles) {
196 if (!
Input->isThinLTO())
198 if (
Error EC = saveInputArchiveMember(
Input.get()))
211 if (
Error EC = saveInputArchiveMembers())
220 for (
auto &
Input : InputFiles) {
221 if (!
Input->getSerializeForDistribution())
226 EC != std::make_error_code(std::errc::no_such_file_or_directory))
227 errs() <<
"warning: could not remove temporary DTLTO input file '"
228 <<
Input->getName() <<
"': " << EC.message() <<
"\n";
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).
The TimeTraceScope is a helper class to call the begin and end functions of the time trace profiler.
LLVM_ABI void cleanup() override
LLVM_ABI llvm::Error handleArchiveInputs() override
LLVM_ABI Expected< std::shared_ptr< InputFile > > addInput(std::unique_ptr< 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.
LLVM_ABI bool RemoveFileOnSignal(StringRef Filename, std::string *ErrMsg=nullptr)
This function registers signal handlers to ensure that if a signal gets delivered that the named file...
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.
LLVM_ABI raw_fd_ostream & errs()
This returns a reference to a raw_ostream for standard error.
@ archive
ar style archive file