LLVM API Documentation
#include <StringRef.h>
Public Types | |
| typedef const char * | iterator |
Public Member Functions | |
Constructors | |
| StringRef () | |
| Construct an empty string ref. | |
| StringRef (const char *Str) | |
| Construct a string ref from a cstring. | |
| StringRef (const char *_Data, unsigned _Length) | |
| Construct a string ref from a pointer and length. | |
| StringRef (const std::string &Str) | |
| Construct a string ref from an std::string. | |
Iterators | |
| iterator | begin () const |
| iterator | end () const |
String Operations | |
| const char * | data () const |
| bool | empty () const |
| empty - Check if the string is empty. | |
| size_t | size () const |
| size - Get the string size. | |
| char | front () const |
| front - Get the first character in the string. | |
| char | back () const |
| back - Get the last character in the string. | |
| bool | equals (const StringRef &RHS) const |
| int | compare (const StringRef &RHS) const |
| std::string | str () const |
| str - Get the contents as an std::string. | |
Operator Overloads | |
| char | operator[] (size_t Index) const |
Type Conversions | |
| operator std::string () const | |
String Predicates | |
| bool | startswith (const StringRef &Prefix) const |
| startswith - Check if this string starts with the given | |
| bool | endswith (const StringRef &Suffix) const |
| endswith - Check if this string ends with the given | |
String Searching | |
| size_t | find (char C) const |
| size_t | find (const StringRef &Str) const |
| size_t | count (char C) const |
| count - Return the number of occurrences of | |
| size_t | count (const StringRef &Str) const |
Substring Operations | |
| StringRef | substr (size_t Start, size_t N=npos) const |
| StringRef | slice (size_t Start, size_t End) const |
| std::pair< StringRef, StringRef > | split (char Separator) const |
Static Public Attributes | |
| static const size_t | npos = ~size_t(0) |
This class does not own the string data, it is expected to be used in situations where the character data resides in some other buffer, whose lifetime extends past that of the StringRef. For this reason, it is not in general safe to store a StringRef.
Definition at line 27 of file StringRef.h.
| typedef const char* llvm::StringRef::iterator |
Definition at line 29 of file StringRef.h.
| llvm::StringRef::StringRef | ( | ) | [inline] |
| llvm::StringRef::StringRef | ( | const char * | Str | ) | [inline] |
| llvm::StringRef::StringRef | ( | const char * | _Data, | |
| unsigned | _Length | |||
| ) | [inline] |
| llvm::StringRef::StringRef | ( | const std::string & | Str | ) | [inline] |
| iterator llvm::StringRef::begin | ( | ) | const [inline] |
Definition at line 62 of file StringRef.h.
Referenced by llvm::MDString::begin(), llvm::APFloat::convertFromString(), llvm::StringMapImpl::FindKey(), llvm::APInt::getBitsNeeded(), llvm::TargetLoweringObjectFileMachO::getMachOSection(), llvm::StringMap< llvm::StringPool::PooledString >::GetOrCreateValue(), llvm::StringPool::intern(), llvm::StringMapImpl::LookupBucketFor(), llvm::SmallString< 32 >::operator+=(), llvm::InlineAsm::ConstraintInfo::Parse(), llvm::InlineAsm::ParseConstraints(), and SimplifyCondBranchToCondBranch().
| iterator llvm::StringRef::end | ( | ) | const [inline] |
Definition at line 64 of file StringRef.h.
Referenced by llvm::MDString::end(), llvm::StringMapImpl::FindKey(), llvm::TargetLoweringObjectFileMachO::getMachOSection(), llvm::StringMap< llvm::StringPool::PooledString >::GetOrCreateValue(), llvm::StringPool::intern(), llvm::StringMapImpl::LookupBucketFor(), llvm::SmallString< 32 >::operator+=(), llvm::InlineAsm::ConstraintInfo::Parse(), and llvm::InlineAsm::ParseConstraints().
| const char* llvm::StringRef::data | ( | ) | const [inline] |
data - Get a pointer to the start of the string (which may not be null terminated).
Definition at line 72 of file StringRef.h.
Referenced by llvm::NamedMDNode::Create(), llvm::AsmToken::getLoc(), llvm::raw_ostream::operator<<(), llvm::MCSectionMachO::ParseSectionSpecifier(), PrintLLVMName(), and llvm::DebugInfoFinder::processModule().
| bool llvm::StringRef::empty | ( | ) | const [inline] |
empty - Check if the string is empty.
Definition at line 75 of file StringRef.h.
Referenced by back(), llvm::APFloat::convertFromString(), llvm::MCContext::CreateTemporarySymbol(), EatNumber(), front(), llvm::APInt::getBitsNeeded(), llvm::DOTGraphTraits< const MachineFunction * >::getNodeLabel(), llvm::DOTGraphTraits< const Function * >::getNodeLabel(), NeedsQuoting(), llvm::MCSectionMachO::ParseSectionSpecifier(), llvm::MachineInstr::print(), StripSpaces(), and llvm::InlineAsm::Verify().
| size_t llvm::StringRef::size | ( | ) | const [inline] |
size - Get the string size.
Definition at line 78 of file StringRef.h.
Referenced by llvm::APFloat::convertFromString(), count(), find(), llvm::ConstantArray::get(), getBackEdges(), llvm::APInt::getBitsNeeded(), llvm::AsmToken::getStringContents(), llvm::MDString::length(), NeedsQuoting(), llvm::raw_ostream::operator<<(), llvm::MCSectionMachO::ParseSectionSpecifier(), PrintEscapedString(), PrintLLVMName(), and StripSpaces().
| char llvm::StringRef::front | ( | ) | const [inline] |
front - Get the first character in the string.
Definition at line 81 of file StringRef.h.
References empty().
| char llvm::StringRef::back | ( | ) | const [inline] |
back - Get the last character in the string.
Definition at line 87 of file StringRef.h.
References empty().
Referenced by StripSpaces().
equals - Check for string equality, this is more efficient than compare() when the relative ordering of inequal strings isn't needed.
Definition at line 94 of file StringRef.h.
Referenced by llvm::operator==().
| int llvm::StringRef::compare | ( | const StringRef & | RHS | ) | const [inline] |
compare - Compare two strings; the result is -1, 0, or 1 if this string is lexicographically less than, equal to, or greater than the
Definition at line 101 of file StringRef.h.
Referenced by llvm::operator<(), llvm::operator<=(), llvm::operator>(), and llvm::operator>=().
| std::string llvm::StringRef::str | ( | ) | const [inline] |
str - Get the contents as an std::string.
Definition at line 113 of file StringRef.h.
Referenced by llvm::Value::getNameStr(), llvm::TypeSymbolTable::getUniqueName(), llvm::Linker::LinkInLibrary(), and operator std::string().
| char llvm::StringRef::operator[] | ( | size_t | Index | ) | const [inline] |
Definition at line 119 of file StringRef.h.
| llvm::StringRef::operator std::string | ( | ) | const [inline] |
startswith - Check if this string starts with the given
Definition at line 137 of file StringRef.h.
References Length.
Referenced by llvm::ConstantFoldCall(), llvm::Triple::getDarwinNumber(), StripDebugInfo(), and StripSymtab().
endswith - Check if this string ends with the given
Definition at line 142 of file StringRef.h.
References Length.
| size_t llvm::StringRef::find | ( | char | C | ) | const [inline] |
find - Search for the character
Definition at line 154 of file StringRef.h.
| size_t llvm::StringRef::find | ( | const StringRef & | Str | ) | const [inline] |
find - Search for the string
Definition at line 165 of file StringRef.h.
| size_t llvm::StringRef::count | ( | char | C | ) | const [inline] |
count - Return the number of occurrences of
Definition at line 176 of file StringRef.h.
| size_t llvm::StringRef::count | ( | const StringRef & | Str | ) | const [inline] |
count - Return the number of non-overlapped occurrences of
Definition at line 186 of file StringRef.h.
substr - Return a reference to the substring from [Start, Start + N).
| Start | - The index of the starting character in the substring; if the index is npos or greater than the length of the string then the empty substring will be returned. | |
| N | - The number of characters to included in the substring. If N exceeds the number of characters remaining in the string, the string suffix (starting with
|
Definition at line 210 of file StringRef.h.
Referenced by EatNumber(), llvm::Triple::getDarwinNumber(), and StripSpaces().
| StringRef llvm::StringRef::slice | ( | size_t | Start, | |
| size_t | End | |||
| ) | const [inline] |
slice - Return a reference to the substring from [Start, End).
| Start | - The index of the starting character in the substring; if the index is npos or greater than the length of the string then the empty substring will be returned. | |
| End | - The index following the last character to include in the substring. If this is npos, or less than
|
Definition at line 225 of file StringRef.h.
Referenced by llvm::AsmToken::getStringContents().
split - Split into two substrings around the first occurence of a separator character.
If
| Separator | - The character to split on. |
Definition at line 241 of file StringRef.h.
References Idx.
Referenced by llvm::Triple::getArchName(), llvm::Triple::getEnvironmentName(), llvm::Triple::getOSAndEnvironmentName(), llvm::Triple::getOSName(), llvm::Triple::getVendorName(), and llvm::MCSectionMachO::ParseSectionSpecifier().
const size_t llvm::StringRef::npos = ~size_t(0) [static] |
Definition at line 30 of file StringRef.h.