[PATCH] D96036: [clang][codegen] Remember string used to create llvm::Regex for optimization remarks
Duncan P. N. Exon Smith via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Feb 4 08:49:53 PST 2021
dexonsmith accepted this revision.
dexonsmith added a comment.
LGTM! I also have a couple of optional suggestions to consider.
================
Comment at: clang/include/clang/Basic/CodeGenOptions.h:286
+
+ bool isEnabled() const { return Regex != nullptr; }
+
----------------
This could also be:
```
explicit operator bool() const { return Regex != nullptr }
```
================
Comment at: clang/include/clang/Basic/CodeGenOptions.h:288-291
+ bool match(StringRef String, SmallVectorImpl<StringRef> *Matches = nullptr,
+ std::string *Error = nullptr) const {
+ return isEnabled() && Regex->match(String, Matches, Error);
+ }
----------------
Another option would be:
```
llvm::Regex *operator->() const { return Regex.get(); }
```
treating `RemarkPattern` as a pointer wrapper (that also knows the `std::string`). WDYT?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D96036/new/
https://reviews.llvm.org/D96036
More information about the cfe-commits
mailing list