|
|
满身肌肉的八宝粥 · 【Day31】ChatGPT請教教我:Jes ...· 4 周前 · |
|
|
霸气的胡萝卜 · Jest | Sysuke's World· 4 周前 · |
|
|
大力的荒野 · #167: argument of ...· 2 周前 · |
|
|
果断的针织衫 · Error E0310 - I'm a ...· 2 周前 · |
|
|
爱看球的海龟 · use c++ in keil not ...· 2 周前 · |
|
|
健壮的眼镜 · 小米SU7,具备科技大厂智能座舱的生态壁垒_ ...· 1 周前 · |
|
|
微醺的硬币 · #思摩尔国际预计上半年净利超30亿# - 热 ...· 1 年前 · |
|
|
魁梧的汤圆 · 地铁大兴机场线明起运营,6条机场大巴线路同步 ...· 1 年前 · |
|
|
儒雅的皮带 · 权臣的掌中娇宠漫画 - 抖音· 2 年前 · |
|
|
面冷心慈的弓箭 · 北京广安门医院:此前有保安倒号被开除-新华网· 2 年前 · |
FD
to
Size
before mapping
mapped_file_region::readwrite
.
Buf.size()
bytes from
FileHandle
into
Buf
.
FileHandle
until EOF, appending to
Buffer
in chunks of size
ChunkSize
.
Buf.size()
bytes from
FileHandle
at offset
Offset
into
Buf
.
CD_CreateAlways - When opening a file:
CD_CreateNew - When opening a file:
CD_OpenExisting - When opening a file:
CD_OpenAlways - When opening a file:
The file should be opened in text mode on platforms like z/OS that make this distinction.
OF_CRLF
The file should use a carriage linefeed '\r
This flag should only be used with OF_Text. Only makes a difference on Windows.
OF_TextWithCRLF
The file should be opened in text mode and use a carriage linefeed '\r
This flag has the same functionality as OF_Text on z/OS but adds a carriage linefeed on Windows.
OF_AppendThe file should be opened in append mode.
OF_DeleteThe returned handle can be used for deleting the file.
Only makes a difference on windows.
OF_ChildInheritWhen a child process is launched, this file should remain open in the child process.
OF_UpdateAtimeForce files Atime to be updated on access.
Only makes a difference on Windows.
Definition at line 754 of file FileSystem.h .
Referenced by can_write() , createUniqueEntity() , exists() , and llvm::LockFileManager::waitForUnlock() .
Definition at line 475 of file FileSystem.h .
References access() , and Write .
Referenced by llvm::FilePermissionsApplier::apply() .
Close the file object.
This should be used instead of ::close for portability. On error, the caller should assume the file is closed, as is the case for Process::SafelyCloseFileDescriptor
Referenced by llvm::NewArchiveMember::getFile() , llvm::MemoryBuffer::getFileAsStream() , getFileAux() , llvm::xray::loadProfile() , llvm::xray::loadTraceFile() , loadYAML() , llvm::localCache() , llvm::streamFile() , and llvm::InteractiveModelRunner::~InteractiveModelRunner() .
Converts from a Posix file descriptor number to a native file handle.
On Windows, this retreives the underlying handle. On non-Windows, this is a no-op.
Definition at line 991 of file FileSystem.h .
Referenced by llvm::LTOModule::createFromOpenFileSlice() , createOnDiskBuffer() , llvm::localCache() , and llvm::InteractiveModelRunner::~InteractiveModelRunner() .
Definition at line 1018 of file Path.cpp .
References CD_CreateAlways , copy_file_internal() , From , OF_None , openFileForRead() , and openFileForWrite() .
Referenced by llvm::FileCollector::copyFiles() , llvm::sys::fs::TempFile::keep() , and llvm::ThinLTOCodeGenerator::writeGeneratedObject() .
Definition at line 993 of file Path.cpp .
References llvm::support::endian::read() , and llvm::write() .
Referenced by copy_file() .
Definition at line 969 of file Path.cpp .
References create_directories() , create_directory() , llvm::StringRef::empty() , llvm::no_such_file_or_directory , P , and llvm::sys::path::parent_path() .
Referenced by codegen() , llvm::FileCollector::copyFiles() , create_directories() , llvm::logicalview::LVSplitContext::createSplitFolder() , llvm::lto::getThinLTOOutputFile() , llvm::localCache() , prepareDumpIRFileDescriptor() , and llvm::ThinLTOCodeGenerator::run() .
Referenced by create_directories() , createUniqueEntity() , and llvm::unittest::TempDir::TempDir() .
Create a link from from to to .
The link may be a soft or a hard link, depending on the platform. The caller may not assume which one. Currently on windows it creates a hard link since soft links require extra privileges. On unix, it creates a soft link since hard links don't work on SMB file systems.
Referenced by llvm::LockFileManager::LockFileManager() , and llvm::unittest::TempLink::TempLink() .
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 865 of file Path.cpp .
References createTemporaryFile() , and FS_File .
Referenced by llvm::createGraphFilename() , createTemporaryFile() , getPotentiallyUniqueTempFileName() , llvm::prepareTempFiles() , printSymbolizedStackTrace() , and llvm::unittest::TempFile::TempFile() .
Simpler version for clients that don't want an open file.
An empty file will still be created.
Definition at line 873 of file Path.cpp .
References createTemporaryFile() .
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, the temporary file will be created in the current directory.
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 intended 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.
Definition at line 824 of file Path.cpp .
References createUniqueEntity() , and FS_File .
Referenced by llvm::sys::fs::TempFile::create() , createUniqueFile() , and llvm::LockFileManager::LockFileManager() .
Simpler version for clients that don't want an open file.
An empty file will still be created.
Definition at line 831 of file Path.cpp .
References createUniqueFile() , and OF_None .
Create a potentially unique file name but does not create it.
Generates a unique path suitable for a temporary file but does not open or create the file. The name is based on Model with '' replaced by a random char in [0-9a-f]. If MakeAbsolute is true then the system's temp directory is prepended first. If MakeAbsolute is false the current directory will be used instead.
This function does not check if the file exists. If you want to be sure that the file does not yet exist, you should use enough '' characters in your model to ensure this. Each '' gives 4-bits of entropy so you can use 32 of them to get 128 bits of entropy.
Example: clang-%%-%%-%%-%%-%%.s => clang-a0-b1-c2-d3-e4.s
Definition at line 798 of file Path.cpp .
References llvm::sys::path::append() , llvm::sys::Process::GetRandomNumber() , llvm::sys::path::is_absolute() , llvm::SmallVectorTemplateBase< T, bool >::pop_back() , llvm::SmallVectorTemplateBase< T, bool >::push_back() , llvm::SmallVectorBase< Size_T >::size() , llvm::SmallVectorImpl< T >::swap() , and llvm::sys::path::system_temp_directory() .
Referenced by createUniqueEntity() , and llvm::DotCfgChangeReporter::handleFunctionCompare() .
Referenced by make_absolute() .
Get disk space usage information.
Note: Users must be careful about "Time Of Check, Time Of Use" kind of bug. Note: Windows reports results according to the quota allocated to the user.
Referenced by llvm::pruneCache() .
Simpler version of equivalent for clients that don't need to differentiate between an error and false.
Definition at line 504 of file FileSystem.h .
References A , B , and equivalent() .
assert(status_known(A) || status_known(B));
Referenced by equivalent() , and llvm::sys::Process::FindInEnvPath() .
Definition at line 1079 of file Path.cpp .
References file_not_found , status() , and status_known() .
Referenced by llvm::object::BuildIDFetcher::fetch() , llvm::sys::Process::FindInEnvPath() , findInputFile() , getFilename() , is_other() , llvm::LockFileManager::LockFileManager() , llvm::pdb::InputFile::open() , llvm::orc::DumpObjects::operator()() , printMarkupStackTrace() , printSymbolizedStackTrace() , searchForObj() , llvm::LockFileManager::waitForUnlock() , and llvm::ThinLTOCodeGenerator::writeGeneratedObject() .
Expands ~ expressions to the user's home directory.
On Unix ~user directories are resolved as well.
Definition at line 689 of file FileSystem.h .
References status() .
Referenced by llvm::xray::loadInstrumentationMap() , llvm::xray::loadProfile() , and llvm::xray::loadTraceFile() .
Definition at line 1087 of file Path.cpp .
References status() , status_error , and llvm::sys::fs::basic_file_status::type() .
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.
Referenced by printMarkupStackTrace() , and printSymbolizedStackTrace() .
Definition at line 1153 of file Path.cpp .
References status() .
Referenced by llvm::FileCollector::copyFiles() .
Get a unique name, not currently exisiting in the filesystem.
Subject to race conditions, prefer to use createUniqueFile instead.
Similar to createUniqueFile, but instead of creating a file only checks if it exists. This function is subject to race conditions, if you want to use the returned name to actually create a file, use createUniqueFile instead.
Definition at line 895 of file Path.cpp .
References createUniqueEntity() , and FS_Name .
Get a unique temporary file name, not currently exisiting in the filesystem.
Subject to race conditions, prefer to use createTemporaryFile instead.
Similar to createTemporaryFile, but instead of creating a file only checks if it exists. This function is subject to race conditions, if you want to use the returned name to actually create a file, use createTemporaryFile instead.
Definition at line 902 of file Path.cpp .
References createTemporaryFile() , and FS_Name .
Return an open handle to standard in.
On Unix, this is typically FD 0. Returns kInvalidFile when the stream is closed.
Referenced by llvm::MemoryBuffer::getSTDIN() .
Get file creation mode mask of the process.
Referenced by llvm::FilePermissionsApplier::apply() .
Definition at line 1094 of file Path.cpp .
References directory_file , and status() .
Referenced by llvm::FileCollectorBase::addDirectory() , llvm::object::MachOObjectFile::findDsymObjectMembers() , is_directory() , is_other() , llvm::pruneCache() , and llvm::ThinLTOCodeGenerator::run() .
Simpler version of is_directory for clients that don't need to differentiate between an error and false.
Definition at line 560 of file FileSystem.h .
References is_directory() .
Definition at line 1098 of file Path.cpp .
References is_directory() , and status() .
Simpler version of is_local for clients that don't need to differentiate between an error and false.
Definition at line 523 of file FileSystem.h .
References is_local() .
Referenced by is_local() .
Simpler version of is_local accepting an open file descriptor for clients that don't need to differentiate between an error and false.
Definition at line 530 of file FileSystem.h .
References is_local() .
Does this status represent something that exists but is not a directory or regular file?
Definition at line 1130 of file Path.cpp .
References exists() , is_directory() , is_regular_file() , and status() .
Referenced by is_other() .
Is path something that exists but is not a directory, regular file, or symlink?
Definition at line 1136 of file Path.cpp .
References is_other() , and status() .
Definition at line 1106 of file Path.cpp .
References regular_file , and status() .
Referenced by findSrcDirMap() , is_other() , and is_regular_file() .
Simpler version of is_regular_file for clients that don't need to differentiate between an error and false.
Definition at line 582 of file FileSystem.h .
References is_regular_file() .
Definition at line 1110 of file Path.cpp .
References is_regular_file() , and status() .
Definition at line 1118 of file Path.cpp .
References status() , and symlink_file .
Referenced by is_symlink_file() .
Simpler version of is_symlink_file for clients that don't need to differentiate between an error and false.
Definition at line 606 of file FileSystem.h .
References is_symlink_file() .
Definition at line 1122 of file Path.cpp .
References is_symlink_file() , and status() .
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
Definition at line 908 of file Path.cpp .
References llvm::sys::path::append() , llvm::StringRef::begin() , 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::SmallVectorBase< Size_T >::size() , llvm::SmallVectorImpl< T >::swap() , and llvm::Twine::toVector() .
Referenced by llvm::canonicalizePath() , llvm::vfs::RedirectingFileSystem::create() , emitExternalFile() , llvm::AsmPrinter::emitRemarksSection() , findSrcDirMap() , llvm::LockFileManager::LockFileManager() , make_absolute() , makeAbsolute() , llvm::vfs::FileSystem::makeAbsolute() , and llvm::DotCfgChangeReporter::registerCallbacks() .
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
Definition at line 957 of file Path.cpp .
References current_path() , llvm::sys::path::is_absolute() , and make_absolute() .
Version of compute_md5 that doesn't require an open file descriptor.
Definition at line 1069 of file Path.cpp .
References md5_contents() , OF_None , and openFileForRead() .
Definition at line 1049 of file Path.cpp .
References llvm::MD5::final() , llvm::support::endian::read() , and llvm::MD5::update() .
Referenced by md5_contents() .
Opens a file with the specified creation disposition, access mode, and flags and returns a file descriptor.
The caller is responsible for closing the file descriptor once they are finished with it.
Referenced by openFileForReadWrite() , openFileForWrite() , and prepareDumpIRFileDescriptor() .
Opens the file with the given name in a read-only mode, returning its open file descriptor.
The caller is responsible for closing the file descriptor once they are finished with it.
Referenced by copy_file() , and md5_contents() .
Opens the file with the given name in a write-only or read-write mode, returning its open file descriptor.
If the file does not exist, it is created.
The caller is responsible for closing the file descriptor once they are finished with it.
Definition at line 1104 of file FileSystem.h .
References FA_Read , FA_Write , Mode , Name , and openFile() .
Referenced by createUniqueEntity() , and getFD() .
Opens the file with the given name in a write-only or read-write mode, returning its open file descriptor.
If the file does not exist, it is created.
The caller is responsible for closing the file descriptor once they are finished with it.
Definition at line 1063 of file FileSystem.h .
References FA_Write , Mode , Name , and openFile() .
Referenced by llvm::FilePermissionsApplier::apply() , copy_file() , copyAccessAndModificationTime() , getFD() , llvm::prepareTempFiles() , llvm::unittest::TempFile::TempFile() , and llvm::WriteGraph() .
Opens a file with the specified creation disposition, access mode, and flags and returns a platform-specific file object.
The caller is responsible for closing the file object once they are finished with it.
Referenced by openNativeFileForReadWrite() , and openNativeFileForWrite() .
Opens the file with the given name in a read-only mode, returning its open file descriptor.
The caller is responsible for closing the freeing the file once they are finished with it.
Referenced by llvm::NewArchiveMember::getFile() , llvm::MemoryBuffer::getFileAsStream() , getFileAux() , llvm::xray::loadInstrumentationMap() , llvm::xray::loadProfile() , llvm::xray::loadTraceFile() , llvm::localCache() , and llvm::streamFile() .
Opens the file with the given name in a write-only or read-write mode, returning its open file descriptor.
If the file does not exist, it is created.
The caller is responsible for closing the freeing the file once they are finished with it.
Definition at line 1124 of file FileSystem.h .
References FA_Read , FA_Write , Mode , Name , and openNativeFile() .
Referenced by getReadWriteFile() .
Opens the file with the given name in a write-only or read-write mode, returning its open file descriptor.
If the file does not exist, it is created.
The caller is responsible for closing the freeing the file once they are finished with it.
Definition at line 1082 of file FileSystem.h .
References FA_Write , Mode , Name , and openNativeFile() .
Reads
Buf.size()
bytes from
FileHandle
into
Buf
.
Returns the number of bytes actually read. On Unix, this is equivalent to
return ::read(FD, Buf.data(), Buf.size())
, with error reporting. Returns 0 when reaching EOF.
Referenced by readNativeFileToEOF() .
Reads
Buf.size()
bytes from
FileHandle
at offset
Offset
into
Buf
.
If 'pread' is available, this will use that, otherwise it will use 'lseek'. Returns the number of bytes actually read. Returns 0 when reaching EOF.
Referenced by getOpenFileImpl() .
Reads from
FileHandle
until EOF, appending to
Buffer
in chunks of size
ChunkSize
.
This calls
readNativeFile()
in a loop. On
Error
, previous chunks that were read successfully are left in
Buffer
and returned.
Note: For reading the final chunk at EOF,
Buffer's
capacity needs extra storage of
ChunkSize
.
Definition at line 1176 of file Path.cpp .
References llvm::SmallVectorTemplateCommon< T, typename >::begin() , llvm::make_scope_exit() , readNativeFile() , llvm::SmallVectorImpl< T >::resize_for_overwrite() , llvm::SmallVectorBase< Size_T >::size() , Size , llvm::Error::success() , llvm::Expected< T >::takeError() , and llvm::SmallVectorImpl< T >::truncate() .
Referenced by getMemoryBufferForStream() .
Collapse all .
and .. patterns, resolve all symlinks, and optionally expand ~ expressions to the user's home directory.
Referenced by cleanUpTempFilesImpl() , llvm::LTOCodeGenerator::compileOptimized() , llvm::sys::fs::TempFile::discard() , ExecGraphViewer() , llvm::DotCfgChangeReporter::handleFunctionCompare() , llvm::sys::fs::TempFile::keep() , llvm::LockFileManager::LockFileManager() , llvm::pruneCache() , llvm::FileRemover::setFile() , llvm::LockFileManager::unsafeRemoveLockFile() , llvm::ThinLTOCodeGenerator::writeGeneratedObject() , llvm::FileRemover::~FileRemover() , llvm::LockFileManager::~LockFileManager() , llvm::unittest::TempFile::~TempFile() , and llvm::unittest::TempLink::~TempLink() .
Referenced by llvm::unittest::TempDir::~TempDir() .
Rename from to to .
Files are renamed as if by POSIX rename() , except that on Windows there may be a short interval of time during which the destination file does not exist.
Referenced by resize_file_before_mapping_readwrite() .
Resize
FD
to
Size
before mapping
mapped_file_region::readwrite
.
On non-Windows, this calls
resize_file()
. On Windows, this is a no-op, since the subsequent mapping (via
CreateFileMapping
) automatically extends the file.
Definition at line 416 of file FileSystem.h .
References resize_file() , and Size .
Referenced by createOnDiskBuffer() .
Set the file modification and access time.
Referenced by llvm::FilePermissionsApplier::apply() , copyAccessAndModificationTime() , and setLastAccessAndModificationTime() .
Simpler version that sets both file modification and access time to the same time.
Definition at line 708 of file FileSystem.h .
References setLastAccessAndModificationTime() .
Referenced by llvm::FilePermissionsApplier::apply() , and llvm::FileCollector::copyFiles() .
Referenced by llvm::FilePermissionsApplier::apply() , llvm::FileCollector::copyFiles() , llvm::FileOutputBuffer::create() , llvm::FilePermissionsApplier::create() , exists() , file_size() , llvm::object::MachOObjectFile::findDsymObjectMembers() , get_file_type() , llvm::NewArchiveMember::getFile() , getOpenFileImpl() , getPermissions() , getReadWriteFile() , getUniqueID() , llvm::sys::fs::recursive_directory_iterator::increment() , is_directory() , is_other() , is_regular_file() , is_symlink_file() , llvm::pruneCache() , and shouldUseMmap() .
Definition at line 1083 of file Path.cpp .
References status_error , and llvm::sys::fs::basic_file_status::type() .
Referenced by exists() .
Try to locks the file during the specified time.
This function implements advisory locking on entire file. If it returns errc::success , the file is locked by the calling process. Until the process unlocks the file by calling unlockFile , all attempts to lock the same file will fail/block. The process that locked the file may assume that none of other processes read or write this file, provided that all processes lock the file prior to accessing its content.
Referenced by llvm::raw_fd_ostream::tryLockFor() .
Referenced by llvm::sys::fs::FileLocker::unlock() , and llvm::sys::fs::FileLocker::~FileLocker() .
|
|
霸气的胡萝卜 · Jest | Sysuke's World 4 周前 |
|
|
儒雅的皮带 · 权臣的掌中娇宠漫画 - 抖音 2 年前 |
|
|
面冷心慈的弓箭 · 北京广安门医院:此前有保安倒号被开除-新华网 2 年前 |