LLVM API Documentation
Classes | |
class | const_iterator |
Path iterator. More... | |
Functions | |
Lexical Modifiers | |
void | remove_filename (SmallVectorImpl< char > &path) |
Remove the last component from path unless it is the root dir. More... | |
void | replace_extension (SmallVectorImpl< char > &path, const Twine &extension) |
Replace the file extension of path with extension. More... | |
void | append (SmallVectorImpl< char > &path, const Twine &a, const Twine &b="", const Twine &c="", const Twine &d="") |
Append to path. More... | |
void | append (SmallVectorImpl< char > &path, const_iterator begin, const_iterator end) |
Append to path. More... | |
Transforms (or some other better name) | |
void | native (const Twine &path, SmallVectorImpl< char > &result) |
void | native (SmallVectorImpl< char > &path) |
Lexical Observers | |
const StringRef | root_name (StringRef path) |
Get root name. More... | |
const StringRef | root_directory (StringRef path) |
Get root directory. More... | |
const StringRef | root_path (StringRef path) |
Get root path. More... | |
const StringRef | relative_path (StringRef path) |
Get relative path. More... | |
const StringRef | parent_path (StringRef path) |
Get parent path. More... | |
const StringRef | filename (StringRef path) |
Get filename. More... | |
const StringRef | stem (StringRef path) |
Get stem. More... | |
const StringRef | extension (StringRef path) |
Get extension. More... | |
bool | is_separator (char value) |
Check whether the given char is a path separator on the host OS. More... | |
void | system_temp_directory (bool erasedOnReboot, SmallVectorImpl< char > &result) |
Get the typical temporary directory for the system, e.g., "/var/tmp" or "C:/TEMP". More... | |
bool | has_root_name (const Twine &path) |
Has root name? More... | |
bool | has_root_directory (const Twine &path) |
Has root directory? More... | |
bool | has_root_path (const Twine &path) |
Has root path? More... | |
bool | has_relative_path (const Twine &path) |
Has relative path? More... | |
bool | has_parent_path (const Twine &path) |
Has parent path? More... | |
bool | has_filename (const Twine &path) |
Has filename? More... | |
bool | has_stem (const Twine &path) |
Has stem? More... | |
bool | has_extension (const Twine &path) |
Has extension? More... | |
bool | is_absolute (const Twine &path) |
Is path absolute? More... | |
bool | is_relative (const Twine &path) |
Is path relative? More... | |
Lexical Component Iterator | |
typedef std::reverse_iterator < const_iterator > | reverse_iterator |
const_iterator | begin (StringRef path) |
Get begin iterator over path. More... | |
const_iterator | end (StringRef path) |
Get end iterator over path. More... | |
reverse_iterator | rbegin (StringRef path) |
Get reverse begin iterator over path. More... | |
reverse_iterator | rend (StringRef path) |
Get reverse end iterator over path. More... | |
typedef std::reverse_iterator<const_iterator> llvm::sys::path::reverse_iterator |
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 372 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< T >::value >::push_back(), llvm::SmallVectorTemplateBase< T, isPodLike >::push_back(), llvm::SmallVectorTemplateCommon< T, typename >::size(), and llvm::Twine::toStringRef().
Referenced by append(), llvm::NVPTXAsmPrinter::emitLineNumberAsDotLoc(), llvm::DWARFDebugLine::LineTable::getFileNameByIndex(), getFileNameForCompileUnit(), llvm::jitprofiling::FilenameCache::getFullPath(), llvm::SmallVectorImpl< std::pair< int, int64_t > >::insert(), llvm::sys::fs::make_absolute(), llvm::sys::fs::directory_entry::replace_filename(), llvm::SmallVector< llvm::cl::parser::OptionInfo, 8 >::SmallVector(), and llvm::APFloat::toString().
void llvm::sys::path::append | ( | SmallVectorImpl< char > & | path, |
const_iterator | begin, | ||
const_iterator | end | ||
) |
const_iterator llvm::sys::path::begin | ( | StringRef | path | ) |
Get begin iterator over path.
path | Input path. |
Definition at line 173 of file Path.cpp.
Referenced by append(), llvm::EmitUnwindCode(), llvm::CodeExtractor::extractCodeRegion(), llvm::DWARFDebugAranges::findAddress(), llvm::UnOpInit::Fold(), llvm::RecordKeeper::getAllDerivedDefinitions(), llvm::MCObjectStreamer::getCurrentFragment(), llvm::R600RegisterInfo::getReservedRegs(), llvm::PPCRegisterInfo::getReservedRegs(), llvm::MipsRegisterInfo::getReservedRegs(), llvm::makeArrayRef(), llvm::GraphTraits< RegionInfo * >::nodes_begin(), llvm::DwarfAccelTable::print(), llvm::LoopBase< N, M >::print(), llvm::opt::OptTable::PrintHelp(), readExponent(), llvm::LoopInfoBase< llvm::MachineBasicBlock, llvm::MachineLoop >::removeLoop(), llvm::PMDataManager::removeNotPreservedAnalysis(), rend(), root_directory(), root_name(), root_path(), llvm::scc_begin(), llvm::SchedDFSResult::scheduleTree(), skipLeadingZeroesAndAnyDot(), llvm::UnrollLoop(), llvm::UnrollRuntimeLoopProlog(), llvm::LoopBase< N, M >::verifyLoop(), and llvm::LoopBase< N, M >::verifyLoopNest().
const_iterator llvm::sys::path::end | ( | StringRef | path | ) |
Get end iterator over path.
path | Input path. |
Definition at line 181 of file Path.cpp.
References llvm::StringRef::size().
Referenced by llvm::JIT::addPointerToBasicBlock(), append(), canBeFeederToNewValueJump(), canCompareBeNewValueJump(), llvm::LiveIntervals::checkRegMaskInterference(), llvm::DWARFDebugArangeSet::dump(), llvm::DWARFDebugLine::LineTable::dump(), llvm::encode_leb128(), filename(), llvm::UnwindOpcodeAssembler::Finalize(), llvm::DWARFDebugAranges::findAddress(), llvm::UnOpInit::Fold(), llvm::DWARFAbbreviationDeclarationSet::getAbbreviationDeclaration(), llvm::DWARFDebugAbbrev::getAbbreviationDeclarationSet(), llvm::RecordKeeper::getAllDerivedDefinitions(), llvm::object::ArchiveMemberHeader::getName(), llvm::JIT::getPointerToBasicBlock(), llvm::R600RegisterInfo::getReservedRegs(), llvm::MipsRegisterInfo::getReservedRegs(), getUs(), interpretDecimal(), llvm::SplitAnalysis::isOriginalEndpoint(), llvm::makeArrayRef(), llvm::GraphTraits< RegionInfo * >::nodes_end(), llvm::LoopBase< N, M >::print(), rbegin(), readExponent(), llvm::LoopInfoBase< llvm::MachineBasicBlock, llvm::MachineLoop >::removeLoop(), PBQP::Graph::removeNode(), llvm::PMDataManager::removeNotPreservedAnalysis(), root_directory(), root_name(), root_path(), llvm::NVPTXAllocaHoisting::runOnFunction(), llvm::scc_end(), llvm::SchedDFSResult::scheduleTree(), skipLeadingZeroesAndAnyDot(), llvm::Regex::sub(), totalExponent(), llvm::LoopBase< N, M >::verifyLoop(), llvm::LoopBase< N, M >::verifyLoopNest(), and llvm::MCJIT::~MCJIT().
const StringRef llvm::sys::path::extension | ( | StringRef | path | ) |
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 484 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().
const StringRef llvm::sys::path::filename | ( | StringRef | path | ) |
Get filename.
path | Input path. |
Definition at line 467 of file Path.cpp.
References end().
Referenced by extension(), llvm::MCContext::GetDwarfFile(), has_filename(), llvm::LineReader::LineReader(), llvm::cl::ParseCommandLineOptions(), and stem().
bool llvm::sys::path::has_extension | ( | const Twine & | path | ) |
Has extension?
extension != ""
path | Input path. |
Definition at line 607 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 586 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 593 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 579 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 565 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 558 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 572 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 600 of file Path.cpp.
References llvm::StringRef::empty(), stem(), and llvm::Twine::toStringRef().
bool llvm::sys::path::is_absolute | ( | const Twine & | path | ) |
Is path absolute?
path | Input path. |
Definition at line 614 of file Path.cpp.
References has_root_directory(), has_root_name(), and llvm::Twine::toStringRef().
Referenced by 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 628 of file Path.cpp.
References is_absolute().
Referenced by getFileNameForCompileUnit().
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 497 of file Path.cpp.
Referenced by append(), llvm::sys::path::const_iterator::operator++(), llvm::sys::path::const_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 451 of file Path.cpp.
References llvm::SmallVectorImpl< T >::clear(), llvm::StringRef::data(), llvm::SmallVectorTemplateCommon< T, typename >::data(), llvm::Twine::getSingleStringRef(), llvm::Twine::isSingleStringRef(), 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 461 of file Path.cpp.
References llvm::SmallVectorTemplateCommon< T, typename >::begin(), and llvm::SmallVectorTemplateCommon< T, typename >::end().
const StringRef llvm::sys::path::parent_path | ( | StringRef | path | ) |
Get parent path.
path | Input path. |
Definition at line 419 of file Path.cpp.
References llvm::StringRef::npos, and llvm::StringRef::substr().
Referenced by llvm::sys::fs::create_directories(), llvm::MCContext::GetDwarfFile(), and has_parent_path().
|
inline |
const StringRef llvm::sys::path::relative_path | ( | StringRef | path | ) |
Get relative path.
path | Input path. |
Definition at line 367 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 427 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().
|
inline |
Get reverse end iterator over path.
path | Input path. |
Definition at line 101 of file Path.h.
References begin().
Referenced by llvm::MultiClass::dump().
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 433 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().
const StringRef llvm::sys::path::root_directory | ( | StringRef | path | ) |
Get root directory.
path | Input path. |
Definition at line 338 of file Path.cpp.
References begin(), end(), llvm::StringRef::endswith(), is_separator(), and llvm::StringRef::size().
Referenced by has_root_directory(), and llvm::sys::fs::make_absolute().
const StringRef llvm::sys::path::root_name | ( | StringRef | path | ) |
Get root name.
path | Input path. |
Definition at line 316 of file Path.cpp.
References begin(), end(), llvm::StringRef::endswith(), is_separator(), and llvm::StringRef::size().
Referenced by has_root_name(), and llvm::sys::fs::make_absolute().
const StringRef llvm::sys::path::root_path | ( | StringRef | path | ) |
Get root path.
Equivalent to root_name + root_directory.
path | Input path. |
Definition at line 284 of file Path.cpp.
References begin(), end(), llvm::StringRef::endswith(), is_separator(), llvm::StringRef::size(), and llvm::StringRef::substr().
Referenced by has_root_path(), and relative_path().
const 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.
path | Input path. |
Definition at line 471 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. |
Definition at line 507 of file Path.cpp.
References llvm::SmallVectorImpl< T >::append(), llvm::SmallVectorTemplateCommon< T, typename >::back(), llvm::SmallVectorImpl< T >::clear(), llvm::SmallVectorTemplateCommon< T, typename >::data(), llvm::LibFunc::getenv, llvm::SmallVectorTemplateBase< T, isPodLike >::pop_back(), llvm::SmallVectorImpl< T >::resize(), llvm::SmallVectorTemplateCommon< T, typename >::size(), and llvm::LibFunc::strlen.