LLVM API Documentation

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Namespaces | Classes | Enumerations | Functions
llvm::sys::fs Namespace Reference

Namespaces

 detail
 

Classes

struct  file_type
 
struct  space_info
 space_info - Self explanatory. More...
 
class  UniqueID
 
class  file_status
 
struct  file_magic
 
class  mapped_file_region
 
class  directory_entry
 
class  directory_iterator
 
class  recursive_directory_iterator
 

Enumerations

enum  perms {
  no_perms = 0, owner_read = 0400, owner_write = 0200, owner_exe = 0100,
  owner_all = owner_read | owner_write | owner_exe, group_read = 040, group_write = 020, group_exe = 010,
  group_all = group_read | group_write | group_exe, others_read = 04, others_write = 02, others_exe = 01,
  others_all = others_read | others_write | others_exe, all_read = owner_read | group_read | others_read, all_write = owner_write | group_write | others_write, all_exe = owner_exe | group_exe | others_exe,
  all_all = owner_all | group_all | others_all, set_uid_on_exe = 04000, set_gid_on_exe = 02000, sticky_bit = 01000,
  perms_not_known = 0xFFFF
}
 

Functions

perms operator| (perms l, perms r)
 
perms operator& (perms l, perms r)
 
permsoperator|= (perms &l, perms r)
 
permsoperator&= (perms &l, perms r)
 
perms operator~ (perms x)
 
static error_code createTemporaryFile (const Twine &Model, int &ResultFD, llvm::SmallVectorImpl< char > &ResultPath, FSEntity Type)
 
static error_code createTemporaryFile (const Twine &Prefix, StringRef Suffix, int &ResultFD, llvm::SmallVectorImpl< char > &ResultPath, FSEntity Type)
 
Physical Operators
error_code make_absolute (SmallVectorImpl< char > &path)
 Make path an absolute path. More...
 
error_code create_directories (const Twine &path, bool &existed)
 Create all the non-existent directories in path. More...
 
error_code create_directories (const Twine &Path)
 Convenience function for clients that don't need to know if the directory existed or not. More...
 
error_code create_directory (const Twine &path, bool &existed)
 Create the directory in path. More...
 
error_code create_directory (const Twine &Path)
 Convenience function for clients that don't need to know if the directory existed or not. More...
 
error_code create_hard_link (const Twine &to, const Twine &from)
 Create a hard link from from to to. More...
 
error_code create_symlink (const Twine &to, const Twine &from)
 Create a symbolic link from from to to. More...
 
error_code current_path (SmallVectorImpl< char > &result)
 Get the current path. More...
 
error_code remove (const Twine &path, bool &existed)
 Remove path. Equivalent to POSIX remove(). More...
 
error_code remove (const Twine &Path)
 Convenience function for clients that don't need to know if the file existed or not. More...
 
error_code remove_all (const Twine &path, uint32_t &num_removed)
 Recursively remove all files below path, then path. Files are removed as if by POSIX remove(). More...
 
error_code remove_all (const Twine &Path)
 Convenience function for clients that don't need to know how many files were removed. More...
 
error_code rename (const Twine &from, const Twine &to)
 Rename from to to. Files are renamed as if by POSIX rename(). More...
 
error_code resize_file (const Twine &path, uint64_t size)
 Resize path to size. File is resized as if by POSIX truncate(). More...
 

Physical Observers

enum  OpenFlags { F_None = 0, F_Excl = 1, F_Append = 2, F_Binary = 4 }
 
bool exists (file_status status)
 Does file exist? More...
 
error_code exists (const Twine &path, bool &result)
 Does file exist? More...
 
bool exists (const Twine &path)
 Simpler version of exists for clients that don't need to differentiate between an error and false. More...
 
bool can_execute (const Twine &Path)
 Can we execute this file? More...
 
bool can_write (const Twine &Path)
 Can we write this file? More...
 
bool equivalent (file_status A, file_status B)
 Do file_status's represent the same thing? More...
 
error_code equivalent (const Twine &A, const Twine &B, bool &result)
 Do paths represent the same thing? More...
 
bool equivalent (const Twine &A, const Twine &B)
 Simpler version of equivalent for clients that don't need to differentiate between an error and false. More...
 
bool is_directory (file_status status)
 Does status represent a directory? More...
 
error_code is_directory (const Twine &path, bool &result)
 Is path a directory? More...
 
bool is_directory (const Twine &Path)
 Simpler version of is_directory for clients that don't need to differentiate between an error and false. More...
 
bool is_regular_file (file_status status)
 Does status represent a regular file? More...
 
error_code is_regular_file (const Twine &path, bool &result)
 Is path a regular file? More...
 
bool is_regular_file (const Twine &Path)
 Simpler version of is_regular_file for clients that don't need to differentiate between an error and false. More...
 
bool is_other (file_status status)
 Does this status represent something that exists but is not a directory, regular file, or symlink? More...
 
error_code is_other (const Twine &path, bool &result)
 Is path something that exists but is not a directory, regular file, or symlink? More...
 
bool is_symlink (file_status status)
 Does status represent a symlink? More...
 
error_code is_symlink (const Twine &path, bool &result)
 Is path a symlink? More...
 
error_code status (const Twine &path, file_status &result)
 Get file status as if by POSIX stat(). More...
 
error_code status (int FD, file_status &Result)
 A version for when a file descriptor is already available. More...
 
error_code file_size (const Twine &Path, uint64_t &Result)
 Get file size. More...
 
error_code setLastModificationAndAccessTime (int FD, TimeValue Time)
 
bool status_known (file_status s)
 Is status available? More...
 
error_code status_known (const Twine &path, bool &result)
 Is status available? More...
 
error_code createUniqueFile (const Twine &Model, int &ResultFD, SmallVectorImpl< char > &ResultPath, unsigned Mode=all_read|all_write)
 Create a uniquely named file. More...
 
error_code createUniqueFile (const Twine &Model, SmallVectorImpl< char > &ResultPath)
 Simpler version for clients that don't want an open file. More...
 
error_code createTemporaryFile (const Twine &Prefix, StringRef Suffix, int &ResultFD, SmallVectorImpl< char > &ResultPath)
 Create a file in the system temporary directory. More...
 
error_code createTemporaryFile (const Twine &Prefix, StringRef Suffix, SmallVectorImpl< char > &ResultPath)
 Simpler version for clients that don't want an open file. More...
 
error_code createUniqueDirectory (const Twine &Prefix, SmallVectorImpl< char > &ResultPath)
 
OpenFlags operator| (OpenFlags A, OpenFlags B)
 
OpenFlagsoperator|= (OpenFlags &A, OpenFlags B)
 
error_code openFileForWrite (const Twine &Name, int &ResultFD, OpenFlags Flags, unsigned Mode=0666)
 
error_code openFileForRead (const Twine &Name, int &ResultFD)
 
error_code has_magic (const Twine &path, const Twine &magic, bool &result)
 Are path's first bytes magic? More...
 
error_code get_magic (const Twine &path, uint32_t len, SmallVectorImpl< char > &result)
 Get path's first len bytes. More...
 
file_magic identify_magic (StringRef magic)
 Identify the type of a binary file based on how magical it is. More...
 
error_code identify_magic (const Twine &path, file_magic &result)
 Get and identify path's type based on its content. More...
 
error_code getUniqueID (const Twine Path, UniqueID &Result)
 
error_code map_file_pages (const Twine &path, off_t file_offset, size_t size, bool map_writable, void *&result)
 Memory maps the contents of a file. More...
 
error_code unmap_file_pages (void *base, size_t size)
 Memory unmaps the contents of a file. More...
 
std::string getMainExecutable (const char *argv0, void *MainExecAddr)
 

Enumeration Type Documentation

Enumerator
F_None 
F_Excl 

F_Excl - When opening a file, this flag makes raw_fd_ostream report an error if the file already exists.

F_Append 

F_Append - When opening a file, if it already exists append to the existing file instead of returning an error. This may not be specified with F_Excl.

F_Binary 

F_Binary - The file should be opened in binary mode on platforms that make this distinction.

Definition at line 612 of file FileSystem.h.

Enumerator
no_perms 
owner_read 
owner_write 
owner_exe 
owner_all 
group_read 
group_write 
group_exe 
group_all 
others_read 
others_write 
others_exe 
others_all 
all_read 
all_write 
all_exe 
all_all 
set_uid_on_exe 
set_gid_on_exe 
sticky_bit 
perms_not_known 

Definition at line 83 of file FileSystem.h.

Function Documentation

bool llvm::sys::fs::can_execute ( const Twine &  Path)

Can we execute this file?

Parameters
PathInput path.
Returns
True if we can execute it, false otherwise.
bool llvm::sys::fs::can_write ( const Twine &  Path)

Can we write this file?

Parameters
PathInput path.
Returns
True if we can write to it, false otherwise.
error_code llvm::sys::fs::create_directories ( const Twine &  path,
bool existed 
)

Create all the non-existent directories in path.

Parameters
pathDirectories to create.
existedSet to true if path already existed, false otherwise.
Returns
errc::success if is_directory(path) and existed have been set, otherwise a platform specific error_code.

Definition at line 752 of file Path.cpp.

References create_directory(), llvm::StringRef::empty(), exists(), llvm::sys::path::parent_path(), and llvm::Twine::toStringRef().

Referenced by create_directories().

error_code llvm::sys::fs::create_directories ( const Twine &  Path)
inline

Convenience function for clients that don't need to know if the directory existed or not.

Definition at line 285 of file FileSystem.h.

References create_directories().

error_code llvm::sys::fs::create_directory ( const Twine &  path,
bool existed 
)

Create the directory in path.

Parameters
pathDirectory to create.
existedSet to true if path already existed, false otherwise.
Returns
errc::success if is_directory(path) and existed have been set, otherwise a platform specific error_code.

Referenced by create_directories(), and create_directory().

error_code llvm::sys::fs::create_directory ( const Twine &  Path)
inline

Convenience function for clients that don't need to know if the directory existed or not.

Definition at line 300 of file FileSystem.h.

References create_directory().

error_code llvm::sys::fs::create_hard_link ( const Twine &  to,
const Twine &  from 
)

Create a hard link from from to to.

Parameters
toThe path to hard link to.
fromThe path to hard link from. This is created.
Returns
errc::success if exists(to) && exists(from) && equivalent(to, from) , otherwise a platform specific error_code.

Referenced by llvm::LockFileManager::LockFileManager().

error_code llvm::sys::fs::create_symlink ( const Twine &  to,
const Twine &  from 
)

Create a symbolic link from from to to.

Parameters
toThe path to symbolically link to.
fromThe path to symbolically link from. This is created.
Returns
errc::success if exists(to) && exists(from) && is_symlink(from), otherwise a platform specific error_code.
error_code llvm::sys::fs::createTemporaryFile ( const Twine &  Prefix,
StringRef  Suffix,
int &  ResultFD,
SmallVectorImpl< char > &  ResultPath 
)

Create a file in the system temporary directory.

The filename is of the form prefix-random_chars.suffix. Since the directory is not know to the caller, Prefix and Suffix cannot have path separators. The files are created with mode 0600.

This should be used for things like a temporary .s that is removed after running the assembler.

Definition at line 678 of file Path.cpp.

References FS_File.

Referenced by LTOCodeGenerator::compile_to_file(), llvm::createGraphFilename(), and createTemporaryFile().

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.

Definition at line 684 of file Path.cpp.

References createTemporaryFile(), llvm::NVPTXISD::Dummy, and FS_Name.

static error_code llvm::sys::fs::createTemporaryFile ( const Twine &  Model,
int &  ResultFD,
llvm::SmallVectorImpl< char > &  ResultPath,
FSEntity  Type 
)
static
static error_code llvm::sys::fs::createTemporaryFile ( const Twine &  Prefix,
StringRef  Suffix,
int &  ResultFD,
llvm::SmallVectorImpl< char > &  ResultPath,
FSEntity  Type 
)
static

Definition at line 669 of file Path.cpp.

References createTemporaryFile(), and llvm::StringRef::empty().

error_code llvm::sys::fs::createUniqueDirectory ( const Twine &  Prefix,
SmallVectorImpl< char > &  ResultPath 
)

Definition at line 693 of file Path.cpp.

References createUniqueEntity(), llvm::NVPTXISD::Dummy, and FS_Dir.

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.

Generates a unique path suitable for a temporary file and then opens it as a file. The name is based on model with '' replaced by a random char in [0-9a-f]. If model is not an absolute path, a suitable temporary directory will be prepended.

Example: clang-%%-%%-%%-%%-%%.s => clang-a0-b1-c2-d3-e4.s

This is an atomic operation. Either the file is created and opened, or the file system is left untouched.

The intendend use is for files that are to be kept, possibly after renaming them. For example, when running 'clang -c foo.o', the file can be first created as foo-abc123.o and then renamed.

Parameters
ModelName to base unique path off of.
ResultFDSet to the opened file's file descriptor.
ResultPathSet to the opened file's absolute path.
Returns
errc::success if Result{FD,Path} have been successfully set, otherwise a platform specific error_code.

Definition at line 645 of file Path.cpp.

References createUniqueEntity(), and FS_File.

Referenced by llvm::FileOutputBuffer::create(), and llvm::LockFileManager::LockFileManager().

error_code llvm::sys::fs::createUniqueFile ( const Twine &  Model,
SmallVectorImpl< char > &  ResultPath 
)

Simpler version for clients that don't want an open file.

Definition at line 650 of file Path.cpp.

References createUniqueEntity(), llvm::NVPTXISD::Dummy, and FS_Name.

error_code llvm::sys::fs::current_path ( SmallVectorImpl< char > &  result)

Get the current path.

Parameters
resultHolds the current path on return.
Returns
errc::success if the current path has been stored in result, otherwise a platform specific error_code.

Referenced by make_absolute(), and llvm::MCContext::MCContext().

bool llvm::sys::fs::equivalent ( file_status  A,
file_status  B 
)

Do file_status's represent the same thing?

Parameters
AInput file_status.
BInput file_status.

assert(status_known(A) || status_known(B));

Returns
True if A and B both represent the same file system entity, false otherwise.

Referenced by equivalent().

error_code llvm::sys::fs::equivalent ( const Twine &  A,
const Twine &  B,
bool result 
)

Do paths represent the same thing?

assert(status_known(A) || status_known(B));

Parameters
AInput path A.
BInput path B.
resultSet to true if stat(A) and stat(B) have the same device and inode (or equivalent).
Returns
errc::success if result has been successfully set, otherwise a platform specific error_code.
bool llvm::sys::fs::equivalent ( const Twine &  A,
const Twine &  B 
)
inline

Simpler version of equivalent for clients that don't need to differentiate between an error and false.

Definition at line 438 of file FileSystem.h.

References equivalent().

bool llvm::sys::fs::exists ( file_status  status)

Does file exist?

Parameters
statusA file_status previously returned from stat.
Returns
True if the file represented by status exists, false if it does not.

Definition at line 768 of file Path.cpp.

References llvm::sys::fs::file_type::file_not_found, status_known(), and llvm::sys::fs::file_status::type().

Referenced by create_directories(), exists(), is_other(), and llvm::LockFileManager::waitForUnlock().

error_code llvm::sys::fs::exists ( const Twine &  path,
bool result 
)

Does file exist?

Parameters
pathInput path.
resultSet to true if the file represented by status exists, false if it does not. Undefined otherwise.
Returns
errc::success if result has been successfully set, otherwise a platform specific error_code.
bool llvm::sys::fs::exists ( const Twine &  path)
inline

Simpler version of exists for clients that don't need to differentiate between an error and false.

Definition at line 396 of file FileSystem.h.

References exists().

error_code llvm::sys::fs::file_size ( const Twine &  Path,
uint64_t &  Result 
)
inline

Get file size.

Parameters
PathInput path.
ResultSet to the size of the file in Path.
Returns
errc::success if result has been successfully set, otherwise a platform specific error_code.

Definition at line 539 of file FileSystem.h.

References status(), and llvm::error_code::success().

error_code llvm::sys::fs::get_magic ( const Twine &  path,
uint32_t  len,
SmallVectorImpl< char > &  result 
)

Get path's first len bytes.

Parameters
pathInput path.
lenNumber of magic bytes to get.
resultSet to the first len bytes in the file pointed to by path. Or the entire file if file_size(path) < len, in which case result.size() returns the size of the file.
Returns
errc::success if result has been successfully set, errc::value_too_large if len is larger then the file pointed to by path, otherwise a platform specific error_code.

Referenced by has_magic(), and identify_magic().

std::string llvm::sys::fs::getMainExecutable ( const char *  argv0,
void *  MainExecAddr 
)

Return the path to the main executable, given the value of argv[0] from program startup and the address of main itself. In extremis, this function may fail and return an empty path.

error_code llvm::sys::fs::getUniqueID ( const Twine  Path,
UniqueID &  Result 
)
error_code llvm::sys::fs::has_magic ( const Twine &  path,
const Twine &  magic,
bool result 
)

Are path's first bytes magic?

Parameters
pathInput path.
magicByte sequence to compare path's first len(magic) bytes to.
Returns
errc::success if result has been successfully set, otherwise a platform specific error_code.

Definition at line 827 of file Path.cpp.

References get_magic(), Magic, llvm::StringRef::size(), llvm::error_code::success(), llvm::Twine::toStringRef(), and llvm::errc::value_too_large.

file_magic llvm::sys::fs::identify_magic ( StringRef  magic)
error_code llvm::sys::fs::identify_magic ( const Twine &  path,
file_magic &  result 
)

Get and identify path's type based on its content.

Parameters
pathInput path.
resultSet to the type of file, or file_magic::unknown.
Returns
errc::success if result has been successfully set, otherwise a platform specific error_code.

Definition at line 976 of file Path.cpp.

References llvm::SmallVectorTemplateCommon< T >::capacity(), get_magic(), identify_magic(), Magic, llvm::error_code::success(), and llvm::errc::value_too_large.

bool llvm::sys::fs::is_directory ( file_status  status)

Does status represent a directory?

Parameters
statusA file_status previously returned from status.
Returns
status.type() == file_type::directory_file.

Definition at line 776 of file Path.cpp.

References llvm::sys::fs::file_type::directory_file, and llvm::sys::fs::file_status::type().

Referenced by llvm::sys::fs::recursive_directory_iterator::increment(), is_directory(), and is_other().

error_code llvm::sys::fs::is_directory ( const Twine &  path,
bool result 
)

Is path a directory?

Parameters
pathInput path.
resultSet to true if path is a directory, false if it is not. Undefined otherwise.
Returns
errc::success if result has been successfully set, otherwise a platform specific error_code.

Definition at line 780 of file Path.cpp.

References is_directory(), status(), and llvm::error_code::success().

bool llvm::sys::fs::is_directory ( const Twine &  Path)
inline

Simpler version of is_directory for clients that don't need to differentiate between an error and false.

Definition at line 460 of file FileSystem.h.

References is_directory().

bool llvm::sys::fs::is_other ( file_status  status)

Does this status represent something that exists but is not a directory, regular file, or symlink?

Parameters
statusA file_status previously returned from status.
Returns
exists(s) && !is_regular_file(s) && !is_directory(s) && !is_symlink(s)

Definition at line 812 of file Path.cpp.

References exists(), is_directory(), is_regular_file(), and is_symlink().

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?

Parameters
pathInput path.
resultSet to true if path exists, but is not a directory, regular file, or a symlink, false if it does not. Undefined otherwise.
Returns
errc::success if result has been successfully set, otherwise a platform specific error_code.
bool llvm::sys::fs::is_regular_file ( file_status  status)

Does status represent a regular file?

Parameters
statusA file_status previously returned from status.
Returns
status_known(status) && status.type() == file_type::regular_file.

Definition at line 788 of file Path.cpp.

References llvm::sys::fs::file_type::regular_file, and llvm::sys::fs::file_status::type().

Referenced by is_other(), and is_regular_file().

error_code llvm::sys::fs::is_regular_file ( const Twine &  path,
bool result 
)

Is path a regular file?

Parameters
pathInput path.
resultSet to true if path is a regular file, false if it is not. Undefined otherwise.
Returns
errc::success if result has been successfully set, otherwise a platform specific error_code.

Definition at line 792 of file Path.cpp.

References is_regular_file(), status(), and llvm::error_code::success().

bool llvm::sys::fs::is_regular_file ( const Twine &  Path)
inline

Simpler version of is_regular_file for clients that don't need to differentiate between an error and false.

Definition at line 482 of file FileSystem.h.

References is_regular_file().

bool llvm::sys::fs::is_symlink ( file_status  status)

Does status represent a symlink?

Parameters
statusA file_status previously returned from stat.
Returns
status.type() == symlink_file.

Definition at line 800 of file Path.cpp.

References llvm::sys::fs::file_type::symlink_file, and llvm::sys::fs::file_status::type().

Referenced by is_other(), and is_symlink().

error_code llvm::sys::fs::is_symlink ( const Twine &  path,
bool result 
)

Is path a symlink?

Parameters
pathInput path.
resultSet to true if path is a symlink, false if it is not. Undefined otherwise.
Returns
errc::success if result has been successfully set, otherwise a platform specific error_code.

Definition at line 804 of file Path.cpp.

References is_symlink(), status(), and llvm::error_code::success().

error_code llvm::sys::fs::make_absolute ( SmallVectorImpl< char > &  path)

Make path an absolute path.

Makes path absolute using the current directory if it is not already. An empty path will result in the current directory.

/absolute/path => /absolute/path relative/../path => <current-directory>/relative/../path

Parameters
pathA path that is modified to be an absolute path.
Returns
errc::success if path has been made absolute, otherwise a platform specific error_code.

Definition at line 700 of file Path.cpp.

References llvm::sys::path::append(), llvm::StringRef::begin(), current_path(), llvm::SmallVectorTemplateCommon< T, typename >::data(), llvm::StringRef::end(), llvm::sys::path::has_root_directory(), llvm::sys::path::has_root_name(), llvm_unreachable, llvm::sys::path::relative_path(), llvm::sys::path::root_directory(), llvm::sys::path::root_name(), llvm::SmallVectorTemplateCommon< T, typename >::size(), llvm::error_code::success(), and llvm::SmallVectorImpl< T >::swap().

error_code llvm::sys::fs::map_file_pages ( const Twine &  path,
off_t  file_offset,
size_t  size,
bool  map_writable,
void *&  result 
)

Memory maps the contents of a file.

Parameters
pathPath to file to map.
file_offsetByte offset in file where mapping should begin.
sizeByte length of range of the file to map.
map_writableIf true, the file will be mapped in r/w such that changes to the mapped buffer will be flushed back to the file. If false, the file will be mapped read-only and the buffer will be read-only.
resultSet to the start address of the mapped buffer.
Returns
errc::success if result has been successfully set, otherwise a platform specific error_code.
error_code llvm::sys::fs::openFileForRead ( const Twine &  Name,
int &  ResultFD 
)

Referenced by getFileAux().

error_code llvm::sys::fs::openFileForWrite ( const Twine &  Name,
int &  ResultFD,
OpenFlags  Flags,
unsigned  Mode = 0666 
)
perms llvm::sys::fs::operator& ( perms  l,
perms  r 
)
inline

Definition at line 112 of file FileSystem.h.

perms& llvm::sys::fs::operator&= ( perms &  l,
perms  r 
)
inline

Definition at line 120 of file FileSystem.h.

perms llvm::sys::fs::operator| ( perms  l,
perms  r 
)
inline

Definition at line 108 of file FileSystem.h.

OpenFlags llvm::sys::fs::operator| ( OpenFlags  A,
OpenFlags  B 
)
inline

Definition at line 629 of file FileSystem.h.

perms& llvm::sys::fs::operator|= ( perms &  l,
perms  r 
)
inline

Definition at line 116 of file FileSystem.h.

OpenFlags& llvm::sys::fs::operator|= ( OpenFlags &  A,
OpenFlags  B 
)
inline

Definition at line 633 of file FileSystem.h.

References llvm::ARM_PROC::A.

perms llvm::sys::fs::operator~ ( perms  x)
inline

Definition at line 124 of file FileSystem.h.

error_code llvm::sys::fs::remove ( const Twine &  path,
bool existed 
)

Remove path. Equivalent to POSIX remove().

Parameters
pathInput path.
existedSet to true if path existed, false if it did not. undefined otherwise.
Returns
errc::success if path has been removed and existed has been successfully set, otherwise a platform specific error_code.

Referenced by llvm::FileOutputBuffer::create(), ExecGraphViewer(), llvm::LockFileManager::LockFileManager(), llvm::FileRemover::setFile(), llvm::FileOutputBuffer::~FileOutputBuffer(), llvm::FileRemover::~FileRemover(), and llvm::LockFileManager::~LockFileManager().

error_code llvm::sys::fs::remove ( const Twine &  Path)
inline

Convenience function for clients that don't need to know if the file existed or not.

Definition at line 339 of file FileSystem.h.

error_code llvm::sys::fs::remove_all ( const Twine &  path,
uint32_t &  num_removed 
)

Recursively remove all files below path, then path. Files are removed as if by POSIX remove().

Parameters
pathInput path.
num_removedNumber of files removed.
Returns
errc::success if path has been removed and num_removed has been successfully set, otherwise a platform specific error_code.

Definition at line 1014 of file Path.cpp.

References status(), llvm::Twine::toStringRef(), and llvm::sys::fs::file_status::type().

Referenced by remove_all().

error_code llvm::sys::fs::remove_all ( const Twine &  Path)
inline

Convenience function for clients that don't need to know how many files were removed.

Definition at line 355 of file FileSystem.h.

References remove_all().

error_code llvm::sys::fs::rename ( const Twine &  from,
const Twine &  to 
)

Rename from to to. Files are renamed as if by POSIX rename().

Parameters
fromThe path to rename from.
toThe path to rename to. This is created.

Referenced by llvm::FileOutputBuffer::commit().

error_code llvm::sys::fs::resize_file ( const Twine &  path,
uint64_t  size 
)

Resize path to size. File is resized as if by POSIX truncate().

Parameters
pathInput path.
sizeSize to resize to.
Returns
errc::success if path has been resized to size, otherwise a platform specific error_code.

Referenced by llvm::FileOutputBuffer::commit().

error_code llvm::sys::fs::setLastModificationAndAccessTime ( int  FD,
TimeValue  Time 
)
error_code llvm::sys::fs::status ( const Twine &  path,
file_status &  result 
)
error_code llvm::sys::fs::status ( int  FD,
file_status &  Result 
)

A version for when a file descriptor is already available.

bool llvm::sys::fs::status_known ( file_status  s)

Is status available?

Parameters
sInput file status.
Returns
True if status() != status_error.

Definition at line 772 of file Path.cpp.

References llvm::sys::fs::file_type::status_error, and llvm::sys::fs::file_status::type().

Referenced by exists().

error_code llvm::sys::fs::status_known ( const Twine &  path,
bool result 
)

Is status available?

Parameters
pathInput path.
resultSet to true if status() != status_error.
Returns
errc::success if result has been successfully set, otherwise a platform specific error_code.
error_code llvm::sys::fs::unmap_file_pages ( void *  base,
size_t  size 
)

Memory unmaps the contents of a file.

Parameters
basePointer to the start of the buffer.
sizeByte length of the range to unmmap.
Returns
errc::success if result has been successfully set, otherwise a platform specific error_code.