46 "Failed to create file %s: %s",
Path.data(),
47 EC.message().c_str());
48 OS.write(Buffer.
data(), Buffer.
size());
51 "Failed writing to file %s",
Path.data());
72 "Normalization failed for path %s: %s",
73 Path.str().c_str(),
EC.message().c_str());
74 return Saver.
save(Expanded.
str());
76 return Saver.
save(Path);
86 assert(!ArchivePath.
empty() &&
"An archive file path must be non empty.");
92 MemberPath = MemberName;
106 auto Cached = ArchiveIsThinCache.find(ArchivePath);
107 if (Cached != ArchiveIsThinCache.end())
108 return Cached->second;
110 uint64_t FileSize = -1;
114 "Failed to get file size from archive %s: %s",
115 ArchivePath.
data(),
EC.message().c_str());
118 "Archive file size is too small %s",
126 "Failed to read from archive %s: %s",
127 ArchivePath.
data(),
EC.message().c_str());
129 StringRef Buf = (*MBOrErr)->getBuffer();
132 "Unknown format for archive %s",
138 ArchiveIsThinCache[ArchivePath] = IsThin;
155Expected<std::shared_ptr<lto::InputFile>>
160 InputFiles.emplace_back(InputPtr.release());
161 auto &
Input = InputFiles.back();
165 auto N = normalizePath(Path, Saver);
167 return N.takeError();
179 if (ArchivePath.
empty() && !
Input->isFatLTOObject()) {
181 if (
Error E = setIdFromPath(
Input->getName()))
191 Input->isFatLTOObject() ?
false : isThinArchive(ArchivePath);
194 if (*UseThinMember) {
197 computeThinArchiveMemberPath(ArchivePath,
Input->getMemberName());
198 if (
Error E = setIdFromPath(MemberPath))
204 Input->setSerializeForDistribution(
true);
207 if (LinkerOutputDir.empty()) {
210 return N.takeError();
211 LinkerOutputDir = *
N;
219 std::to_string(InputFiles.size()) +
233 for (
auto &
Input : InputFiles) {
234 if (!
Input->isThinLTO() || !
Input->getSerializeForDistribution())
238 TimeTraceScope TimeScope(
"Serialize bitcode input for DTLTO", ModuleId);
253 for (
auto &
Input : InputFiles) {
254 if (!
Input->getSerializeForDistribution())
259 EC != std::make_error_code(std::errc::no_such_file_or_directory))
260 errs() <<
"warning: could not remove temporary DTLTO input file '"
261 <<
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.
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).
Saves strings in the provided stable storage and returns a StringRef with a stable character pointer.
StringRef save(const char *S)
The TimeTraceScope is a helper class to call the begin and end functions of the time trace profiler.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
LLVM_ABI void cleanup() override
LLVM_ABI Expected< std::shared_ptr< InputFile > > addInput(std::unique_ptr< InputFile > InputPtr) override
LLVM_ABI llvm::Error serializeInputsForDistribution() 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)
Remove '.
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 std::error_code makeLongFormPath(const Twine &Path8, llvm::SmallVectorImpl< char > &Result8)
Convert a UTF-8 path to a long form UTF-8 path expanding any short 8.3 form components.
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