From f85c6016839ee51c3a1a90171fa3b8073d93e0fa Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Sat, 21 Mar 2015 15:37:32 +0000 Subject: [PATCH] Revert accidental commit. While this is a fun change, I didn't really test it :) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232897 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/ADT/StringRef.h | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/include/llvm/ADT/StringRef.h b/include/llvm/ADT/StringRef.h index 4d491e8606a..6111c42da9d 100644 --- a/include/llvm/ADT/StringRef.h +++ b/include/llvm/ADT/StringRef.h @@ -238,12 +238,9 @@ namespace llvm { /// \returns The index of the first occurrence of \p C, or npos if not /// found. size_t find(char C, size_t From = 0) const { - if (Length != 0) { - size_t FindBegin = std::min(From, Length); - if (const void *Found = - std::memchr(Data + FindBegin, C, Length - FindBegin)) - return static_cast(Found) - Data; - } + for (size_t i = std::min(From, Length), e = Length; i != e; ++i) + if (Data[i] == C) + return i; return npos; }