projects
/
platform
/
upstream
/
llvm.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
a7cb477
)
Add StringRef::contains()
author
Zachary Turner
<zturner@google.com>
Tue, 30 Aug 2016 17:29:46 +0000
(17:29 +0000)
committer
Zachary Turner
<zturner@google.com>
Tue, 30 Aug 2016 17:29:46 +0000
(17:29 +0000)
llvm-svn: 280113
llvm/include/llvm/ADT/StringRef.h
patch
|
blob
|
history
diff --git
a/llvm/include/llvm/ADT/StringRef.h
b/llvm/include/llvm/ADT/StringRef.h
index
17a428c
..
c753b7f
100644
(file)
--- 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
/// @{