LLVM  8.0.1
Namespaces | Enumerations | Functions
Path.cpp File Reference
#include "llvm/Support/Path.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/Config/llvm-config.h"
#include "llvm/Support/Endian.h"
#include "llvm/Support/Errc.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/Process.h"
#include "llvm/Support/Signals.h"
#include <cctype>
#include <cstring>
#include <unistd.h>
#include "Unix/Path.inc"
Include dependency graph for Path.cpp:

Go to the source code of this file.

Namespaces

 llvm
 This class represents lattice values for constants.
 
 llvm::sys
 
 llvm::sys::path
 
 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, unsigned Mode, FSEntity Type, sys::fs::OpenFlags Flags=sys::fs::OF_None)
 
static SmallString< 256 > llvm::sys::path::remove_dots (StringRef path, bool remove_dot_dot, Style style)
 
static std::error_code llvm::sys::fs::createUniqueFile (const Twine &Model, int &ResultFd, SmallVectorImpl< char > &ResultPath, unsigned Mode, OpenFlags Flags)
 
static std::error_code llvm::sys::fs::createTemporaryFile (const Twine &Model, int &ResultFD, llvm::SmallVectorImpl< char > &ResultPath, FSEntity Type)
 
static std::error_code llvm::sys::fs::createTemporaryFile (const Twine &Prefix, StringRef Suffix, int &ResultFD, llvm::SmallVectorImpl< char > &ResultPath, FSEntity Type)
 
static std::error_code llvm::sys::fs::copy_file_internal (int ReadFD, int WriteFD)
 
Lexical Component Iterator
const_iterator llvm::sys::path::begin (StringRef path, Style style=Style::native)
 Get begin iterator over path. More...
 
const_iterator llvm::sys::path::end (StringRef path)
 Get end iterator over path. More...
 
reverse_iterator llvm::sys::path::rbegin (StringRef path, Style style=Style::native)
 Get reverse begin iterator over path. More...
 
reverse_iterator llvm::sys::path::rend (StringRef path)
 Get reverse end iterator over path. More...
 
Lexical Observers
StringRef llvm::sys::path::root_path (StringRef path, Style style=Style::native)
 Get root path. More...
 
StringRef llvm::sys::path::root_name (StringRef path, Style style=Style::native)
 Get root name. More...
 
StringRef llvm::sys::path::root_directory (StringRef path, Style style=Style::native)
 Get root directory. More...
 
StringRef llvm::sys::path::relative_path (StringRef path, Style style=Style::native)
 Get relative path. More...
 
StringRef llvm::sys::path::parent_path (StringRef path, Style style=Style::native)
 Get parent path. More...
 
StringRef llvm::sys::path::filename (StringRef path, Style style=Style::native)
 Get filename. More...
 
StringRef llvm::sys::path::stem (StringRef path, Style style=Style::native)
 Get stem. More...
 
StringRef llvm::sys::path::extension (StringRef path, Style style=Style::native)
 Get extension. More...
 
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. More...
 
StringRef llvm::sys::path::get_separator (Style style=Style::native)
 Return the preferred separator for this platform. More...
 
bool llvm::sys::path::has_root_name (const Twine &path, Style style=Style::native)
 Has root name? More...
 
bool llvm::sys::path::has_root_directory (const Twine &path, Style style=Style::native)
 Has root directory? More...
 
bool llvm::sys::path::has_root_path (const Twine &path, Style style=Style::native)
 Has root path? More...
 
bool llvm::sys::path::has_relative_path (const Twine &path, Style style=Style::native)
 Has relative path? More...
 
bool llvm::sys::path::has_filename (const Twine &path, Style style=Style::native)
 Has filename? More...
 
bool llvm::sys::path::has_parent_path (const Twine &path, Style style=Style::native)
 Has parent path? More...
 
bool llvm::sys::path::has_stem (const Twine &path, Style style=Style::native)
 Has stem? More...
 
bool llvm::sys::path::has_extension (const Twine &path, Style style=Style::native)
 Has extension? More...
 
bool llvm::sys::path::is_absolute (const Twine &path, Style style=Style::native)
 Is path absolute? More...
 
bool llvm::sys::path::is_relative (const Twine &path, Style style=Style::native)
 Is path relative? More...
 
StringRef llvm::sys::path::remove_leading_dotslash (StringRef path, Style style=Style::native)
 Remove redundant leading "./" pieces and consecutive separators. More...
 
bool llvm::sys::path::remove_dots (SmallVectorImpl< char > &path, bool remove_dot_dot=false, Style style=Style::native)
 In-place remove any '. More...
 
Lexical Modifiers
void llvm::sys::path::append (SmallVectorImpl< char > &path, Style style, const Twine &a, const Twine &b="", const Twine &c="", const Twine &d="")
 
void llvm::sys::path::append (SmallVectorImpl< char > &path, const Twine &a, const Twine &b="", const Twine &c="", const Twine &d="")
 Append to path. More...
 
void llvm::sys::path::append (SmallVectorImpl< char > &path, const_iterator begin, const_iterator end, Style style=Style::native)
 Append to path. More...
 
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. More...
 
void llvm::sys::path::replace_extension (SmallVectorImpl< char > &path, const Twine &extension, Style style=Style::native)
 Replace the file extension of path with extension. More...
 
void llvm::sys::path::replace_path_prefix (SmallVectorImpl< char > &Path, const StringRef &OldPrefix, const StringRef &NewPrefix, Style style=Style::native)
 Replace matching path prefix with another path. More...
 
Transforms (or some other better name)
void llvm::sys::path::native (const Twine &path, SmallVectorImpl< char > &result, Style style=Style::native)
 Convert path to the native form. More...
 
void llvm::sys::path::native (SmallVectorImpl< char > &path, Style style=Style::native)
 Convert path to the native form in place. More...
 
std::string llvm::sys::path::convert_to_slash (StringRef path, Style style=Style::native)
 Replaces backslashes with slashes if Windows. More...
 
Physical Observers
std::error_code llvm::sys::fs::getUniqueID (const Twine Path, UniqueID &Result)
 
std::error_code llvm::sys::fs::createUniqueFile (const Twine &Model, int &ResultFD, SmallVectorImpl< char > &ResultPath, unsigned Mode=all_read|all_write)
 Create a uniquely named file. More...
 
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. More...
 
std::error_code llvm::sys::fs::createTemporaryFile (const Twine &Prefix, StringRef Suffix, int &ResultFD, SmallVectorImpl< char > &ResultPath)
 Create a file in the system temporary directory. More...
 
std::error_code llvm::sys::fs::createTemporaryFile (const Twine &Prefix, StringRef Suffix, SmallVectorImpl< char > &ResultPath)
 Simpler version for clients that don't want an open file. More...
 
std::error_code llvm::sys::fs::createUniqueDirectory (const Twine &Prefix, SmallVectorImpl< char > &ResultPath)
 
std::error_code llvm::sys::fs::getPotentiallyUniqueFileName (const Twine &Model, SmallVectorImpl< char > &ResultPath)
 Get a unique name, not currently exisiting in the filesystem. More...
 
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. More...
 
bool llvm::sys::fs::exists (const basic_file_status &status)
 Does file exist? More...
 
bool llvm::sys::fs::status_known (const basic_file_status &s)
 Is status available? More...
 
file_type llvm::sys::fs::get_file_type (const Twine &Path, bool Follow=true)
 Does status represent a directory? More...
 
bool llvm::sys::fs::is_directory (const basic_file_status &status)
 Does status represent a directory? More...
 
std::error_code llvm::sys::fs::is_directory (const Twine &path, bool &result)
 Is path a directory? More...
 
bool llvm::sys::fs::is_regular_file (const basic_file_status &status)
 Does status represent a regular file? More...
 
std::error_code llvm::sys::fs::is_regular_file (const Twine &path, bool &result)
 Is path a regular file? More...
 
bool llvm::sys::fs::is_symlink_file (const basic_file_status &status)
 Does status represent a symlink file? More...
 
std::error_code llvm::sys::fs::is_symlink_file (const Twine &path, bool &result)
 Is path a symlink file? More...
 
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? More...
 
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? More...
 
ErrorOr< perms > llvm::sys::fs::getPermissions (const Twine &Path)
 Get file permissions. More...
 
Physical Operators
void llvm::sys::fs::make_absolute (const Twine &current_directory, SmallVectorImpl< char > &path)
 Make path an absolute path. More...
 
std::error_code llvm::sys::fs::make_absolute (SmallVectorImpl< char > &path)
 Make path an absolute path. More...
 
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. More...
 
std::error_code llvm::sys::fs::copy_file (const Twine &From, const Twine &To)
 Copy the contents of From to To. More...
 
std::error_code llvm::sys::fs::copy_file (const Twine &From, int ToFD)
 Copy the contents of From to To. More...
 
ErrorOr< MD5::MD5Resultllvm::sys::fs::md5_contents (int FD)
 Compute an MD5 hash of a file's contents. More...
 
ErrorOr< MD5::MD5Resultllvm::sys::fs::md5_contents (const Twine &Path)
 Version of compute_md5 that doesn't require an open file descriptor. More...
 

Enumeration Type Documentation

◆ FSEntity

enum FSEntity
Enumerator
FS_Dir 
FS_File 
FS_Name 

Definition at line 162 of file Path.cpp.

Function Documentation

◆ createUniqueEntity()

static std::error_code createUniqueEntity ( const Twine Model,
int &  ResultFD,
SmallVectorImpl< char > &  ResultPath,
bool  MakeAbsolute,
unsigned  Mode,
FSEntity  Type,
sys::fs::OpenFlags  Flags = sys::fs::OF_None 
)
static