15#ifndef LLVM_SUPPORT_PATH_H
16#define LLVM_SUPPORT_PATH_H
217 bool remove_dot_dot =
false,
234 const Twine &d =
"");
238 const Twine &d =
"");
#define LLVM_LIFETIME_BOUND
StringRef - Represent a constant reference to a string, i.e.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
CRTP base class which implements the entire standard iterator facade in terms of a minimal subset of ...
const StringRef & reference
LLVM_ABI const_iterator & operator++()
LLVM_ABI friend const_iterator begin(StringRef path, Style style)
Get begin iterator over path.
LLVM_ABI friend const_iterator end(StringRef path)
Get end iterator over path.
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.
reference operator*() const
LLVM_ABI friend reverse_iterator rend(StringRef path)
Get reverse end iterator over path.
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++()
LLVM_ABI friend reverse_iterator rbegin(StringRef path, Style style)
Get reverse begin iterator over path.
reference operator*() const
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 bool cache_directory(SmallVectorImpl< char > &result)
Get the directory where installed packages should put their machine-local cache, e....
LLVM_ABI const_iterator begin(StringRef path LLVM_LIFETIME_BOUND, Style style=Style::native)
Get begin iterator over path.
LLVM_ABI bool user_config_directory(SmallVectorImpl< char > &result)
Get the directory where packages should read user-specific configurations.
LLVM_ABI bool remove_dots(SmallVectorImpl< char > &path, bool remove_dot_dot=false, Style style=Style::native)
In-place remove any '.
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 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 void native(const Twine &path, SmallVectorImpl< char > &result, Style style=Style::native)
Convert path to the native form.
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.
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?
This is an optimization pass for GlobalISel generic memory operations.