add a simple back() method to StringRef.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78544 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2009-08-10 00:44:02 +00:00
parent c6ca847a4e
commit e36df3fd31

View File

@ -76,6 +76,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.