LLVM 20.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. | |
static bool | starts_with (StringRef Path, StringRef Prefix, Style style=Style::native) |
Lexical Component Iterator | |
const_iterator | begin (StringRef path, Style style=Style::native) |
Get begin iterator over path. | |
const_iterator | end (StringRef path) |
Get end iterator over path. | |
reverse_iterator | rbegin (StringRef path, Style style=Style::native) |
Get reverse begin iterator over path. | |
reverse_iterator | rend (StringRef path) |
Get reverse end iterator over path. | |
Lexical Modifiers | |
void | remove_filename (SmallVectorImpl< char > &path, Style style=Style::native) |
Remove the last component from path unless it is the root dir. | |
void | replace_extension (SmallVectorImpl< char > &path, const Twine &extension, Style style=Style::native) |
Replace the file extension of path with extension. | |
bool | replace_path_prefix (SmallVectorImpl< char > &Path, StringRef OldPrefix, StringRef NewPrefix, Style style=Style::native) |
Replace matching path prefix with another path. | |
StringRef | remove_leading_dotslash (StringRef path, Style style=Style::native) |
Remove redundant leading "./" pieces and consecutive separators. | |
bool | remove_dots (SmallVectorImpl< char > &path, bool remove_dot_dot=false, Style style=Style::native) |
In-place remove any '. | |
void | append (SmallVectorImpl< char > &path, const Twine &a, const Twine &b="", const Twine &c="", const Twine &d="") |
Append to path. | |
void | append (SmallVectorImpl< char > &path, Style style, const Twine &a, const Twine &b="", const Twine &c="", const Twine &d="") |
void | append (SmallVectorImpl< char > &path, const_iterator begin, const_iterator end, Style style=Style::native) |
Append to path. | |
Transforms (or some other better name) | |
void | native (const Twine &path, SmallVectorImpl< char > &result, Style style=Style::native) |
Convert path to the native form. | |
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. | |
std::string | convert_to_slash (StringRef path, Style style=Style::native) |
Replaces backslashes with slashes if Windows. | |
Lexical Observers | |
StringRef | root_name (StringRef path, Style style=Style::native) |
Get root name. | |
StringRef | root_directory (StringRef path, Style style=Style::native) |
Get root directory. | |
StringRef | root_path (StringRef path, Style style=Style::native) |
Get root path. | |
StringRef | relative_path (StringRef path, Style style=Style::native) |
Get relative path. | |
StringRef | parent_path (StringRef path, Style style=Style::native) |
Get parent path. | |
StringRef | filename (StringRef path, Style style=Style::native) |
Get filename. | |
StringRef | stem (StringRef path, Style style=Style::native) |
Get stem. | |
StringRef | extension (StringRef path, Style style=Style::native) |
Get extension. | |
bool | is_separator (char value, Style style=Style::native) |
Check whether the given char is a path separator on the host OS. | |
StringRef | get_separator (Style style=Style::native) |
Return the preferred separator for this platform. | |
void | system_temp_directory (bool erasedOnReboot, SmallVectorImpl< char > &result) |
Get the typical temporary directory for the system, e.g., "/var/tmp" or "C:/TEMP". | |
bool | home_directory (SmallVectorImpl< char > &result) |
Get the user's home directory. | |
bool | user_config_directory (SmallVectorImpl< char > &result) |
Get the directory where packages should read user-specific configurations. | |
bool | cache_directory (SmallVectorImpl< char > &result) |
Get the directory where installed packages should put their machine-local cache, e.g. | |
bool | has_root_name (const Twine &path, Style style=Style::native) |
Has root name? | |
bool | has_root_directory (const Twine &path, Style style=Style::native) |
Has root directory? | |
bool | has_root_path (const Twine &path, Style style=Style::native) |
Has root path? | |
bool | has_relative_path (const Twine &path, Style style=Style::native) |
Has relative path? | |
bool | has_parent_path (const Twine &path, Style style=Style::native) |
Has parent path? | |
bool | has_filename (const Twine &path, Style style=Style::native) |
Has filename? | |
bool | has_stem (const Twine &path, Style style=Style::native) |
Has stem? | |
bool | has_extension (const Twine &path, Style style=Style::native) |
Has extension? | |
bool | is_absolute (const Twine &path, Style style=Style::native) |
Is path absolute? | |
bool | is_absolute_gnu (const Twine &path, Style style=Style::native) |
Is path absolute using GNU rules? | |
bool | is_relative (const Twine &path, Style style=Style::native) |
Is path relative? | |
|
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::dwarf_linker::parallel::CompileUnit::analyzeImportedModule(), llvm::analyzeImportedModule(), append(), llvm::appendArchToWindowsSDKLibPath(), codegen(), llvm::computeArchiveRelativePath(), llvm::logicalview::LVReader::createAlternativePath(), llvm::sys::fs::createUniquePath(), llvm::remarks::createYAMLParserFromMeta(), ExpandBasePaths(), llvm::cl::ExpansionContext::expandResponseFiles(), llvm::object::BuildIDFetcher::fetch(), 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(), getFilename(), llvm::dwarf_linker::parallel::CompileUnit::getFileName(), llvm::DWARFDebugLine::Prologue::getFileNameByIndex(), llvm::object::Archive::Child::getFullName(), llvm::unittest::getInputFileDirectory(), llvm::vfs::RedirectingFileSystem::LookupResult::getPath(), llvm::gsym::LookupResult::getSourceFile(), llvm::getSubDirectoryPath(), getVFSEntries(), getWindows10SDKVersionFromPath(), llvm::getWindowsSDKDir(), getWindowsSDKDirViaCommandLine(), llvm::dwarf_linker::parallel::DWARFLinkerImpl::LinkContext::loadClangModule(), llvm::localCache(), llvm::vfs::RedirectingFileSystem::LookupResult::LookupResult(), llvm::sys::fs::make_absolute(), llvm::MachO::make_relative(), llvm::SourceMgr::OpenIncludeFile(), llvm::unittest::TempDir::path(), llvm::pruneCache(), llvm::sys::fs::directory_entry::replace_filename(), llvm::dwarf_linker::classic::CachedPathResolver::resolve(), llvm::resolveRelativeObjectPath(), resolveRelativeObjectPath(), llvm::pdb::NativeSession::searchForPdb(), llvm::MCContext::setGenDwarfRootFile(), llvm::useUniversalCRT(), 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::SmallVectorImpl< T >::append(), llvm::StringRef::begin(), llvm::SmallVectorBase< Size_T >::empty(), llvm::StringRef::end(), has_root_name(), is_separator(), llvm::Twine::isTriviallyEmpty(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::SmallVectorBase< Size_T >::size(), and llvm::Twine::toStringRef().
const_iterator llvm::sys::path::begin | ( | StringRef | path, |
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(), root_directory(), root_name(), and root_path().
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. |
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 569 of file Path.cpp.
References is_style_posix(), and llvm::StringRef::str().
Referenced by llvm::TarWriter::append(), llvm::computeArchiveRelativePath(), llvm::logicalview::LVReader::createAlternativePath(), llvm::getDebuginfodSourceUrlPath(), and searchForExe().
const_iterator llvm::sys::path::end | ( | StringRef | path | ) |
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(), root_directory(), root_name(), and root_path().
StringRef llvm::sys::path::extension | ( | StringRef | path, |
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 591 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(), and replace_extension().
StringRef llvm::sys::path::filename | ( | StringRef | path, |
Style | style = Style::native |
||
) |
Get filename.
path | Input path. |
Definition at line 578 of file Path.cpp.
References rbegin().
Referenced by llvm::vfs::RedirectingFileSystem::create(), llvm::logicalview::LVReader::createAlternativePath(), llvm::objcopy::coff::createGnuDebugLinkSectionContents(), llvm::Module::createRNG(), llvm::AsmPrinter::doInitialization(), llvm::emitSourceFileHeader(), llvm::objcopy::macho::executeObjcopyOnBinary(), llvm::ModuleSummaryIndex::exportToDot(), extension(), llvm::findVCToolChainViaEnvironment(), llvm::dwarf_linker::parallel::CompileUnit::getFileName(), llvm::DWARFDebugLine::Prologue::getFileNameByIndex(), getHighestNumericTupleInDirectory(), llvm::pdb::PDBSymbolCompiland::getSourceFileName(), has_filename(), llvm::gsym::GsymCreator::insertFile(), llvm::dwarf_linker::classic::DWARFLinker::link(), mangleCoveragePath(), llvm::dwarf_linker::parallel::DWARFLinkerImpl::printStatistic(), llvm::pruneCache(), llvm::MachO::replace_extension(), llvm::dwarf_linker::classic::CachedPathResolver::resolve(), 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 610 of file Path.cpp.
References windows.
Referenced by EmitGenDwarfInfo().
bool llvm::sys::path::has_extension | ( | const Twine & | path, |
Style | style = Style::native |
||
) |
Has extension?
extension != ""
path | Input path. |
Definition at line 665 of file Path.cpp.
References llvm::StringRef::empty(), extension(), and llvm::Twine::toStringRef().
bool llvm::sys::path::has_filename | ( | const Twine & | path, |
Style | style = Style::native |
||
) |
Has filename?
filename != ""
path | Input path. |
Definition at line 644 of file Path.cpp.
References llvm::StringRef::empty(), filename(), and llvm::Twine::toStringRef().
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 651 of file Path.cpp.
References llvm::StringRef::empty(), parent_path(), and llvm::Twine::toStringRef().
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 637 of file Path.cpp.
References llvm::StringRef::empty(), relative_path(), and llvm::Twine::toStringRef().
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 623 of file Path.cpp.
References llvm::StringRef::empty(), root_directory(), and llvm::Twine::toStringRef().
Referenced by is_absolute(), and llvm::sys::fs::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 616 of file Path.cpp.
References llvm::StringRef::empty(), root_name(), and llvm::Twine::toStringRef().
Referenced by append(), is_absolute(), and llvm::sys::fs::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 630 of file Path.cpp.
References llvm::StringRef::empty(), root_path(), and llvm::Twine::toStringRef().
bool llvm::sys::path::has_stem | ( | const Twine & | path, |
Style | style = Style::native |
||
) |
Has stem?
stem != ""
path | Input path. |
Definition at line 658 of file Path.cpp.
References llvm::StringRef::empty(), stem(), and llvm::Twine::toStringRef().
bool llvm::sys::path::home_directory | ( | SmallVectorImpl< char > & | result | ) |
Get the user's home directory.
result | Holds the resulting path name. |
Referenced by 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 672 of file Path.cpp.
References has_root_directory(), has_root_name(), is_style_posix(), and llvm::Twine::toStringRef().
Referenced by 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(), llvm::dwarf_linker::isPathAbsoluteOnWindowsOrPosix(), isPathAbsoluteOnWindowsOrPosix(), llvm::sys::fs::make_absolute(), llvm::vfs::FileSystem::makeAbsolute(), and llvm::vfs::RedirectingFileSystem::makeAbsolute().
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 682 of file Path.cpp.
References is_separator(), is_style_windows(), and llvm::Twine::toStringRef().
bool llvm::sys::path::is_relative | ( | const Twine & | path, |
Style | style = Style::native |
||
) |
Is path relative?
path | Input path. |
Definition at line 700 of file Path.cpp.
References is_absolute().
Referenced by llvm::dwarf_linker::parallel::CompileUnit::analyzeImportedModule(), llvm::analyzeImportedModule(), llvm::cl::ExpansionContext::expandResponseFiles(), llvm::cl::ExpansionContext::findConfigFile(), llvm::libDriverMain(), llvm::dwarf_linker::parallel::DWARFLinkerImpl::LinkContext::loadClangModule(), and llvm::cl::ExpansionContext::readConfigFile().
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 602 of file Path.cpp.
References is_separator(), is_style_windows(), and value.
Referenced by append(), llvm::orc::DumpObjects::DumpObjects(), is_absolute_gnu(), is_separator(), 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 36 of file Path.h.
Referenced by convert_to_slash(), is_absolute(), and is_style_windows().
Check if S
uses Windows path rules.
Definition at line 49 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().
|
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 269 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(), llvm::StringRef::data(), llvm::Twine::getSingleStringRef(), llvm::Twine::isSingleStringRef(), native, and llvm::Twine::toVector().
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 551 of file Path.cpp.
References llvm::SmallString< InternalLen >::append(), home_directory(), is_separator(), and is_style_windows().
StringRef llvm::sys::path::parent_path | ( | StringRef | path, |
Style | style = Style::native |
||
) |
Get parent path.
path | Input path. |
Definition at line 468 of file Path.cpp.
References llvm::StringRef::npos, and llvm::StringRef::substr().
Referenced by llvm::computeArchiveRelativePath(), llvm::FileCollector::copyFiles(), llvm::vfs::RedirectingFileSystem::create(), llvm::sys::fs::create_directories(), llvm::logicalview::LVReader::createAlternativePath(), findSrcDirMap(), llvm::findVCToolChainViaEnvironment(), 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(), printSymbolizedStackTrace(), llvm::MachO::replace_extension(), llvm::sys::fs::directory_entry::replace_filename(), llvm::dwarf_linker::classic::CachedPathResolver::resolve(), llvm::MachO::shouldSkipSymLink(), and llvm::MCDwarfLineTableHeader::tryGetFile().
reverse_iterator llvm::sys::path::rbegin | ( | StringRef | path, |
Style | style = Style::native |
||
) |
Get reverse begin iterator over path.
path | Input path. |
Definition at line 298 of file Path.cpp.
Referenced by filename(), llvm::findVCToolChainViaEnvironment(), llvm::dwarf_linker::guessDeveloperDir(), and llvm::dwarf_linker::isInToolchainDir().
StringRef llvm::sys::path::relative_path | ( | StringRef | path, |
Style | style = Style::native |
||
) |
Get relative path.
path | Input path. |
Definition at line 414 of file Path.cpp.
References root_path(), llvm::StringRef::size(), and llvm::StringRef::substr().
Referenced by llvm::FileCollector::addFileImpl(), has_relative_path(), and llvm::sys::fs::make_absolute().
bool llvm::sys::path::remove_dots | ( | SmallVectorImpl< char > & | path, |
bool | remove_dot_dot = false , |
||
Style | style = Style::native |
||
) |
In-place remove any '.
/' and optionally '../' components from a path.
path | processed path |
remove_dot_dot | specify if '../' (except for leading "../") should be removed |
Definition at line 716 of file Path.cpp.
References llvm::SmallVectorTemplateCommon< T, typename >::back(), llvm::CallingConv::C, llvm::SmallVectorTemplateCommon< T, typename >::data(), llvm::StringRef::drop_front(), llvm::SmallVectorBase< Size_T >::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::SmallVectorBase< Size_T >::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::SmallVectorTemplateCommon< T, typename >::begin(), llvm::StringRef::npos, llvm::SmallVectorBase< Size_T >::size(), and llvm::SmallVectorImpl< T >::truncate().
Referenced by llvm::pdb::NativeSession::searchForPdb(), and llvm::MCContext::setGenDwarfRootFile().
StringRef llvm::sys::path::remove_leading_dotslash | ( | StringRef | path, |
Style | style = Style::native |
||
) |
Remove redundant leading "./" pieces and consecutive separators.
path | Input path. |
Definition at line 704 of file Path.cpp.
References is_separator().
Referenced by llvm::BasicBlockSectionsProfileReaderWrapperPass::doInitialization(), llvm::DiagnosticLocation::getAbsolutePath(), and makeAbsolute().
reverse_iterator llvm::sys::path::rend | ( | StringRef | path | ) |
Get reverse end iterator over path.
path | Input path. |
Definition at line 307 of file Path.cpp.
Referenced by llvm::findVCToolChainViaEnvironment(), llvm::dwarf_linker::guessDeveloperDir(), and llvm::dwarf_linker::isInToolchainDir().
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::SmallVectorImpl< T >::append(), llvm::SmallVectorTemplateCommon< T, typename >::begin(), llvm::StringRef::begin(), llvm::StringRef::end(), extension(), llvm::StringRef::npos, llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::SmallVectorBase< Size_T >::size(), llvm::StringRef::size(), and llvm::SmallVectorImpl< T >::truncate().
Referenced by getDefaultOutputPath(), llvm::MachO::replace_extension(), searchForExe(), and searchForObj().
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(), remapPath(), and llvm::remapPath().
StringRef llvm::sys::path::root_directory | ( | StringRef | path, |
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 llvm::sys::fs::make_absolute().
StringRef llvm::sys::path::root_name | ( | StringRef | path, |
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(), and llvm::sys::fs::make_absolute().
StringRef llvm::sys::path::root_path | ( | StringRef | path, |
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(), is_style_windows(), and llvm::StringRef::substr().
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(), and starts_with().
StringRef llvm::sys::path::stem | ( | StringRef | path, |
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 580 of file Path.cpp.
References filename(), llvm::StringRef::find_last_of(), llvm::StringRef::npos, llvm::StringRef::size(), and llvm::StringRef::substr().
Referenced by has_stem().
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. |
Referenced by llvm::sys::fs::createUniquePath().
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. |