From 30905f8a4007cf190fa6d4d3a8cea137cc387bfa Mon Sep 17 00:00:00 2001 From: Zachary Turner Date: Tue, 30 Aug 2016 17:29:46 +0000 Subject: [PATCH] Add StringRef::contains() llvm-svn: 280113 --- llvm/include/llvm/ADT/StringRef.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/llvm/include/llvm/ADT/StringRef.h b/llvm/include/llvm/ADT/StringRef.h index 17a428c..c753b7f 100644 --- a/llvm/include/llvm/ADT/StringRef.h +++ b/llvm/include/llvm/ADT/StringRef.h @@ -337,6 +337,11 @@ namespace llvm { /// Complexity: O(size() + Chars.size()) size_t find_last_not_of(StringRef Chars, size_t From = npos) const; + /// Return true if the given string is a substring of *this, and false + /// otherwise. + LLVM_ATTRIBUTE_ALWAYS_INLINE + bool contains(StringRef Other) const { return find(Other) != npos; } + /// @} /// @name Helpful Algorithms /// @{ -- 2.7.4