[PATCH] D67241: Regex: Make "match" and "sub" const member functions

Thomas Preud'homme via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 6 02:19:52 PDT 2019


thopre added inline comments.


================
Comment at: include/llvm/Support/Regex.h:76-77
     ///
+    /// \param Error - If non-null, any errors in the matching will be recorded
+    /// as a non-empty string.
+    ///
----------------
Could you mention that any error will be cleared by the function?


================
Comment at: lib/Support/Regex.cpp:88-90
+  // Check if the regex itself didn't successfully compile.
+  if (Error ? !isValid(*Error) : !isValid())
     return false;
----------------
I think I'd prefer the API to enforce the user to check compile error when creating the regex and just have an assert here. match should only report errors in matching IMHO.


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67241/new/

https://reviews.llvm.org/D67241





More information about the llvm-commits mailing list