[PATCH] D27463: Change llvm::Regex to expose a fallible constructor.
Richard Smith via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 23 15:53:13 PST 2017
rsmith added a comment.
Generally the new interface makes sense to me, but deliberately ignoring the error to provoke an assertion seems a bit subtle.
================
Comment at: lib/IR/AutoUpgrade.cpp:98-99
}
- Regex vldRegex("^arm\\.neon\\.vld([1234]|[234]lane)\\.v[a-z0-9]*$");
- if (vldRegex.match(Name)) {
+ // Note: if the regex constants below fail to compile, the if()s do not
+ // perform error handling, which will cause a crash with asserts enabled.
+ auto vldRegex = Regex::compile(
----------------
Rather than adding this comment in various places, what do you think about also adding a `static Regex Regex::compileKnownValid(StringRef)` that encapsulates the compile + assert-if-not-valid logic?
https://reviews.llvm.org/D27463
More information about the llvm-commits
mailing list