#include #include "Unix/Path.inc"">

LLVM: lib/Support/Path.cpp File Reference (original) (raw)

#include "[llvm/Support/Path.h](Path%5F8h%5Fsource.html)"
#include "[llvm/ADT/ArrayRef.h](ArrayRef%5F8h%5Fsource.html)"
#include "[llvm/ADT/ScopeExit.h](ScopeExit%5F8h%5Fsource.html)"
#include "[llvm/ADT/StringExtras.h](StringExtras%5F8h%5Fsource.html)"
#include "llvm/Config/config.h"
#include "llvm/Config/llvm-config.h"
#include "[llvm/Support/Errc.h](Errc%5F8h%5Fsource.html)"
#include "[llvm/Support/ErrorHandling.h](llvm%5F2Support%5F2ErrorHandling%5F8h%5Fsource.html)"
#include "[llvm/Support/FileSystem.h](FileSystem%5F8h%5Fsource.html)"
#include "[llvm/Support/Process.h](Process%5F8h%5Fsource.html)"
#include "[llvm/Support/Signals.h](Signals%5F8h%5Fsource.html)"
#include <cctype>
#include <unistd.h>
#include "[Unix/Path.inc](Unix%5F2Path%5F8inc%5Fsource.html)"

Go to the source code of this file.

Namespaces
namespace llvm
This is an optimization pass for GlobalISel generic memory operations.
namespace llvm::sys
namespace llvm::sys::path
namespace llvm::sys::fs
Enumerations
enum FSEntity { FS_Dir, FS_File, FS_Name }
Functions
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)
reverse_iterator llvm::sys::path::rbegin (StringRef Path, Style style)
reverse_iterator llvm::sys::path::rend (StringRef Path)
static bool llvm::sys::path::starts_with (StringRef Path, StringRef Prefix, Style style=Style::native)
StringRef llvm::sys::path::remove_leading_dotslash (StringRef Path, Style style)
static std::error_code llvm::sys::fs::createTemporaryFile (const Twine &Model, int &ResultFD, llvm::SmallVectorImpl< char > &ResultPath, FSEntity Type, sys::fs::OpenFlags Flags=sys::fs::OF_None)
static std::error_code llvm::sys::fs::createTemporaryFile (const Twine &Prefix, StringRef Suffix, int &ResultFD, llvm::SmallVectorImpl< char > &ResultPath, FSEntity Type, sys::fs::OpenFlags Flags=sys::fs::OF_None)
static std::error_code llvm::sys::fs::copy_file_internal (int ReadFD, int WriteFD)
Lexical Component Iterator
LLVM_ABI const_iterator llvm::sys::path::begin (StringRef path LLVM_LIFETIME_BOUND, Style style=Style::native)
Get begin iterator over path.
LLVM_ABI const_iterator llvm::sys::path::end (StringRef path LLVM_LIFETIME_BOUND)
Get end iterator over path.
Lexical Observers
LLVM_ABI StringRef llvm::sys::path::root_path (StringRef path LLVM_LIFETIME_BOUND, Style style=Style::native)
Get root path.
LLVM_ABI StringRef llvm::sys::path::root_name (StringRef path LLVM_LIFETIME_BOUND, Style style=Style::native)
Get root name.
LLVM_ABI StringRef llvm::sys::path::root_directory (StringRef path LLVM_LIFETIME_BOUND, Style style=Style::native)
Get root directory.
LLVM_ABI StringRef llvm::sys::path::relative_path (StringRef path LLVM_LIFETIME_BOUND, Style style=Style::native)
Get relative path.
LLVM_ABI StringRef llvm::sys::path::parent_path (StringRef path LLVM_LIFETIME_BOUND, Style style=Style::native)
Get parent path.
LLVM_ABI StringRef llvm::sys::path::filename (StringRef path LLVM_LIFETIME_BOUND, Style style=Style::native)
Get filename.
LLVM_ABI StringRef llvm::sys::path::stem (StringRef path LLVM_LIFETIME_BOUND, Style style=Style::native)
Get stem.
LLVM_ABI StringRef llvm::sys::path::extension (StringRef path LLVM_LIFETIME_BOUND, Style style=Style::native)
Get extension.
LLVM_ABI bool llvm::sys::path::is_separator (char value, Style style=Style::native)
Check whether the given char is a path separator on the host OS.
LLVM_ABI StringRef llvm::sys::path::get_separator (Style style=Style::native)
Return the preferred separator for this platform.
LLVM_ABI bool llvm::sys::path::has_root_name (const Twine &path, Style style=Style::native)
Has root name?
LLVM_ABI bool llvm::sys::path::has_root_directory (const Twine &path, Style style=Style::native)
Has root directory?
LLVM_ABI bool llvm::sys::path::has_root_path (const Twine &path, Style style=Style::native)
Has root path?
LLVM_ABI bool llvm::sys::path::has_relative_path (const Twine &path, Style style=Style::native)
Has relative path?
LLVM_ABI bool llvm::sys::path::has_filename (const Twine &path, Style style=Style::native)
Has filename?
LLVM_ABI bool llvm::sys::path::has_parent_path (const Twine &path, Style style=Style::native)
Has parent path?
LLVM_ABI bool llvm::sys::path::has_stem (const Twine &path, Style style=Style::native)
Has stem?
LLVM_ABI bool llvm::sys::path::has_extension (const Twine &path, Style style=Style::native)
Has extension?
LLVM_ABI bool llvm::sys::path::is_absolute (const Twine &path, Style style=Style::native)
Is path absolute?
LLVM_ABI bool llvm::sys::path::is_absolute_gnu (const Twine &path, Style style=Style::native)
Is path absolute using GNU rules?
LLVM_ABI bool llvm::sys::path::is_relative (const Twine &path, Style style=Style::native)
Is path relative?
LLVM_ABI void llvm::sys::path::make_absolute (const Twine &current_directory, SmallVectorImpl< char > &path)
Make path an absolute path.
Lexical Modifiers
LLVM_ABI void llvm::sys::path::append (SmallVectorImpl< char > &path, Style style, const Twine &a, const Twine &b="", const Twine &c="", const Twine &d="")
LLVM_ABI void llvm::sys::path::append (SmallVectorImpl< char > &path, const Twine &a, const Twine &b="", const Twine &c="", const Twine &d="")
Append to path.
LLVM_ABI void llvm::sys::path::append (SmallVectorImpl< char > &path, const_iterator begin, const_iterator end, Style style=Style::native)
Append to path.
LLVM_ABI void llvm::sys::path::remove_filename (SmallVectorImpl< char > &path, Style style=Style::native)
Remove the last component from path unless it is the root dir.
LLVM_ABI void llvm::sys::path::replace_extension (SmallVectorImpl< char > &path, const Twine &extension, Style style=Style::native)
Replace the file extension of path with extension.
LLVM_ABI bool llvm::sys::path::replace_path_prefix (SmallVectorImpl< char > &Path, StringRef OldPrefix, StringRef NewPrefix, Style style=Style::native)
Replace matching path prefix with another path.
LLVM_ABI bool llvm::sys::path::remove_dots (SmallVectorImpl< char > &path, bool remove_dot_dot=false, Style style=Style::native)
In-place remove any '.
Transforms (or some other better name)
LLVM_ABI void llvm::sys::path::native (const Twine &path, SmallVectorImpl< char > &result, Style style=Style::native)
Convert path to the native form.
LLVM_ABI void llvm::sys::path::native (SmallVectorImpl< char > &path, Style style=Style::native)
Convert path to the native form in place.
LLVM_ABI std::string llvm::sys::path::convert_to_slash (StringRef path, Style style=Style::native)
Replaces backslashes with slashes if Windows.
Physical Observers
LLVM_ABI std::error_code llvm::sys::fs::getUniqueID (const Twine Path, UniqueID &Result)
LLVM_ABI void llvm::sys::fs::createUniquePath (const Twine &Model, SmallVectorImpl< char > &ResultPath, bool MakeAbsolute)
Create a potentially unique file name but does not create it.
LLVM_ABI std::error_code llvm::sys::fs::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 llvm::sys::fs::createUniqueFile (const Twine &Model, SmallVectorImpl< char > &ResultPath, unsigned Mode=all_read|all_write)
Simpler version for clients that don't want an open file.
LLVM_ABI std::error_code llvm::sys::fs::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 std::error_code llvm::sys::fs::createTemporaryFile (const Twine &Prefix, StringRef Suffix, SmallVectorImpl< char > &ResultPath, OpenFlags Flags=OF_None)
Simpler version for clients that don't want an open file.
LLVM_ABI std::error_code llvm::sys::fs::createUniqueDirectory (const Twine &Prefix, SmallVectorImpl< char > &ResultPath)
LLVM_ABI std::error_code llvm::sys::fs::getPotentiallyUniqueFileName (const Twine &Model, SmallVectorImpl< char > &ResultPath)
Get a unique name, not currently exisiting in the filesystem.
LLVM_ABI std::error_code llvm::sys::fs::getPotentiallyUniqueTempFileName (const Twine &Prefix, StringRef Suffix, SmallVectorImpl< char > &ResultPath)
Get a unique temporary file name, not currently exisiting in the filesystem.
LLVM_ABI bool llvm::sys::fs::exists (const basic_file_status &status)
Does file exist?
LLVM_ABI bool llvm::sys::fs::status_known (const basic_file_status &s)
Is status available?
LLVM_ABI file_type llvm::sys::fs::get_file_type (const Twine &Path, bool Follow=true)
Does status represent a directory?
LLVM_ABI bool llvm::sys::fs::is_directory (const basic_file_status &status)
Does status represent a directory?
LLVM_ABI std::error_code llvm::sys::fs::is_directory (const Twine &path, bool &result)
Is path a directory?
LLVM_ABI bool llvm::sys::fs::is_regular_file (const basic_file_status &status)
Does status represent a regular file?
LLVM_ABI std::error_code llvm::sys::fs::is_regular_file (const Twine &path, bool &result)
Is path a regular file?
LLVM_ABI bool llvm::sys::fs::is_symlink_file (const basic_file_status &status)
Does status represent a symlink file?
LLVM_ABI std::error_code llvm::sys::fs::is_symlink_file (const Twine &path, bool &result)
Is path a symlink file?
LLVM_ABI bool llvm::sys::fs::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 llvm::sys::fs::is_other (const Twine &path, bool &result)
Is path something that exists but is not a directory, regular file, or symlink?
LLVM_ABI ErrorOr< perms > llvm::sys::fs::getPermissions (const Twine &Path)
Get file permissions.
LLVM_ABI Error llvm::sys::fs::readNativeFileToEOF (file_t FileHandle, SmallVectorImpl< char > &Buffer, ssize_t ChunkSize=DefaultReadChunkSize)
Reads from FileHandle until EOF, appending to Buffer in chunks of size ChunkSize.
Physical Operators
LLVM_ABI std::error_code llvm::sys::fs::make_absolute (SmallVectorImpl< char > &path)
Make path an absolute path.
LLVM_ABI std::error_code llvm::sys::fs::create_directories (const Twine &path, bool IgnoreExisting=true, perms Perms=owner_all|group_all)
Create all the non-existent directories in path.
LLVM_ABI std::error_code llvm::sys::fs::copy_file (const Twine &From, const Twine &To)
Copy the contents of From to To.
LLVM_ABI std::error_code llvm::sys::fs::copy_file (const Twine &From, int ToFD)
Copy the contents of From to To.
LLVM_ABI ErrorOr< MD5::MD5Result > llvm::sys::fs::md5_contents (int FD)
Compute an MD5 hash of a file's contents.
LLVM_ABI ErrorOr< MD5::MD5Result > llvm::sys::fs::md5_contents (const Twine &Path)
Version of compute_md5 that doesn't require an open file descriptor.

FSEntity

Enumerator
FS_Dir
FS_File
FS_Name

Definition at line 163 of file Path.cpp.

createUniqueEntity()

Definition at line 170 of file Path.cpp.

References llvm::sys::fs::access(), llvm::SmallVectorTemplateCommon< T, typename >::begin(), llvm::sys::fs::CD_CreateNew, llvm::sys::fs::create_directory(), llvm::sys::fs::createUniquePath(), llvm::sys::fs::Exist, llvm::file_exists, FS_Dir, FS_File, FS_Name, llvm_unreachable, Mode, llvm::no_such_file_or_directory, llvm::sys::fs::OF_None, llvm::sys::fs::openFileForReadWrite(), and llvm::permission_denied.

Referenced by llvm::sys::fs::createTemporaryFile(), llvm::sys::fs::createUniqueDirectory(), llvm::sys::fs::createUniqueFile(), and llvm::sys::fs::getPotentiallyUniqueFileName().