add a simple back() method to StringRef.
authorChris Lattner <sabre@nondot.org>
Mon, 10 Aug 2009 00:44:02 +0000 (00:44 +0000)
committerChris Lattner <sabre@nondot.org>
Mon, 10 Aug 2009 00:44:02 +0000 (00:44 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78544 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/ADT/StringRef.h

index e771cd0edd5b04df48ec8cc11bc252bae4d9286e..e24fe05e7cd342ccf17662c1f1104afb04c8c86c 100644 (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.