17#include "llvm/Config/config.h"
18#include "llvm/Config/llvm-config.h"
27#if !defined(_MSC_VER) && !defined(__MINGW32__)
41 inline bool prefer_forward_slash() {
42 static bool prefer = []() {
43 if (std::optional<std::string> Env =
46 return static_cast<bool>(LLVM_WINDOWS_PREFER_FORWARD_SLASH);
51 inline Style real_style(Style style) {
52 if (style != Style::native)
56 return prefer_forward_slash() ? Style::windows_slash
57 : Style::windows_backslash;
60 inline const char *separators(Style style) {
66 inline char preferred_separator(Style style) {
67 if (real_style(style) == Style::windows)
84 if (
path.size() >= 2 &&
85 std::isalpha(
static_cast<unsigned char>(
path[0])) &&
path[1] ==
':')
86 return path.substr(0, 2);
93 size_t end =
path.find_first_of(separators(style), 2);
94 return path.substr(0, end);
99 return path.substr(0, 1);
102 size_t end =
path.find_first_of(separators(style));
103 return path.substr(0, end);
108 size_t filename_pos(
StringRef str, Style style) {
110 return str.
size() - 1;
127 size_t root_dir_start(
StringRef str, Style style) {
151 size_t end_pos = filename_pos(
path, style);
153 bool filename_was_sep =
157 size_t root_dir_pos = root_dir_start(
path, style);
158 while (end_pos > 0 &&
163 if (end_pos == root_dir_pos && !filename_was_sep) {
166 return root_dir_pos + 1;
180static std::error_code
191 for (
int Retries = 128; Retries > 0; --Retries) {
206 return std::error_code();
212 return std::error_code();
225 return std::error_code();
240 i.Component = find_first_component(
path, style);
249 i.Position =
path.size();
254 assert(Position < Path.size() &&
"Tried to increment past end!");
257 Position += Component.size();
260 if (Position == Path.size()) {
267 bool was_net = Component.size() > 2 &&
is_separator(Component[0], S) &&
268 Component[1] == Component[0] && !
is_separator(Component[2], S);
276 Component = Path.substr(Position, 1);
281 while (Position != Path.size() &&
is_separator(Path[Position], S)) {
286 if (Position == Path.size() && Component !=
"/") {
294 size_t end_pos = Path.find_first_of(separators(S), Position);
295 Component = Path.slice(Position, end_pos);
301 return Path.begin() == RHS.Path.begin() && Position == RHS.Position;
305 return Position - RHS.Position;
311 I.Position = Path.size();
320 I.Component = Path.substr(0, 0);
326 size_t root_dir_pos = root_dir_start(Path, S);
329 size_t end_pos = Position;
330 while (end_pos > 0 && (end_pos - 1) != root_dir_pos &&
335 if (Position == Path.size() && !Path.empty() &&
344 size_t start_pos = filename_pos(Path.substr(0, end_pos), S);
345 Component = Path.slice(start_pos, end_pos);
346 Position = start_pos;
351 return Path.begin() == RHS.Path.begin() && Component == RHS.Component &&
352 Position == RHS.Position;
356 return Position - RHS.Position;
363 b->size() > 2 &&
is_separator((*b)[0], style) && (*b)[1] == (*b)[0];
366 if (has_net || has_drive) {
369 return path.substr(0, b->size() + pos->size());
388 b->size() > 2 &&
is_separator((*b)[0], style) && (*b)[1] == (*b)[0];
391 if (has_net || has_drive) {
405 b->size() > 2 &&
is_separator((*b)[0], style) && (*b)[1] == (*b)[0];
408 if ((has_net || has_drive) &&
438 if (!b.isTriviallyEmpty()) components.
push_back(b.toStringRef(b_storage));
442 for (
auto &component : components) {
447 size_t loc = component.find_first_not_of(separators(style));
455 bool component_has_sep =
456 !component.empty() &&
is_separator(component[0], style);
457 if (!component_has_sep &&
460 path.push_back(preferred_separator(style));
463 path.append(component.begin(), component.end());
479 size_t end_pos = parent_path_end(
path, style);
482 return path.substr(0, end_pos);
488 path.truncate(end_pos);
498 size_t pos = p.find_last_of(
'.');
503 if (ext.
size() > 0 && ext[0] !=
'.')
514 if (Path.size() < Prefix.size())
516 for (
size_t I = 0, E = Prefix.size();
I != E; ++
I) {
519 if (SepPath != SepPrefix)
526 return Path.starts_with(Prefix);
534 StringRef OrigPath(Path.begin(), Path.size());
539 if (OldPrefix.
size() == NewPrefix.
size()) {
546 (
Twine(NewPrefix) + RelPath).toVector(NewPath);
553 path.getSingleStringRef().data() != result.
data()) &&
554 "path and result are not allowed to overlap!");
557 path.toVector(result);
564 return std::string(Result);
571 for (
char &Ch : Path)
573 Ch = preferred_separator(style);
574 if (Path[0] ==
'~' && (Path.size() == 1 ||
is_separator(Path[1], style))) {
577 PathHome.
append(Path.begin() + 1, Path.end());
578 Path = std::move(PathHome);
587 return std::string(
path);
589 std::string s =
path.str();
601 if ((fname.
size() == 1 && fname ==
".") ||
602 (fname.
size() == 2 && fname ==
".."))
604 return fname.
substr(0, pos);
612 if ((fname.
size() == 1 && fname ==
".") ||
613 (fname.
size() == 2 && fname ==
".."))
622 return value ==
'\\';
695 return rootDir && rootName;
709 if (p.size() >= 2 && (p[0] && p[1] ==
':'))
733 current_directory.
toVector(current_dir);
736 if (!rootName && !rootDirectory) {
740 path.swap(current_dir);
744 if (!rootName && rootDirectory) {
747 append(curDirRootName, p);
749 path.swap(curDirRootName);
753 if (rootName && !rootDirectory) {
760 append(res, pRootName, bRootDirectory, bRelativePath, pRelativePath);
771 while (Path.size() > 2 && Path[0] ==
'.' &&
is_separator(Path[1], style)) {
772 Path = Path.substr(2);
774 Path = Path.substr(1);
781 style = real_style(style);
783 bool needs_change =
false;
788 bool absolute = !root.
empty();
794 while (!remaining.
empty()) {
795 size_t next_slash = remaining.
find_first_of(separators(style));
797 next_slash = remaining.
size();
802 if (!remaining.
empty()) {
803 needs_change |= remaining.
front() != preferred_separator(style);
807 needs_change |= remaining.
empty();
811 if (component.
empty() || component ==
".") {
813 }
else if (remove_dot_dot && component ==
"..") {
817 if (!components.
empty() && components.
back() !=
"..") {
819 }
else if (!absolute) {
830 needs_change |= root != buffer;
836 if (!components.
empty()) {
837 buffer += components[0];
839 buffer += preferred_separator(style);
843 the_path.
swap(buffer);
858 Result =
Status.getUniqueID();
859 return std::error_code();
865 Model.toVector(ModelStorage);
868 "createUniquePath: Model must contain at least one '%'");
876 ModelStorage.
swap(TDir);
880 ResultPath = ModelStorage;
885 for (
unsigned i = 0, e = ModelStorage.
size(); i != e; ++i) {
886 if (ModelStorage[i] ==
'%')
910static std::error_code
919 StringRef P = Model.toNullTerminatedStringRef(Storage);
921 "Model must be a simple filename.");
927static std::error_code
931 const char *Middle = Suffix.
empty() ?
"-%%%%%%" :
"-%%%%%%.";
1018 const size_t BufSize = 4096;
1019 char *Buf =
new char[BufSize];
1020 int BytesRead = 0, BytesWritten = 0;
1022 BytesRead =
read(ReadFD, Buf, BufSize);
1026 BytesWritten =
write(WriteFD, Buf, BytesRead);
1027 if (BytesWritten < 0)
1029 BytesRead -= BytesWritten;
1031 if (BytesWritten < 0)
1036 if (BytesRead < 0 || BytesWritten < 0)
1038 return std::error_code();
1043 int ReadFD, WriteFD;
1046 if (std::error_code EC =
1078 constexpr size_t BufSize = 4096;
1079 std::vector<uint8_t> Buf(BufSize);
1082 BytesRead =
read(FD, Buf.data(), BufSize);
1117 if (
status(Path, st, Follow))
1133 return std::error_code();
1147 return std::error_code();
1158 if (std::error_code ec =
status(
path, st,
false))
1161 return std::error_code();
1174 if (std::error_code EC =
status(Path, FileStatus))
1177 return std::error_code();
1184 this->Path = std::string(PathStr);
1186 this->Status = Status;
1196 return Status.permissions();
1206 std::error_code EC =
1213 assert(Mapping &&
"Mapping failed but used anyway!");
1218 assert(Mapping &&
"Mapping failed but used anyway!");
1219 return reinterpret_cast<char *
>(Mapping);
1223 assert(Mapping &&
"Mapping failed but used anyway!");
1224 return reinterpret_cast<const char *
>(Mapping);
1228 ssize_t ChunkSize) {
1242 if (*ReadBytes == 0)
1253#if defined(LLVM_ON_UNIX)
1264TempFile::TempFile(StringRef Name,
int FD)
1266TempFile::TempFile(TempFile &&
Other) { *
this = std::move(
Other); }
1273 RemoveOnClose =
Other.RemoveOnClose;
1274 Other.RemoveOnClose =
false;
1283 if (FD != -1 && close(FD) == -1) {
1292 bool Remove = RemoveOnClose;
1297 std::error_code RemoveEC;
1298 if (Remove && !TmpName.empty()) {
1309Error TempFile::keep(
const Twine &Name) {
1315 auto H =
reinterpret_cast<HANDLE
>(_get_osfhandle(FD));
1316 std::error_code RenameEC =
1317 RemoveOnClose ? std::error_code() : setDeleteDisposition(
H,
false);
1318 bool ShouldDelete =
false;
1320 RenameEC = rename_handle(
H, Name);
1323 std::error_code(ERROR_NOT_SAME_DEVICE, std::system_category())) {
1325 ShouldDelete =
true;
1331 ShouldDelete =
true;
1334 setDeleteDisposition(
H,
true);
1339 std::error_code RenameEC =
fs::rename(TmpName, Name);
1353 if (close(FD) == -1)
1365 auto H =
reinterpret_cast<HANDLE
>(_get_osfhandle(
FD));
1366 if (std::error_code EC = setDeleteDisposition(
H,
false))
1373 if (close(
FD) == -1)
1384 if (std::error_code EC =
1390 auto H =
reinterpret_cast<HANDLE
>(_get_osfhandle(FD));
1391 bool SetSignalHandler =
false;
1392 if (std::error_code EC = setDeleteDisposition(
H,
true)) {
1393 Ret.RemoveOnClose =
true;
1394 SetSignalHandler =
true;
1397 bool SetSignalHandler =
true;
1405 return std::move(Ret);
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
Function Alias Analysis false
static constexpr StringLiteral Filename
static std::error_code createUniqueEntity(const Twine &Model, int &ResultFD, SmallVectorImpl< char > &ResultPath, bool MakeAbsolute, FSEntity Type, sys::fs::OpenFlags Flags=sys::fs::OF_None, unsigned Mode=0)
Provides a library for accessing information about this process and other processes on the operating ...
static cl::opt< RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode > Mode("regalloc-enable-advisor", cl::Hidden, cl::init(RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Default), cl::desc("Enable regalloc advisor mode"), cl::values(clEnumValN(RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Default, "default", "Default"), clEnumValN(RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Release, "release", "precompiled"), clEnumValN(RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Development, "development", "for training")))
This file defines the make_scope_exit function, which executes user-defined cleanup logic at scope ex...
Represents either an error or a value T.
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.
LLVM_ABI void update(ArrayRef< uint8_t > Data)
Updates the hash for the byte stream provided.
LLVM_ABI void final(MD5Result &Result)
Finishes off the hash and puts the result in result.
SmallString - A SmallString is just a SmallVector with methods and accessors that make it work better...
void append(StringRef RHS)
Append from a StringRef.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
void resize_for_overwrite(size_type N)
Like resize, but T is POD, the new values won't be initialized.
void truncate(size_type N)
Like resize, but requires that N is less than size().
void swap(SmallVectorImpl &RHS)
void push_back(const T &Elt)
pointer data()
Return a pointer to the vector's buffer, even if empty().
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Represent a constant reference to a string, i.e.
static constexpr size_t npos
constexpr StringRef substr(size_t Start, size_t N=npos) const
Return a reference to the substring from [Start, Start + N).
constexpr bool empty() const
Check if the string is empty.
StringRef drop_front(size_t N=1) const
Return a StringRef equal to 'this' but with the first N elements dropped.
constexpr size_t size() const
Get the string size.
char front() const
Get the first character in the string.
size_t find_last_of(char C, size_t From=npos) const
Find the last character in the string that is C, or npos if not found.
size_t find_first_of(char C, size_t From=0) const
Find the first character in the string that is C, or npos if not found.
StringRef take_front(size_t N=1) const
Return a StringRef equal to 'this' but with only the first N elements remaining.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
bool isTriviallyEmpty() const
Check if this twine is trivially empty; a false return value does not necessarily mean the twine is e...
StringRef toStringRef(SmallVectorImpl< char > &Out) const
This returns the twine as a single StringRef if it can be represented as such.
LLVM_ABI void toVector(SmallVectorImpl< char > &Out) const
Append the concatenated string into the given SmallString or SmallVector.
The instances of the Type class are immutable: once they are created, they are never changed.
static LLVM_ABI std::error_code SafelyCloseFileDescriptor(int FD)
static LLVM_ABI unsigned GetRandomNumber()
Get the result of a process wide random number generator.
static LLVM_ABI std::optional< std::string > GetEnv(StringRef name)
Represents a temporary file.
LLVM_ABI TempFile & operator=(TempFile &&Other)
LLVM_ABI Error keep(const Twine &Name)
static LLVM_ABI Expected< TempFile > create(const Twine &Model, unsigned Mode=all_read|all_write, OpenFlags ExtraFlags=OF_None)
This creates a temporary file with createUniqueFile and schedules it for deletion with sys::RemoveFil...
Represents the result of a call to directory_iterator::status().
LLVM_ABI void replace_filename(const Twine &Filename, file_type Type, basic_file_status Status=basic_file_status())
Represents the result of a call to sys::fs::status().
LLVM_ABI size_t size() const
LLVM_ABI const char * const_data() const
Get a const view of the data.
LLVM_ABI char * data() const
LLVM_ABI const_iterator & operator++()
LLVM_ABI bool operator==(const const_iterator &RHS) const
LLVM_ABI ptrdiff_t operator-(const const_iterator &RHS) const
Difference in bytes between this and RHS.
LLVM_ABI bool operator==(const reverse_iterator &RHS) const
LLVM_ABI ptrdiff_t operator-(const reverse_iterator &RHS) const
Difference in bytes between this and RHS.
LLVM_ABI reverse_iterator & operator++()
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
@ C
The default llvm calling convention, compatible with C.
value_type read(const void *memory, endianness endian)
Read a value of a particular endianness from memory.
LLVM_ABI bool is_regular_file(const basic_file_status &status)
Does status represent a regular file?
LLVM_ABI bool is_symlink_file(const basic_file_status &status)
Does status represent a symlink file?
std::error_code openFileForReadWrite(const Twine &Name, int &ResultFD, CreationDisposition Disp, OpenFlags Flags, unsigned Mode=0666)
Opens the file with the given name in a write-only or read-write mode, returning its open file descri...
LLVM_ABI std::error_code rename(const Twine &from, const Twine &to)
Rename from to to.
LLVM_ABI Error readNativeFileToEOF(file_t FileHandle, SmallVectorImpl< char > &Buffer, ssize_t ChunkSize=DefaultReadChunkSize)
Reads from FileHandle until EOF, appending to Buffer in chunks of size ChunkSize.
LLVM_ABI ErrorOr< perms > getPermissions(const Twine &Path)
Get file permissions.
LLVM_ABI std::error_code openFile(const Twine &Name, int &ResultFD, CreationDisposition Disp, FileAccess Access, OpenFlags Flags, unsigned Mode=0666)
Opens a file with the specified creation disposition, access mode, and flags and returns a file descr...
LLVM_ABI std::error_code getPotentiallyUniqueFileName(const Twine &Model, SmallVectorImpl< char > &ResultPath)
Get a unique name, not currently exisiting in the filesystem.
LLVM_ABI std::error_code access(const Twine &Path, AccessMode Mode)
Can the file be accessed?
LLVM_ABI bool is_other(const basic_file_status &status)
Does this status represent something that exists but is not a directory or regular file?
LLVM_ABI std::error_code getPotentiallyUniqueTempFileName(const Twine &Prefix, StringRef Suffix, SmallVectorImpl< char > &ResultPath)
Get a unique temporary file name, not currently exisiting in the filesystem.
LLVM_ABI Expected< size_t > readNativeFile(file_t FileHandle, MutableArrayRef< char > Buf)
Reads Buf.size() bytes from FileHandle into Buf.
LLVM_ABI bool exists(const basic_file_status &status)
Does file exist?
@ OF_OpenDirectory
Allow opening a directory.
@ OF_Delete
The returned handle can be used for deleting the file.
@ OF_UpdateAttributes
Open the file with sufficient access to update its metadata.
file_type
An enumeration for the file system's view of the type.
LLVM_ABI std::error_code getUniqueID(const Twine Path, UniqueID &Result)
LLVM_ABI std::error_code createUniqueFile(const Twine &Model, int &ResultFD, SmallVectorImpl< char > &ResultPath, OpenFlags Flags=OF_None, unsigned Mode=all_read|all_write)
Create a uniquely named file.
LLVM_ABI std::error_code remove(const Twine &path, bool IgnoreNonExisting=true)
Remove path.
@ CD_OpenExisting
CD_OpenExisting - When opening a file:
@ CD_CreateAlways
CD_CreateAlways - When opening a file:
@ CD_CreateNew
CD_CreateNew - When opening a file:
LLVM_ABI void createUniquePath(const Twine &Model, SmallVectorImpl< char > &ResultPath, bool MakeAbsolute)
Create a potentially unique file name but does not create it.
std::error_code openFileForWrite(const Twine &Name, int &ResultFD, CreationDisposition Disp=CD_CreateAlways, OpenFlags Flags=OF_None, unsigned Mode=0666)
Opens the file with the given name in a write-only or read-write mode, returning its open file descri...
LLVM_ABI std::error_code create_directories(const Twine &path, bool IgnoreExisting=true, perms Perms=owner_all|group_all)
Create all the non-existent directories in path.
LLVM_ABI bool status_known(const basic_file_status &s)
Is status available?
LLVM_ABI std::error_code createTemporaryFile(const Twine &Prefix, StringRef Suffix, int &ResultFD, SmallVectorImpl< char > &ResultPath, OpenFlags Flags=OF_None)
Create a file in the system temporary directory.
LLVM_ABI file_type get_file_type(const Twine &Path, bool Follow=true)
Does status represent a directory?
LLVM_ABI std::error_code make_absolute(SmallVectorImpl< char > &path)
Make path an absolute path.
LLVM_ABI std::error_code copy_file(const Twine &From, const Twine &To)
Copy the contents of From to To.
LLVM_ABI std::error_code createUniqueDirectory(const Twine &Prefix, SmallVectorImpl< char > &ResultPath)
LLVM_ABI std::error_code current_path(SmallVectorImpl< char > &result)
Get the current path.
LLVM_ABI std::error_code status(const Twine &path, file_status &result, bool follow=true)
Get file status as if by POSIX stat().
LLVM_ABI std::error_code create_directory(const Twine &path, bool IgnoreExisting=true, perms Perms=owner_all|group_all)
Create the directory in path.
LLVM_ABI std::error_code openFileForRead(const Twine &Name, int &ResultFD, OpenFlags Flags=OF_None, SmallVectorImpl< char > *RealPath=nullptr)
Opens the file with the given name in a read-only mode, returning its open file descriptor.
LLVM_ABI std::error_code setLastAccessAndModificationTime(int FD, TimePoint<> AccessTime, TimePoint<> ModificationTime)
Set the file modification and access time.
LLVM_ABI ErrorOr< MD5::MD5Result > md5_contents(int FD)
Compute an MD5 hash of a file's contents.
static std::error_code copy_file_internal(int ReadFD, int WriteFD)
LLVM_ABI bool is_directory(const basic_file_status &status)
Does status represent a directory?
LLVM_ABI StringRef get_separator(Style style=Style::native)
Return the preferred separator for this platform.
LLVM_ABI StringRef root_path(StringRef path LLVM_LIFETIME_BOUND, Style style=Style::native)
Get root path.
LLVM_ABI void remove_filename(SmallVectorImpl< char > &path, Style style=Style::native)
Remove the last component from path unless it is the root dir.
LLVM_ABI bool has_relative_path(const Twine &path, Style style=Style::native)
Has relative path?
LLVM_ABI StringRef stem(StringRef path LLVM_LIFETIME_BOUND, Style style=Style::native)
Get stem.
LLVM_ABI bool has_root_name(const Twine &path, Style style=Style::native)
Has root name?
LLVM_ABI void replace_extension(SmallVectorImpl< char > &path, const Twine &extension, Style style=Style::native)
Replace the file extension of path with extension.
LLVM_ABI const_iterator begin(StringRef path LLVM_LIFETIME_BOUND, Style style=Style::native)
Get begin iterator over path.
LLVM_ABI bool remove_dots(SmallVectorImpl< char > &path, bool remove_dot_dot=false, Style style=Style::native)
Remove '.
LLVM_ABI bool has_root_path(const Twine &path, Style style=Style::native)
Has root path?
constexpr bool is_style_posix(Style S)
Check if S uses POSIX path rules.
LLVM_ABI StringRef parent_path(StringRef path LLVM_LIFETIME_BOUND, Style style=Style::native)
Get parent path.
LLVM_ABI bool has_parent_path(const Twine &path, Style style=Style::native)
Has parent path?
void make_preferred(SmallVectorImpl< char > &path, Style style=Style::native)
For Windows path styles, convert path to use the preferred path separators.
LLVM_ABI bool is_relative(const Twine &path, Style style=Style::native)
Is path relative?
LLVM_ABI void system_temp_directory(bool erasedOnReboot, SmallVectorImpl< char > &result)
Get the typical temporary directory for the system, e.g., "/var/tmp" or "C:/TEMP".
LLVM_ABI bool has_extension(const Twine &path, Style style=Style::native)
Has extension?
LLVM_ABI void make_absolute(const Twine ¤t_directory, SmallVectorImpl< char > &path)
Make path an absolute path.
LLVM_ABI bool is_absolute_gnu(const Twine &path, Style style=Style::native)
Is path absolute using GNU rules?
LLVM_ABI StringRef filename(StringRef path LLVM_LIFETIME_BOUND, Style style=Style::native)
Get filename.
LLVM_ABI StringRef remove_leading_dotslash(StringRef path LLVM_LIFETIME_BOUND, Style style=Style::native)
Remove redundant leading "./" pieces and consecutive separators.
LLVM_ABI std::string convert_to_slash(StringRef path, Style style=Style::native)
Replaces backslashes with slashes if Windows.
LLVM_ABI bool is_absolute(const Twine &path, Style style=Style::native)
Is path absolute?
LLVM_ABI bool has_stem(const Twine &path, Style style=Style::native)
Has stem?
constexpr bool is_style_windows(Style S)
Check if S uses Windows path rules.
LLVM_ABI StringRef root_name(StringRef path LLVM_LIFETIME_BOUND, Style style=Style::native)
Get root name.
LLVM_ABI StringRef root_directory(StringRef path LLVM_LIFETIME_BOUND, Style style=Style::native)
Get root directory.
LLVM_ABI bool replace_path_prefix(SmallVectorImpl< char > &Path, StringRef OldPrefix, StringRef NewPrefix, Style style=Style::native)
Replace matching path prefix with another path.
LLVM_ABI void append(SmallVectorImpl< char > &path, const Twine &a, const Twine &b="", const Twine &c="", const Twine &d="")
Append to path.
LLVM_ABI StringRef extension(StringRef path LLVM_LIFETIME_BOUND, Style style=Style::native)
Get extension.
LLVM_ABI reverse_iterator rend(StringRef path LLVM_LIFETIME_BOUND)
Get reverse end iterator over path.
LLVM_ABI reverse_iterator rbegin(StringRef path LLVM_LIFETIME_BOUND, Style style=Style::native)
Get reverse begin iterator over path.
LLVM_ABI bool has_filename(const Twine &path, Style style=Style::native)
Has filename?
LLVM_ABI const_iterator end(StringRef path LLVM_LIFETIME_BOUND)
Get end iterator over path.
LLVM_ABI bool home_directory(SmallVectorImpl< char > &result)
Get the user's home directory.
static bool starts_with(StringRef Path, StringRef Prefix, Style style=Style::native)
LLVM_ABI bool is_separator(char value, Style style=Style::native)
Check whether the given char is a path separator on the host OS.
LLVM_ABI StringRef relative_path(StringRef path LLVM_LIFETIME_BOUND, Style style=Style::native)
Get relative path.
LLVM_ABI bool has_root_directory(const Twine &path, Style style=Style::native)
Has root directory?
void violationIfEnabled()
ScopedSetting scopedDisable()
LLVM_ABI void DontRemoveFileOnSignal(StringRef Filename)
This function removes a file from the list of files to be removed on signal delivery.
std::chrono::time_point< std::chrono::system_clock, D > TimePoint
A time point on the system clock.
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.
char toLower(char x)
Returns the corresponding lowercase character if x is uppercase.
@ no_such_file_or_directory
@ operation_not_permitted
MutableArrayRef(T &OneElt) -> MutableArrayRef< T >
void replace(R &&Range, const T &OldValue, const T &NewValue)
Provide wrappers to std::replace which take ranges instead of having to pass begin/end explicitly.
ArrayRef(const T &OneElt) -> ArrayRef< T >
OutputIt copy(R &&Range, OutputIt Out)
bool is_contained(R &&Range, const E &Element)
Returns true if Element is found in Range.
LLVM_ABI Error errorCodeToError(std::error_code EC)
Helper for converting an std::error_code to a Error.
std::error_code errnoAsErrorCode()
Helper to get errno as an std::error_code.
void consumeError(Error Err)
Consume a Error without doing anything.
LLVM_ABI Error write(DWPWriter &Out, ArrayRef< std::string > Inputs, OnCuIndexOverflow OverflowOptValue, Dwarf64StrOffsetsPromotion StrOffsetsOptValue, raw_pwrite_stream *OS=nullptr)