LLVM API Documentation
Classes | |
class | const_iterator |
Path iterator. More... | |
class | reverse_iterator |
Reverse path iterator. More... | |
Functions | |
void | remove_filename (SmallVectorImpl< char > &path) |
Remove the last component from path unless it is the root dir. | |
void | replace_extension (SmallVectorImpl< char > &path, const Twine &extension) |
Replace the file extension of path with extension. | |
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, const_iterator begin, const_iterator end) |
Append to path. | |
void | native (const Twine &path, SmallVectorImpl< char > &result) |
void | native (SmallVectorImpl< char > &path) |
StringRef | root_name (StringRef path) |
Get root name. | |
StringRef | root_directory (StringRef path) |
Get root directory. | |
StringRef | root_path (StringRef path) |
Get root path. | |
StringRef | relative_path (StringRef path) |
Get relative path. | |
StringRef | parent_path (StringRef path) |
Get parent path. | |
StringRef | filename (StringRef path) |
Get filename. | |
StringRef | stem (StringRef path) |
Get stem. | |
StringRef | extension (StringRef path) |
Get extension. | |
bool | is_separator (char value) |
Check whether the given char is a path separator on the host OS. | |
StringRef | get_separator () |
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 | has_root_name (const Twine &path) |
Has root name? | |
bool | has_root_directory (const Twine &path) |
Has root directory? | |
bool | has_root_path (const Twine &path) |
Has root path? | |
bool | has_relative_path (const Twine &path) |
Has relative path? | |
bool | has_parent_path (const Twine &path) |
Has parent path? | |
bool | has_filename (const Twine &path) |
Has filename? | |
bool | has_stem (const Twine &path) |
Has stem? | |
bool | has_extension (const Twine &path) |
Has extension? | |
bool | is_absolute (const Twine &path) |
Is path absolute? | |
bool | is_relative (const Twine &path) |
Is path relative? | |
Lexical Component Iterator | |
const_iterator | begin (StringRef path) |
Get begin iterator over path. | |
const_iterator | end (StringRef path) |
Get end iterator over path. | |
reverse_iterator | rbegin (StringRef path) |
Get reverse begin iterator over path. | |
reverse_iterator | rend (StringRef path) |
Get reverse end iterator over path. | |
Variables | |
static const char | preferred_separator_string [] = { preferred_separator, '\0' } |
void llvm::sys::path::append | ( | SmallVectorImpl< char > & | path, |
const Twine & | a, | ||
const Twine & | b = "" , |
||
const Twine & | c = "" , |
||
const Twine & | d = "" |
||
) |
Append to path.
/foo + bar/f => /foo/bar/f /foo/ + bar/f => /foo/bar/f foo + bar/f => foo/bar/f
path | Set to path + component. |
a | The component to be appended to path. |
Definition at line 451 of file Path.cpp.
References llvm::SmallVectorImpl< T >::append(), llvm::StringRef::begin(), llvm::SmallVectorTemplateCommon< T >::begin(), llvm::SmallVectorBase::empty(), llvm::StringRef::end(), llvm::SmallVectorTemplateCommon< T >::end(), has_root_name(), is_separator(), llvm::Twine::isTriviallyEmpty(), llvm::SmallVectorTemplateBase< T, isPodLike >::push_back(), llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back(), llvm::SmallVectorTemplateCommon< T, typename >::size(), and llvm::Twine::toStringRef().
Referenced by append(), createUniqueEntity(), llvm::NVPTXAsmPrinter::emitLineNumberAsDotLoc(), llvm::sys::Process::FindInEnvPath(), llvm::LineEditor::getDefaultHistoryPath(), llvm::DWARFDebugLine::LineTable::getFileNameByIndex(), getFileNameForUnit(), llvm::jitprofiling::FilenameCache::getFullPath(), llvm::sys::fs::make_absolute(), llvm::sys::fs::directory_entry::replace_filename(), and llvm::APFloat::toString().
void llvm::sys::path::append | ( | SmallVectorImpl< char > & | path, |
const_iterator | begin, | ||
const_iterator | end | ||
) |
Get begin iterator over path.
path | Input path. |
Definition at line 240 of file Path.cpp.
Referenced by llvm::RegionBase< Tr >::addSubRegion(), append(), llvm::GraphTraits< SDNode * >::child_begin(), llvm::opt::ArgList::ClaimAllArgs(), llvm::RegionBase< Tr >::clearNodeCache(), llvm::DwarfDebug::emitDebugLocEntryLocation(), llvm::opt::ArgList::eraseArg(), llvm::CodeExtractor::extractCodeRegion(), llvm::DWARFDebugAranges::findAddress(), llvm::UnOpInit::Fold(), get64BitArgumentGPRs(), get64BitArgumentXMMs(), llvm::MCObjectStreamer::getCurrentFragment(), llvm::DOTGraphTraits< SelectionDAG * >::getEdgeTarget(), llvm::getIntrinsicWithChain(), llvm::getIntrinsicWithoutChain(), llvm::opt::ArgList::getLastArg(), llvm::R600RegisterInfo::getReservedRegs(), llvm::PPCRegisterInfo::getReservedRegs(), llvm::MipsRegisterInfo::getReservedRegs(), llvm::DataLayout::getStringRepresentation(), llvm::final< T >::getUnitForOffset(), llvm::SmallVectorTemplateBase< T, isPodLike >::grow(), isIntrinsicInline(), lowerV8I16BasicBlendVectorShuffle(), lowerV8I16SingleInputVectorShuffle(), llvm::MachineTraceMetrics::MachineTraceMetrics(), llvm::makeArrayRef(), llvm::GraphTraits< MachineRegionInfo * >::nodes_begin(), llvm::GraphTraits< RegionInfo * >::nodes_begin(), llvm::SmallVectorImpl< T >::operator=(), llvm::MCSectionMachO::ParseSectionSpecifier(), PerformTargetShuffleCombine(), llvm::DominanceFrontierBase< BlockT >::print(), llvm::DwarfAccelTable::print(), llvm::LoopBase< BlockT, LoopT >::print(), llvm::RegionBase< Tr >::print(), llvm::opt::OptTable::PrintHelp(), readExponent(), llvm::DominanceFrontierBase< BlockT >::removeBlock(), llvm::LoopInfoBase< BasicBlock, Loop >::removeLoop(), llvm::PMDataManager::removeNotPreservedAnalysis(), llvm::RegionBase< Tr >::removeSubRegion(), root_directory(), root_name(), root_path(), llvm::scc_begin(), llvm::SchedDFSResult::scheduleTree(), llvm::object::COFFObjectFile::section_rel_begin(), llvm::object::COFFObjectFile::section_rel_end(), skipLeadingZeroesAndAnyDot(), llvm::SmallVectorImpl< T >::swap(), llvm::RegionBase< Tr >::transferChildrenTo(), llvm::UnrollLoop(), llvm::UnrollRuntimeLoopProlog(), llvm::TargetLoweringBase::ValueTypeActionImpl::ValueTypeActionImpl(), llvm::verifyIntrinsicTables(), llvm::LoopBase< BlockT, LoopT >::verifyLoop(), and llvm::LoopBase< BlockT, LoopT >::verifyLoopNest().
Get end iterator over path.
path | Input path. |
Definition at line 248 of file Path.cpp.
References llvm::StringRef::size().
Referenced by llvm::RegionBase< Tr >::addSubRegion(), llvm::DominanceFrontierBase< BlockT >::addToFrontier(), append(), canBeFeederToNewValueJump(), canCompareBeNewValueJump(), llvm::LiveIntervals::checkRegMaskInterference(), llvm::GraphTraits< SDNode * >::child_end(), llvm::opt::ArgList::ClaimAllArgs(), llvm::RegionBase< Tr >::clearNodeCache(), llvm::DominanceFrontierBase< BlockT >::compare(), llvm::DwarfDebug::emitDebugLocEntryLocation(), llvm::encode_leb128(), llvm::opt::ArgList::eraseArg(), llvm::UnwindOpcodeAssembler::Finalize(), llvm::DWARFDebugAranges::findAddress(), llvm::UnOpInit::Fold(), get64BitArgumentGPRs(), get64BitArgumentXMMs(), llvm::getIntrinsicWithChain(), llvm::getIntrinsicWithoutChain(), llvm::opt::ArgList::getLastArg(), llvm::object::ArchiveMemberHeader::getName(), llvm::R600RegisterInfo::getReservedRegs(), llvm::MipsRegisterInfo::getReservedRegs(), llvm::DataLayout::getStringRepresentation(), llvm::final< T >::getUnitForOffset(), getUs(), getUses(), llvm::SmallVectorTemplateBase< T, isPodLike >::grow(), llvm::hashing::detail::hash_combine_range_impl(), interpretDecimal(), isIntrinsicInline(), llvm::SplitAnalysis::isOriginalEndpoint(), lowerV8I16BasicBlendVectorShuffle(), lowerV8I16SingleInputVectorShuffle(), llvm::MachineTraceMetrics::MachineTraceMetrics(), llvm::makeArrayRef(), llvm::GraphTraits< MachineRegionInfo * >::nodes_end(), llvm::GraphTraits< RegionInfo * >::nodes_end(), llvm::SmallVectorImpl< T >::operator=(), llvm::MCSectionMachO::ParseSectionSpecifier(), PerformTargetShuffleCombine(), llvm::DominanceFrontierBase< BlockT >::print(), llvm::LoopBase< BlockT, LoopT >::print(), llvm::RegionBase< Tr >::print(), readExponent(), llvm::DominanceFrontierBase< BlockT >::removeBlock(), llvm::DominanceFrontierBase< BlockT >::removeFromFrontier(), llvm::LoopInfoBase< BasicBlock, Loop >::removeLoop(), llvm::PMDataManager::removeNotPreservedAnalysis(), root_directory(), root_name(), root_path(), llvm::NVPTXAllocaHoisting::runOnFunction(), llvm::scc_end(), llvm::SchedDFSResult::scheduleTree(), llvm::EngineBuilder::selectTarget(), skipLeadingZeroesAndAnyDot(), llvm::Regex::sub(), llvm::SmallVectorImpl< T >::swap(), totalExponent(), llvm::RegionBase< Tr >::transferChildrenTo(), llvm::TargetLoweringBase::ValueTypeActionImpl::ValueTypeActionImpl(), llvm::verifyIntrinsicTables(), llvm::LoopBase< BlockT, LoopT >::verifyLoop(), and llvm::LoopBase< BlockT, LoopT >::verifyLoopNest().
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 "".
/foo/bar.txt => .txt /foo/bar => <empty> /foo/.txt => .txt
path | Input path. |
Definition at line 573 of file Path.cpp.
References filename(), llvm::StringRef::find_last_of(), llvm::StringRef::npos, llvm::StringRef::size(), and llvm::StringRef::substr().
Referenced by has_extension().
Get filename.
/foo.txt => foo.txt . => . .. => .. / => /
path | Input path. |
Definition at line 556 of file Path.cpp.
References rbegin().
Referenced by extension(), llvm::MCDwarfLineTableHeader::getFile(), llvm::Module::getRNG(), has_filename(), llvm::LineReader::LineReader(), mangleCoveragePath(), llvm::cl::ParseCommandLineOptions(), and stem().
Return the preferred separator for this platform.
Definition at line 598 of file Path.cpp.
References preferred_separator_string.
Referenced by llvm::SourceMgr::AddIncludeFile(), and EmitGenDwarfInfo().
bool llvm::sys::path::has_extension | ( | const Twine & | path | ) |
Has extension?
extension != ""
path | Input path. |
Definition at line 651 of file Path.cpp.
References llvm::StringRef::empty(), extension(), and llvm::Twine::toStringRef().
bool llvm::sys::path::has_filename | ( | const Twine & | path | ) |
Has filename?
filename != ""
path | Input path. |
Definition at line 630 of file Path.cpp.
References llvm::StringRef::empty(), filename(), and llvm::Twine::toStringRef().
bool llvm::sys::path::has_parent_path | ( | const Twine & | path | ) |
Has parent path?
parent_path != ""
path | Input path. |
Definition at line 637 of file Path.cpp.
References llvm::StringRef::empty(), parent_path(), and llvm::Twine::toStringRef().
bool llvm::sys::path::has_relative_path | ( | const Twine & | path | ) |
Has relative path?
relative_path != ""
path | Input path. |
Definition at line 623 of file Path.cpp.
References llvm::StringRef::empty(), relative_path(), and llvm::Twine::toStringRef().
bool llvm::sys::path::has_root_directory | ( | const Twine & | path | ) |
Has root directory?
root_directory != ""
path | Input path. |
Definition at line 609 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 | ) |
Has root name?
root_name != ""
path | Input path. |
Definition at line 602 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 | ) |
Has root path?
root_path != ""
path | Input path. |
Definition at line 616 of file Path.cpp.
References llvm::StringRef::empty(), root_path(), and llvm::Twine::toStringRef().
bool llvm::sys::path::has_stem | ( | const Twine & | path | ) |
Has stem?
stem != ""
path | Input path. |
Definition at line 644 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().
bool llvm::sys::path::is_absolute | ( | const Twine & | path | ) |
Is path absolute?
path | Input path. |
Definition at line 658 of file Path.cpp.
References has_root_directory(), has_root_name(), and llvm::Twine::toStringRef().
Referenced by createUniqueEntity(), llvm::NVPTXAsmPrinter::emitLineNumberAsDotLoc(), llvm::DWARFDebugLine::LineTable::getFileNameByIndex(), and is_relative().
bool llvm::sys::path::is_relative | ( | const Twine & | path | ) |
Is path relative?
path | Input path. |
Definition at line 672 of file Path.cpp.
References is_absolute().
Referenced by getFileNameForUnit().
bool llvm::sys::path::is_separator | ( | char | value | ) |
Check whether the given char is a path separator on the host OS.
value | a character |
Definition at line 586 of file Path.cpp.
Referenced by append(), llvm::sys::path::const_iterator::operator++(), llvm::sys::path::reverse_iterator::operator++(), root_directory(), root_name(), and root_path().
void llvm::sys::path::native | ( | const Twine & | path, |
SmallVectorImpl< char > & | result | ||
) |
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 '\'.
path | A path that is transformed to native format. |
result | Holds the result of the transformation. |
Definition at line 530 of file Path.cpp.
References llvm::SmallVectorImpl< T >::clear(), llvm::StringRef::data(), llvm::SmallVectorTemplateCommon< T, typename >::data(), llvm::Twine::getSingleStringRef(), llvm::Twine::isSingleStringRef(), llvm::support::native, and llvm::Twine::toVector().
void llvm::sys::path::native | ( | SmallVectorImpl< char > & | path | ) |
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 540 of file Path.cpp.
References llvm::SmallVectorTemplateCommon< T, typename >::begin(), and llvm::SmallVectorTemplateCommon< T, typename >::end().
Get parent path.
/ => <empty> /foo => / foo/../bar => foo/..
path | Input path. |
Definition at line 498 of file Path.cpp.
References llvm::StringRef::npos, and llvm::StringRef::substr().
Referenced by llvm::sys::fs::create_directories(), llvm::MCDwarfLineTableHeader::getFile(), and has_parent_path().
Get reverse begin iterator over path.
path | Input path. |
Definition at line 316 of file Path.cpp.
References I, and llvm::StringRef::size().
Referenced by filename(), and llvm::opt::ArgList::getLastArgNoClaim().
Get relative path.
C:\hello\world => hello\world foo/bar => foo/bar /foo/bar => foo/bar
path | Input path. |
Definition at line 446 of file Path.cpp.
References root_path(), llvm::StringRef::size(), and llvm::StringRef::substr().
Referenced by has_relative_path(), and llvm::sys::fs::make_absolute().
void llvm::sys::path::remove_filename | ( | SmallVectorImpl< char > & | path | ) |
Remove the last component from path unless it is the root dir.
path | A path that is modified to not have a file component. |
Definition at line 506 of file Path.cpp.
References llvm::SmallVectorTemplateCommon< T, typename >::begin(), llvm::StringRef::npos, llvm::SmallVectorImpl< T >::set_size(), and llvm::SmallVectorTemplateCommon< T, typename >::size().
Referenced by llvm::sys::fs::directory_entry::replace_filename().
Get reverse end iterator over path.
path | Input path. |
Definition at line 323 of file Path.cpp.
References I, and llvm::StringRef::substr().
Referenced by llvm::MultiClass::dump(), and llvm::opt::ArgList::getLastArgNoClaim().
void llvm::sys::path::replace_extension | ( | SmallVectorImpl< char > & | path, |
const Twine & | extension | ||
) |
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 512 of file Path.cpp.
References llvm::SmallVectorImpl< T >::append(), llvm::StringRef::begin(), llvm::SmallVectorTemplateCommon< T, typename >::begin(), llvm::StringRef::end(), llvm::StringRef::find_last_of(), llvm::StringRef::npos, llvm::SmallVectorTemplateBase< T, isPodLike >::push_back(), llvm::SmallVectorImpl< T >::set_size(), llvm::StringRef::size(), llvm::SmallVectorTemplateCommon< T, typename >::size(), and llvm::Twine::toStringRef().
Get root directory.
/goo/hello => / c:/hello => / d/file.txt => <empty>
path | Input path. |
Definition at line 417 of file Path.cpp.
References begin(), end(), and is_separator().
Referenced by has_root_directory(), and llvm::sys::fs::make_absolute().
Get root name.
//net/hello => //net
c:/hello => c: (on Windows, on other platforms nothing)
/hello => <empty>
path | Input path. |
Definition at line 395 of file Path.cpp.
References begin(), end(), and is_separator().
Referenced by has_root_name(), and llvm::sys::fs::make_absolute().
Get root path.
Equivalent to root_name + root_directory.
path | Input path. |
Definition at line 363 of file Path.cpp.
References begin(), end(), is_separator(), and llvm::StringRef::substr().
Referenced by has_root_path(), and relative_path().
StringRef llvm::sys::path::stem | ( | StringRef | path | ) |
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.
/foo/bar.txt => bar /foo/bar => bar /foo/.txt => <empty> /foo/. => . /foo/.. => ..
path | Input path. |
Definition at line 560 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 createUniqueEntity().
const char llvm::sys::path::preferred_separator_string[] = { preferred_separator, '\0' } [static] |
Definition at line 596 of file Path.cpp.
Referenced by get_separator().