From cfca06d7963fa0909f90483b42a6d7d194d01e08 Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Sun, 26 Jul 2020 19:36:28 +0000 Subject: Vendor import of llvm-project master 2e10b7a39b9, the last commit before the llvmorg-12-init tag, from which release/11.x was branched. --- llvm/lib/Support/Regex.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'llvm/lib/Support/Regex.cpp') diff --git a/llvm/lib/Support/Regex.cpp b/llvm/lib/Support/Regex.cpp index 8da345d4f140..0d5cc1c00db1 100644 --- a/llvm/lib/Support/Regex.cpp +++ b/llvm/lib/Support/Regex.cpp @@ -14,6 +14,7 @@ #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringRef.h" #include "llvm/ADT/Twine.h" +#include #include // Important this comes last because it defines "_REGEX_H_". At least on @@ -25,7 +26,7 @@ using namespace llvm; Regex::Regex() : preg(nullptr), error(REG_BADPAT) {} -Regex::Regex(StringRef regex, unsigned Flags) { +Regex::Regex(StringRef regex, RegexFlags Flags) { unsigned flags = 0; preg = new llvm_regex(); preg->re_endp = regex.end(); @@ -38,6 +39,9 @@ Regex::Regex(StringRef regex, unsigned Flags) { error = llvm_regcomp(preg, regex.data(), flags|REG_PEND); } +Regex::Regex(StringRef regex, unsigned Flags) + : Regex(regex, static_cast(Flags)) {} + Regex::Regex(Regex &®ex) { preg = regex.preg; error = regex.error; @@ -135,7 +139,7 @@ std::string Regex::sub(StringRef Repl, StringRef String, // Return the input if there was no match. if (!match(String, &Matches, Error)) - return String; + return std::string(String); // Otherwise splice in the replacement string, starting with the prefix before // the match. -- cgit v1.2.3