add a simple back() method to StringRef.

llvm-svn: 78544
This commit is contained in:
Chris Lattner 2009-08-10 00:44:02 +00:00
parent 6e046f4291
commit aea9dfc167
1 changed files with 5 additions and 0 deletions

View File

@ -77,6 +77,11 @@ namespace llvm {
/// size - Get the string size.
size_t size() const { return Length; }
char back() const {
assert(!empty());
return Data[Length-1];
}
/// equals - Check for string equality, this is more efficient than
/// compare() in when the relative ordering of inequal strings isn't needed.
bool equals(const StringRef &RHS) const {