diff options
-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 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. |