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 | aea9dfc1671d0e3f57223ad522cdc4c8e3182c53 (patch) | |
| tree | 275bc6640de8acab0cd6808f04821ce16af6aac9 | |
| parent | 6e046f4291e0a3ca18eae50e93dfac8ea6c66ebb (diff) | |
| download | bcm5719-llvm-aea9dfc1671d0e3f57223ad522cdc4c8e3182c53.tar.gz bcm5719-llvm-aea9dfc1671d0e3f57223ad522cdc4c8e3182c53.zip | |
add a simple back() method to StringRef.
llvm-svn: 78544
| -rw-r--r-- | llvm/include/llvm/ADT/StringRef.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/include/llvm/ADT/StringRef.h b/llvm/include/llvm/ADT/StringRef.h index e771cd0edd5..e24fe05e7cd 100644 --- a/llvm/include/llvm/ADT/StringRef.h +++ b/llvm/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. |

