diff options
Diffstat (limited to 'llvm/lib/Support/Regex.cpp')
-rw-r--r-- | llvm/lib/Support/Regex.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/llvm/lib/Support/Regex.cpp b/llvm/lib/Support/Regex.cpp index 0d5cc1c00db1..7a804a1a2297 100644 --- a/llvm/lib/Support/Regex.cpp +++ b/llvm/lib/Support/Regex.cpp @@ -218,10 +218,10 @@ bool Regex::isLiteralERE(StringRef Str) { std::string Regex::escape(StringRef String) { std::string RegexStr; - for (unsigned i = 0, e = String.size(); i != e; ++i) { - if (strchr(RegexMetachars, String[i])) + for (char C : String) { + if (strchr(RegexMetachars, C)) RegexStr += '\\'; - RegexStr += String[i]; + RegexStr += C; } return RegexStr; |