|
LLVM 23.0.0git
|
Classes | |
| class | const_iterator |
| Path iterator. More... | |
| class | reverse_iterator |
| Reverse path iterator. More... | |
Enumerations | |
| enum class | Style { native , posix , windows_slash , windows_backslash , windows = windows_backslash } |
Functions | |
| constexpr bool | is_style_posix (Style S) |
Check if S uses POSIX path rules. | |
| constexpr bool | is_style_windows (Style S) |
Check if S uses Windows path rules. | |
| reverse_iterator | rbegin (StringRef Path, Style style) |
| reverse_iterator | rend (StringRef Path) |
| static bool | starts_with (StringRef Path, StringRef Prefix, Style style=Style::native) |
| StringRef | remove_leading_dotslash (StringRef Path, Style style) |
Lexical Component Iterator | |
| LLVM_ABI const_iterator | begin (StringRef path LLVM_LIFETIME_BOUND, Style style=Style::native) |
| Get begin iterator over path. | |
| LLVM_ABI const_iterator | end (StringRef path LLVM_LIFETIME_BOUND) |
| Get 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 reverse_iterator | rend (StringRef path LLVM_LIFETIME_BOUND) |
| Get reverse end iterator over path. | |
Lexical Modifiers | |
| 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 void | replace_extension (SmallVectorImpl< char > &path, const Twine &extension, Style style=Style::native) |
| Replace the file extension of path with extension. | |
| 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 StringRef | remove_leading_dotslash (StringRef path LLVM_LIFETIME_BOUND, Style style=Style::native) |
| Remove redundant leading "./" pieces and consecutive separators. | |
| LLVM_ABI bool | remove_dots (SmallVectorImpl< char > &path, bool remove_dot_dot=false, Style style=Style::native) |
| Remove '. | |
| LLVM_ABI void | append (SmallVectorImpl< char > &path, const Twine &a, const Twine &b="", const Twine &c="", const Twine &d="") |
| Append to path. | |
| LLVM_ABI void | append (SmallVectorImpl< char > &path, Style style, const Twine &a, const Twine &b="", const Twine &c="", const Twine &d="") |
| LLVM_ABI void | append (SmallVectorImpl< char > &path, const_iterator begin, const_iterator end, Style style=Style::native) |
| Append to path. | |
Transforms (or some other better name) | |
| LLVM_ABI void | native (const Twine &path, SmallVectorImpl< char > &result, Style style=Style::native) |
| Convert path to the native form. | |
| LLVM_ABI std::string | native (const Twine &path, Style style=Style::native) |
| Convert path to the native form and return it as a std::string. | |
| LLVM_ABI void | native (SmallVectorImpl< char > &path, Style style=Style::native) |
| Convert path to the native form in place. | |
| void | make_preferred (SmallVectorImpl< char > &path, Style style=Style::native) |
| For Windows path styles, convert path to use the preferred path separators. | |
| LLVM_ABI std::string | convert_to_slash (StringRef path, Style style=Style::native) |
| Replaces backslashes with slashes if Windows. | |
Lexical Observers | |
| 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 StringRef | root_path (StringRef path LLVM_LIFETIME_BOUND, Style style=Style::native) |
| Get root path. | |
| LLVM_ABI StringRef | relative_path (StringRef path LLVM_LIFETIME_BOUND, Style style=Style::native) |
| Get relative path. | |
| LLVM_ABI StringRef | parent_path (StringRef path LLVM_LIFETIME_BOUND, Style style=Style::native) |
| Get parent path. | |
| LLVM_ABI StringRef | filename (StringRef path LLVM_LIFETIME_BOUND, Style style=Style::native) |
| Get filename. | |
| LLVM_ABI StringRef | stem (StringRef path LLVM_LIFETIME_BOUND, Style style=Style::native) |
| Get stem. | |
| LLVM_ABI StringRef | extension (StringRef path LLVM_LIFETIME_BOUND, Style style=Style::native) |
| Get extension. | |
| 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 | get_separator (Style style=Style::native) |
| Return the preferred separator for this platform. | |
| 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 | home_directory (SmallVectorImpl< char > &result) |
| Get the user's home directory. | |
| LLVM_ABI bool | user_config_directory (SmallVectorImpl< char > &result) |
| Get the directory where packages should read user-specific configurations. | |
| LLVM_ABI bool | cache_directory (SmallVectorImpl< char > &result) |
| Get the directory where installed packages should put their machine-local cache, e.g. | |
| LLVM_ABI bool | has_root_name (const Twine &path, Style style=Style::native) |
| Has root name? | |
| LLVM_ABI bool | has_root_directory (const Twine &path, Style style=Style::native) |
| Has root directory? | |
| LLVM_ABI bool | has_root_path (const Twine &path, Style style=Style::native) |
| Has root path? | |
| LLVM_ABI bool | has_relative_path (const Twine &path, Style style=Style::native) |
| Has relative path? | |
| LLVM_ABI bool | has_parent_path (const Twine &path, Style style=Style::native) |
| Has parent path? | |
| LLVM_ABI bool | has_filename (const Twine &path, Style style=Style::native) |
| Has filename? | |
| LLVM_ABI bool | has_stem (const Twine &path, Style style=Style::native) |
| Has stem? | |
| LLVM_ABI bool | has_extension (const Twine &path, Style style=Style::native) |
| Has extension? | |
| LLVM_ABI bool | is_absolute (const Twine &path, Style style=Style::native) |
| Is path absolute? | |
| LLVM_ABI bool | is_absolute_gnu (const Twine &path, Style style=Style::native) |
| Is path absolute using GNU rules? | |
| LLVM_ABI bool | is_relative (const Twine &path, Style style=Style::native) |
| Is path relative? | |
| LLVM_ABI void | make_absolute (const Twine ¤t_directory, SmallVectorImpl< char > &path) |
| Make path an absolute path. | |
|
strong |
| void llvm::sys::path::append | ( | SmallVectorImpl< char > & | path, |
| const Twine & | a, | ||
| const Twine & | b = "", | ||
| const Twine & | c = "", | ||
| const Twine & | d = "" ) |
Append to path.
| path | Set to path + component. |
| a | The component to be appended to path. |
Definition at line 457 of file Path.cpp.
References append(), and native.
Referenced by llvm::FileCollector::addFileImpl(), llvm::lto::DTLTO::addInput(), llvm::analyzeImportedModule(), llvm::dwarf_linker::parallel::CompileUnit::analyzeImportedModule(), append(), append(), llvm::appendArchToWindowsSDKLibPath(), llvm::SPIRVNonSemanticDebugHandler::beginModule(), codegen(), llvm::cas::ondisk::UnifiedOnDiskCache::collectGarbage(), llvm::computeArchiveRelativePath(), llvm::logicalview::LVReader::createAlternativePath(), llvm::cas::ondisk::UniqueTempFile::createAndCopyFrom(), llvm::sys::fs::createUniquePath(), llvm::remarks::createYAMLParserFromMeta(), ExpandBasePaths(), llvm::cl::ExpansionContext::expandResponseFiles(), llvm::cas::ObjectStore::exportDataToFile(), llvm::object::BuildIDFetcher::fetch(), fillLineInfoFromLocation(), llvm::cl::ExpansionContext::findConfigFile(), llvm::object::MachOObjectFile::findDsymObjectMembers(), llvm::sys::Process::FindInEnvPath(), findInputFile(), findSrcDirMap(), llvm::findVCToolChainViaCommandLine(), llvm::findVCToolChainViaEnvironment(), llvm::findVCToolChainViaRegistry(), llvm::findVCToolChainViaSetupConfig(), llvm::DiagnosticLocation::getAbsolutePath(), llvm::getCachedOrDownloadArtifact(), llvm::getDebuginfodDebuginfoUrlPath(), llvm::getDebuginfodExecutableUrlPath(), llvm::getDebuginfodSourceUrlPath(), llvm::getDefaultDebuginfodCacheDirectory(), llvm::LineEditor::getDefaultHistoryPath(), llvm::dwarf_linker::parallel::CompileUnit::getDirAndFilenameFromLineTable(), llvm::dwarf_linker::parallel::CompileUnit::getFileName(), getFilename(), llvm::DWARFDebugLine::Prologue::getFileNameByIndex(), llvm::object::Archive::Child::getFullName(), llvm::unittest::getInputFileDirectory(), llvm::vfs::RedirectingFileSystem::LookupResult::getPath(), llvm::gsym::LookupResult::getSourceFile(), getStandalonePath(), llvm::getSubDirectoryPath(), getVFSEntries(), getWindows10SDKVersionFromPath(), llvm::getWindowsSDKDir(), getWindowsSDKDirViaCommandLine(), llvm::dwarf_linker::parallel::DWARFLinkerImpl::LinkContext::loadClangModule(), llvm::localCache(), llvm::vfs::RedirectingFileSystem::LookupResult::LookupResult(), make_absolute(), llvm::MachO::make_relative(), llvm::codegen::MaybeSaveStatistics(), llvm::cas::ondisk::OnDiskCASLogger::open(), llvm::cas::ondisk::OnDiskGraphDB::open(), llvm::cas::ondisk::OnDiskKeyValueDB::open(), llvm::cas::ondisk::UnifiedOnDiskCache::open(), llvm::SourceMgr::OpenIncludeFile(), llvm::unittest::TempDir::path(), llvm::pruneCache(), llvm::orc::PathResolver::realpathCached(), llvm::sys::fs::directory_entry::replace_filename(), llvm::dwarf_linker::classic::CachedPathResolver::resolve(), llvm::orc::SearchPathResolver::resolve(), llvm::resolveRelativeObjectPath(), resolveRelativeObjectPath(), llvm::AMDGPUSplitModulePass::run(), llvm::pdb::NativeSession::searchForPdb(), llvm::MCContext::setGenDwarfRootFile(), llvm::useUniversalCRT(), llvm::cas::ondisk::UnifiedOnDiskCache::validateIfNeeded(), and llvm::ThinLTOCodeGenerator::writeGeneratedObject().
| void llvm::sys::path::append | ( | SmallVectorImpl< char > & | path, |
| const_iterator | begin, | ||
| const_iterator | end, | ||
| Style | style = Style::native ) |
| void llvm::sys::path::append | ( | SmallVectorImpl< char > & | path, |
| Style | style, | ||
| const Twine & | a, | ||
| const Twine & | b = "", | ||
| const Twine & | c = "", | ||
| const Twine & | d = "" ) |
Definition at line 419 of file Path.cpp.
References llvm::StringRef::begin(), llvm::StringRef::end(), has_root_name(), is_separator(), llvm::Twine::isTriviallyEmpty(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), and llvm::Twine::toStringRef().
| const_iterator llvm::sys::path::begin | ( | StringRef path | LLVM_LIFETIME_BOUND, |
| Style | style = Style::native ) |
Get begin iterator over path.
| path | Input path. |
Definition at line 227 of file Path.cpp.
Referenced by append(), llvm::computeArchiveRelativePath(), llvm::vfs::RedirectingFileSystem::create(), llvm::vfs::RedirectingFileSystem::lookupPath(), llvm::MachO::make_relative(), pathHasTraversal(), remove_leading_dotslash(), root_directory(), root_name(), and root_path().
| LLVM_ABI bool llvm::sys::path::cache_directory | ( | SmallVectorImpl< char > & | result | ) |
Get the directory where installed packages should put their machine-local cache, e.g.
$XDG_CACHE_HOME.
| result | Holds the resulting path name. |
References LLVM_ABI, and native.
Referenced by llvm::getDefaultDebuginfodCacheDirectory().
| std::string llvm::sys::path::convert_to_slash | ( | StringRef | path, |
| Style | style = Style::native ) |
Replaces backslashes with slashes if Windows.
| path | processed path |
Definition at line 575 of file Path.cpp.
References is_style_posix(), and llvm::replace().
Referenced by llvm::TarWriter::append(), llvm::computeArchiveRelativePath(), llvm::logicalview::LVReader::createAlternativePath(), llvm::getDebuginfodSourceUrlPath(), searchForExe(), and uriFromAbsolutePath().
| const_iterator llvm::sys::path::end | ( | StringRef path | LLVM_LIFETIME_BOUND | ) |
Get end iterator over path.
| path | Input path. |
Definition at line 236 of file Path.cpp.
Referenced by append(), llvm::computeArchiveRelativePath(), llvm::vfs::RedirectingFileSystem::create(), llvm::vfs::RedirectingFileSystem::lookupPath(), llvm::MachO::make_relative(), pathHasTraversal(), remove_leading_dotslash(), root_directory(), root_name(), and root_path().
| StringRef llvm::sys::path::extension | ( | StringRef path | LLVM_LIFETIME_BOUND, |
| Style | style = Style::native ) |
Get extension.
If filename contains a dot but not solely one or two dots, result is the substring of filename starting at (and including) the last dot, and ending at the end of path. Otherwise "".
| path | Input path. |
Definition at line 597 of file Path.cpp.
References filename(), llvm::StringRef::find_last_of(), llvm::StringRef::npos, llvm::StringRef::size(), and llvm::StringRef::substr().
Referenced by llvm::DWARFContext::dump(), llvm::object::MachOObjectFile::findDsymObjectMembers(), llvm::pdb::PDBSymbolCompiland::getSourceFileFullPath(), has_extension(), rend(), and replace_extension().
| StringRef llvm::sys::path::filename | ( | StringRef path | LLVM_LIFETIME_BOUND, |
| Style | style = Style::native ) |
Get filename.
| path | Input path. |
Definition at line 584 of file Path.cpp.
References rbegin().
Referenced by llvm::lto::DTLTO::addInput(), llvm::lto::Config::addSaveTemps(), llvm::vfs::RedirectingFileSystem::create(), llvm::logicalview::LVReader::createAlternativePath(), llvm::objcopy::coff::createGnuDebugLinkSectionContents(), llvm::AsmPrinter::doInitialization(), llvm::emitSourceFileHeader(), llvm::objcopy::macho::executeObjcopyOnBinary(), llvm::ModuleSummaryIndex::exportToDot(), extension(), llvm::findVCToolChainViaEnvironment(), getAllDBDirs(), llvm::dwarf_linker::parallel::CompileUnit::getFileName(), llvm::orc::LibraryInfo::getFileName(), llvm::DWARFDebugLine::Prologue::getFileNameByIndex(), getHighestNumericTupleInDirectory(), llvm::pdb::PDBSymbolCompiland::getSourceFileName(), has_filename(), llvm::gsym::GsymCreator::insertFile(), llvm::dwarf_linker::classic::DWARFLinker::link(), mangleCoveragePath(), llvm::codegen::MaybeSaveStatistics(), llvm::dwarf_linker::parallel::DWARFLinkerImpl::printStatistic(), llvm::pruneCache(), llvm::MachO::replace_extension(), llvm::dwarf_linker::classic::CachedPathResolver::resolve(), llvm::CtxProfAnalysis::run(), llvm::pdb::NativeSession::searchForPdb(), stem(), llvm::timeTraceProfilerInitialize(), llvm::MCDwarfLineTableHeader::tryGetFile(), and llvm::object::writeImportLibrary().
| StringRef llvm::sys::path::get_separator | ( | Style | style = Style::native | ) |
Return the preferred separator for this platform.
Definition at line 616 of file Path.cpp.
References windows.
Referenced by llvm::cas::ondisk::UnifiedOnDiskCache::close(), llvm::orc::createComponent(), EmitGenDwarfInfo(), and llvm::orc::PathResolver::realpathCached().
| bool llvm::sys::path::has_extension | ( | const Twine & | path, |
| Style | style = Style::native ) |
Has extension?
extension != ""
| path | Input path. |
Definition at line 671 of file Path.cpp.
References llvm::StringRef::empty(), and extension().
| bool llvm::sys::path::has_filename | ( | const Twine & | path, |
| Style | style = Style::native ) |
Has filename?
filename != ""
| path | Input path. |
Definition at line 650 of file Path.cpp.
References llvm::StringRef::empty(), and filename().
| bool llvm::sys::path::has_parent_path | ( | const Twine & | path, |
| Style | style = Style::native ) |
Has parent path?
parent_path != ""
| path | Input path. |
Definition at line 657 of file Path.cpp.
References llvm::StringRef::empty(), and parent_path().
Referenced by llvm::cl::ExpansionContext::findConfigFile().
| bool llvm::sys::path::has_relative_path | ( | const Twine & | path, |
| Style | style = Style::native ) |
Has relative path?
relative_path != ""
| path | Input path. |
Definition at line 643 of file Path.cpp.
References llvm::StringRef::empty(), and relative_path().
| bool llvm::sys::path::has_root_directory | ( | const Twine & | path, |
| Style | style = Style::native ) |
Has root directory?
root_directory != ""
| path | Input path. |
Definition at line 629 of file Path.cpp.
References llvm::StringRef::empty(), and root_directory().
Referenced by is_absolute(), and make_absolute().
| bool llvm::sys::path::has_root_name | ( | const Twine & | path, |
| Style | style = Style::native ) |
Has root name?
root_name != ""
| path | Input path. |
Definition at line 622 of file Path.cpp.
References llvm::StringRef::empty(), and root_name().
Referenced by append(), is_absolute(), and make_absolute().
| bool llvm::sys::path::has_root_path | ( | const Twine & | path, |
| Style | style = Style::native ) |
Has root path?
root_path != ""
| path | Input path. |
Definition at line 636 of file Path.cpp.
References llvm::StringRef::empty(), and root_path().
| bool llvm::sys::path::has_stem | ( | const Twine & | path, |
| Style | style = Style::native ) |
Has stem?
stem != ""
| path | Input path. |
Definition at line 664 of file Path.cpp.
References llvm::StringRef::empty(), and stem().
| LLVM_ABI bool llvm::sys::path::home_directory | ( | SmallVectorImpl< char > & | result | ) |
Get the user's home directory.
| result | Holds the resulting path name. |
References LLVM_ABI.
Referenced by llvm::orc::createComponent(), llvm::LineEditor::getDefaultHistoryPath(), and native().
| bool llvm::sys::path::is_absolute | ( | const Twine & | path, |
| Style | style = Style::native ) |
Is path absolute?
According to cppreference.com, C++17 states: "An absolute path is a path that unambiguously identifies the location of a file without reference to an additional starting location."
In other words, the rules are: 1) POSIX style paths with nonempty root directory are absolute. 2) Windows style paths with nonempty root name and root directory are absolute. 3) No other paths are absolute.
| path | Input path. |
Definition at line 678 of file Path.cpp.
References has_root_directory(), has_root_name(), and is_style_posix().
Referenced by llvm::SPIRVNonSemanticDebugHandler::beginModule(), llvm::sys::fs::createUniquePath(), ExpandBasePaths(), llvm::FileCollector::FileCollector(), llvm::sys::Process::FindInEnvPath(), llvm::DiagnosticLocation::getAbsolutePath(), llvm::object::Archive::Child::getFullName(), llvm::pdb::PDBSymbolCompiland::getSourceFileFullPath(), is_relative(), isPathAbsoluteOnWindowsOrPosix(), llvm::dwarf_linker::isPathAbsoluteOnWindowsOrPosix(), llvm::sys::fs::make_absolute(), llvm::vfs::FileSystem::makeAbsolute(), llvm::vfs::RedirectingFileSystem::makeAbsolute(), and llvm::orc::DylibResolverImpl::resolve().
| bool llvm::sys::path::is_absolute_gnu | ( | const Twine & | path, |
| Style | style = Style::native ) |
Is path absolute using GNU rules?
GNU rules are: 1) Paths starting with a path separator are absolute. 2) Windows style paths are also absolute if they start with a character followed by ':'. 3) No other paths are absolute.
On Windows style the path "C:\Users\Default" has "C:" as root name and "\" as root directory. Hence "C:" on Windows is absolute under GNU rules and not absolute under C++17 because it has no root directory. Likewise "/" and "" on Windows are absolute under GNU and are not absolute under C++17 due to empty root name.
| path | Input path. |
| style | The style of path (e.g. Windows or POSIX). "native" style means to derive the style from the host. |
Definition at line 688 of file Path.cpp.
References is_separator(), and is_style_windows().
| bool llvm::sys::path::is_relative | ( | const Twine & | path, |
| Style | style = Style::native ) |
Is path relative?
| path | Input path. |
Definition at line 706 of file Path.cpp.
References is_absolute().
Referenced by llvm::analyzeImportedModule(), llvm::dwarf_linker::parallel::CompileUnit::analyzeImportedModule(), llvm::cl::ExpansionContext::expandResponseFiles(), llvm::cl::ExpansionContext::findConfigFile(), llvm::libDriverMain(), llvm::dwarf_linker::parallel::DWARFLinkerImpl::LinkContext::loadClangModule(), llvm::cl::ExpansionContext::readConfigFile(), and llvm::orc::PathResolver::realpathCached().
| 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.
| value | a character |
Definition at line 608 of file Path.cpp.
References is_style_windows().
Referenced by append(), llvm::orc::createComponent(), llvm::orc::DumpObjects::DumpObjects(), is_absolute_gnu(), isNetworkPath(), native(), llvm::sys::path::const_iterator::operator++(), llvm::sys::path::reverse_iterator::operator++(), remove_leading_dotslash(), root_directory(), root_name(), root_path(), llvm::MCContext::setGenDwarfRootFile(), starts_with(), and llvm::stripDirPrefix().
Check if S uses POSIX path rules.
Definition at line 37 of file Path.h.
Referenced by convert_to_slash(), is_absolute(), is_style_windows(), and make_absolute().
Check if S uses Windows path rules.
Definition at line 50 of file Path.h.
References is_style_posix().
Referenced by is_absolute_gnu(), is_separator(), make_preferred(), native(), llvm::sys::path::const_iterator::operator++(), root_directory(), root_name(), root_path(), and starts_with().
| void llvm::sys::path::make_absolute | ( | const Twine & | current_directory, |
| 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
| path | A path that is modified to be an absolute path. |
Definition at line 710 of file Path.cpp.
References append(), llvm::StringRef::begin(), llvm::StringRef::end(), has_root_directory(), has_root_name(), is_style_posix(), llvm_unreachable, native, relative_path(), root_directory(), root_name(), and llvm::Twine::toVector().
Referenced by llvm::sys::fs::make_absolute(), and llvm::vfs::FileSystem::makeAbsolute().
|
inline |
For Windows path styles, convert path to use the preferred path separators.
For other styles, do nothing.
| path | A path that is transformed to preferred format. |
Definition at line 286 of file Path.h.
References is_style_windows(), and native.
Referenced by remove_dots().
| void llvm::sys::path::native | ( | const Twine & | path, |
| SmallVectorImpl< char > & | result, | ||
| Style | style = Style::native ) |
Convert path to the native form.
This is used to give paths to users and operating system calls in the platform's normal way. For example, on Windows all '/' are converted to '\'. On Unix, it converts all '\' to '/'.
| path | A path that is transformed to native format. |
| result | Holds the result of the transformation. |
Definition at line 541 of file Path.cpp.
References assert(), llvm::SmallVectorImpl< T >::clear(), llvm::SmallVectorTemplateCommon< T, typename >::data(), and native.
Convert path to the native form and return it as a std::string.
This is used to give paths to users and operating system calls in the platform's normal way. For example, on Windows all '/' are converted to '\'. On Unix, it converts all '\' to '/'.
| path | A path that is transformed to native format. |
Definition at line 551 of file Path.cpp.
References native.
| void llvm::sys::path::native | ( | SmallVectorImpl< char > & | path, |
| Style | style = Style::native ) |
Convert path to the native form in place.
This is used to give paths to users and operating system calls in the platform's normal way. For example, on Windows all '/' are converted to '\'.
| path | A path that is transformed to native format. |
Definition at line 557 of file Path.cpp.
References llvm::SmallString< InternalLen >::append(), home_directory(), is_separator(), is_style_windows(), and llvm::replace().
| StringRef llvm::sys::path::parent_path | ( | StringRef path | LLVM_LIFETIME_BOUND, |
| Style | style = Style::native ) |
Get parent path.
| path | Input path. |
Definition at line 468 of file Path.cpp.
References llvm::StringRef::npos.
Referenced by llvm::lto::DTLTO::addInput(), llvm::computeArchiveRelativePath(), llvm::FileCollector::copyFiles(), llvm::vfs::RedirectingFileSystem::create(), llvm::vfs::RedirectingFileSystem::create(), llvm::sys::fs::create_directories(), llvm::logicalview::LVReader::createAlternativePath(), createDirectoriesOnDemand(), llvm::cas::ObjectStore::exportDataToFile(), findSrcDirMap(), llvm::findVCToolChainViaEnvironment(), llvm::orc::LibraryInfo::getBasePath(), llvm::pdb::PDBFile::getFileDirectory(), llvm::dwarf_linker::parallel::CompileUnit::getFileName(), llvm::object::Archive::Child::getFullName(), llvm::lto::getThinLTOOutputFile(), has_parent_path(), llvm::gsym::GsymCreator::insertFile(), llvm::MachO::make_relative(), prepareDumpIRFileDescriptor(), llvm::MachO::replace_extension(), llvm::sys::fs::directory_entry::replace_filename(), llvm::dwarf_linker::classic::CachedPathResolver::resolve(), llvm::MachO::shouldSkipSymLink(), llvm::MCDwarfLineTableHeader::tryGetFile(), and llvm::LockFileManager::tryLock().
| LLVM_ABI reverse_iterator llvm::sys::path::rbegin | ( | StringRef path | LLVM_LIFETIME_BOUND, |
| Style | style = Style::native ) |
Get reverse begin iterator over path.
| path | Input path. |
References LLVM_ABI, LLVM_LIFETIME_BOUND, and native.
Referenced by filename(), llvm::findVCToolChainViaEnvironment(), llvm::dwarf_linker::guessDeveloperDir(), and llvm::dwarf_linker::isInToolchainDir().
| reverse_iterator llvm::sys::path::rbegin | ( | StringRef | Path, |
| Style | style ) |
| StringRef llvm::sys::path::relative_path | ( | StringRef path | LLVM_LIFETIME_BOUND, |
| Style | style = Style::native ) |
Get relative path.
| path | Input path. |
Definition at line 414 of file Path.cpp.
References root_path(), and llvm::StringRef::size().
Referenced by llvm::FileCollector::addFileImpl(), has_relative_path(), and make_absolute().
| bool llvm::sys::path::remove_dots | ( | SmallVectorImpl< char > & | path, |
| bool | remove_dot_dot = false, | ||
| Style | style = Style::native ) |
Remove '.
/' and optionally '../' components, and canonicalize separators.
| path | processed path. |
| remove_dot_dot | specify if '../' (except for leading "../") should be removed. |
Definition at line 769 of file Path.cpp.
References llvm::ArrayRef(), llvm::SmallVectorTemplateCommon< T, typename >::back(), llvm::CallingConv::C, llvm::SmallVectorTemplateCommon< T, typename >::data(), llvm::StringRef::drop_front(), llvm::SmallVectorTemplateCommon< T, typename >::empty(), llvm::StringRef::empty(), llvm::StringRef::find_first_of(), llvm::StringRef::front(), make_preferred(), llvm::StringRef::npos, llvm::SmallVectorTemplateBase< T, bool >::pop_back(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), root_path(), llvm::SmallVectorTemplateCommon< T, typename >::size(), llvm::StringRef::size(), llvm::SmallVectorImpl< T >::swap(), and llvm::StringRef::take_front().
Referenced by llvm::FileCollector::PathCanonicalizer::canonicalize(), llvm::canonicalizePath(), llvm::object::MachOObjectFile::findDsymObjectMembers(), llvm::vfs::InMemoryFileSystem::getRealPath(), and llvm::vfs::InMemoryFileSystem::setCurrentWorkingDirectory().
| 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.
Similar to the POSIX "dirname" utility.
| path | A path that is modified to not have a file component. |
Definition at line 475 of file Path.cpp.
References llvm::StringRef::npos.
Referenced by llvm::cas::ondisk::UnifiedOnDiskCache::collectGarbage(), llvm::orc::DylibSubstitutor::configure(), llvm::codegen::MaybeSaveStatistics(), llvm::pdb::NativeSession::searchForPdb(), llvm::MCContext::setGenDwarfRootFile(), and llvm::cas::ondisk::UnifiedOnDiskCache::validateIfNeeded().
| LLVM_ABI StringRef llvm::sys::path::remove_leading_dotslash | ( | StringRef path | LLVM_LIFETIME_BOUND, |
| Style | style = Style::native ) |
Remove redundant leading "./" pieces and consecutive separators.
| path | Input path. |
References begin(), end(), LLVM_ABI, LLVM_LIFETIME_BOUND, and native.
Referenced by llvm::BasicBlockSectionsProfileReaderWrapperPass::doInitialization(), llvm::DiagnosticLocation::getAbsolutePath(), and makeAbsolute().
Definition at line 759 of file Path.cpp.
References is_separator().
| LLVM_ABI reverse_iterator llvm::sys::path::rend | ( | StringRef path | LLVM_LIFETIME_BOUND | ) |
Get reverse end iterator over path.
| path | Input path. |
References extension(), LLVM_ABI, LLVM_LIFETIME_BOUND, and native.
Referenced by llvm::findVCToolChainViaEnvironment(), llvm::dwarf_linker::guessDeveloperDir(), and llvm::dwarf_linker::isInToolchainDir().
| reverse_iterator llvm::sys::path::rend | ( | StringRef | Path | ) |
| void llvm::sys::path::replace_extension | ( | SmallVectorImpl< char > & | path, |
| const Twine & | extension, | ||
| Style | style = Style::native ) |
Replace the file extension of path with extension.
| path | A path that has its extension replaced with extension. |
| extension | The extension to be added. It may be empty. It may also optionally start with a '.', if it does not, one will be prepended. |
Definition at line 481 of file Path.cpp.
References llvm::StringRef::begin(), llvm::StringRef::end(), extension(), llvm::StringRef::npos, and llvm::StringRef::size().
Referenced by getDefaultOutputPath(), llvm::codegen::MaybeSaveStatistics(), llvm::MachO::replace_extension(), searchForExe(), searchForObj(), and llvm::TableGenMain().
| 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.
| Path | If Path starts with OldPrefix modify to instead start with NewPrefix. |
| OldPrefix | The path prefix to strip from Path. |
| NewPrefix | The path prefix to replace NewPrefix with. |
| style | The style used to match the prefix. Exact match using Posix style, case/separator insensitive match for Windows style. |
Definition at line 519 of file Path.cpp.
References llvm::copy(), llvm::StringRef::empty(), llvm::StringRef::size(), starts_with(), and llvm::StringRef::substr().
Referenced by llvm::lto::getThinLTOOutputFile(), llvm::MCContext::remapDebugPath(), llvm::remapPath(), and remapPath().
| StringRef llvm::sys::path::root_directory | ( | StringRef path | LLVM_LIFETIME_BOUND, |
| Style | style = Style::native ) |
Get root directory.
| path | Input path. |
Definition at line 391 of file Path.cpp.
References begin(), end(), is_separator(), and is_style_windows().
Referenced by has_root_directory(), and make_absolute().
| StringRef llvm::sys::path::root_name | ( | StringRef path | LLVM_LIFETIME_BOUND, |
| Style | style = Style::native ) |
Get root name.
| path | Input path. |
Definition at line 374 of file Path.cpp.
References begin(), end(), is_separator(), and is_style_windows().
Referenced by llvm::computeArchiveRelativePath(), has_root_name(), make_absolute(), and uriFromAbsolutePath().
| StringRef llvm::sys::path::root_path | ( | StringRef path | LLVM_LIFETIME_BOUND, |
| Style | style = Style::native ) |
Get root path.
Equivalent to root_name + root_directory.
| path | Input path. |
Definition at line 349 of file Path.cpp.
References begin(), end(), is_separator(), and is_style_windows().
Referenced by has_root_path(), relative_path(), and remove_dots().
|
static |
Definition at line 500 of file Path.cpp.
References I, is_separator(), is_style_windows(), native, and llvm::toLower().
Referenced by replace_path_prefix().
| StringRef llvm::sys::path::stem | ( | StringRef path | LLVM_LIFETIME_BOUND, |
| Style | style = Style::native ) |
Get stem.
If filename contains a dot but not solely one or two dots, result is the substring of filename ending at (but not including) the last dot. Otherwise it is filename.
| path | Input path. |
Definition at line 586 of file Path.cpp.
References filename(), llvm::StringRef::find_last_of(), llvm::StringRef::npos, llvm::StringRef::size(), and llvm::StringRef::substr().
Referenced by llvm::TargetLoweringObjectFileGOFF::getModuleMetadata(), has_stem(), and llvm::TableGenMain().
| LLVM_ABI void llvm::sys::path::system_temp_directory | ( | bool | erasedOnReboot, |
| SmallVectorImpl< char > & | result ) |
Get the typical temporary directory for the system, e.g., "/var/tmp" or "C:/TEMP".
| erasedOnReboot | Whether to favor a path that is erased on reboot rather than one that potentially persists longer. This parameter will be ignored if the user or system has set the typical environment variable (e.g., TEMP on Windows, TMPDIR on *nix) to specify a temporary directory. |
| result | Holds the resulting path name. |
References LLVM_ABI.
Referenced by llvm::sys::fs::createUniquePath(), and llvm::AMDGPUSplitModulePass::run().
| LLVM_ABI bool llvm::sys::path::user_config_directory | ( | SmallVectorImpl< char > & | result | ) |
Get the directory where packages should read user-specific configurations.
e.g. $XDG_CONFIG_HOME.
| result | Holds the resulting path name. |
References LLVM_ABI.