diff options
author | Chris Lattner <sabre@nondot.org> | 2009-08-10 00:44:02 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-08-10 00:44:02 +0000 |
commit | 8dd5e59a5074ca48140a04d9a0d16c71c02b8608 (patch) | |
tree | 69b884fd48e0103d43ef8eabf26fd7865bd4abb9 /include/llvm/ADT | |
parent | 0d80857175a0a87d99de450e1e0e2eb2ff02bd64 (diff) | |
download | external_llvm-8dd5e59a5074ca48140a04d9a0d16c71c02b8608.zip external_llvm-8dd5e59a5074ca48140a04d9a0d16c71c02b8608.tar.gz external_llvm-8dd5e59a5074ca48140a04d9a0d16c71c02b8608.tar.bz2 |
add a simple back() method to StringRef.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78544 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/ADT')
-rw-r--r-- | include/llvm/ADT/StringRef.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/include/llvm/ADT/StringRef.h b/include/llvm/ADT/StringRef.h index e771cd0..e24fe05 100644 --- a/include/llvm/ADT/StringRef.h +++ b/include/llvm/ADT/StringRef.h @@ -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. |