summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-08-05 15:48:26 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-08-05 15:48:26 +0000
commit6e1fb1e06a738719d92e9ce3fc2545067ea82abd (patch)
tree5e1447202372f88eda8bbb6c452916bcb0773e7b
parenteaccdd34a330d2f7578edbaeec924912a9325f48 (diff)
downloadbcm5719-llvm-6e1fb1e06a738719d92e9ce3fc2545067ea82abd.tar.gz
bcm5719-llvm-6e1fb1e06a738719d92e9ce3fc2545067ea82abd.zip
Add StringRef::endswith
llvm-svn: 78197
-rw-r--r--llvm/include/llvm/ADT/StringRef.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/include/llvm/ADT/StringRef.h b/llvm/include/llvm/ADT/StringRef.h
index 0b1bfb28c23..e771cd0edd5 100644
--- a/llvm/include/llvm/ADT/StringRef.h
+++ b/llvm/include/llvm/ADT/StringRef.h
@@ -174,6 +174,11 @@ namespace llvm {
return substr(0, Prefix.Length).equals(Prefix);
}
+ /// endswith - Check if this string ends with the given \arg Suffix.
+ bool endswith(const StringRef &Suffix) const {
+ return slice(size() - Suffix.Length, size()).equals(Suffix);
+ }
+
/// @}
};
OpenPOWER on IntegriCloud