aboutsummaryrefslogtreecommitdiff
path: root/include/llvm/ADT/StringRef.h
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-08-10 00:44:02 +0000
committerChris Lattner <sabre@nondot.org>2009-08-10 00:44:02 +0000
commite36df3fd31a08a41d9ad04fcba182b616b030c9c (patch)
tree69b884fd48e0103d43ef8eabf26fd7865bd4abb9 /include/llvm/ADT/StringRef.h
parentc6ca847a4ee48b203239802cba78b90ba0c40dee (diff)
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/StringRef.h')
-rw-r--r--include/llvm/ADT/StringRef.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/include/llvm/ADT/StringRef.h b/include/llvm/ADT/StringRef.h
index e771cd0edd..e24fe05e7c 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.