diff options
-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 17a428cfd1d..c753b7f1494 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 /// @{ |