summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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