[PATCH] D27463: Change llvm::Regex to expose a fallible constructor.
David L. Jones via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 9 17:16:00 PST 2017
dlj marked an inline comment as done.
dlj added inline comments.
================
Comment at: lib/IR/DiagnosticInfo.cpp:45-54
if (!Val.empty()) {
- Pattern = std::make_shared<Regex>(Val);
- std::string RegexError;
- if (!Pattern->isValid(RegexError))
+ if (auto RegexOrError = Regex::compile(Val)) {
+ Pattern = std::make_shared<Regex>(std::move(*RegexOrError));
+ } else {
report_fatal_error("Invalid regular expression '" + Val +
- "' in -pass-remarks: " + RegexError,
+ "' in -pass-remarks: " +
+ toString(RegexOrError.takeError()),
----------------
chandlerc wrote:
> Do you mind reflowing all of this to use early return so that there are less braces and indentation?
Better?
https://reviews.llvm.org/D27463
More information about the llvm-commits
mailing list