Skip to content
This repository was archived by the owner on Mar 28, 2020. It is now read-only.

Commit 298afcc

Browse files
author
Zachary Turner
committed
Add StringRef::contains()
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280113 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 558d668 commit 298afcc

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

include/llvm/ADT/StringRef.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,11 @@ namespace llvm {
337337
/// Complexity: O(size() + Chars.size())
338338
size_t find_last_not_of(StringRef Chars, size_t From = npos) const;
339339

340+
/// Return true if the given string is a substring of *this, and false
341+
/// otherwise.
342+
LLVM_ATTRIBUTE_ALWAYS_INLINE
343+
bool contains(StringRef Other) const { return find(Other) != npos; }
344+
340345
/// @}
341346
/// @name Helpful Algorithms
342347
/// @{

0 commit comments

Comments
 (0)