aboutsummaryrefslogtreecommitdiffstats
path: root/include/llvm/ADT/StringRef.h
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
commitc9af366fc39d657b7d416d16988265d86a641184 (patch)
tree815993d1b9e4d1f1339bd4ff65ca4297e101051d /include/llvm/ADT/StringRef.h
parente15192b36bb5e99838d3f70bf79f7b8bed7a75b9 (diff)
downloadexternal_llvm-c9af366fc39d657b7d416d16988265d86a641184.zip
external_llvm-c9af366fc39d657b7d416d16988265d86a641184.tar.gz
external_llvm-c9af366fc39d657b7d416d16988265d86a641184.tar.bz2
Add StringRef::endswith
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78197 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 0b1bfb2..e771cd0 100644
--- a/include/llvm/ADT/StringRef.h
+++ b/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);
+ }
+
/// @}
};