[PATCH] D66463: Regex: +isValid() with no parameter
Jan Kratochvil via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 20 03:07:21 PDT 2019
jankratochvil created this revision.
jankratochvil added reviewers: labath, JDevlieghere.
jankratochvil added a project: LLVM.
Herald added a reviewer: teemperor.
Herald added subscribers: llvm-commits, kristina.
There would be some performance (only a little) improvement for `RegularExpression::Execute`.
Repository:
rL LLVM
https://reviews.llvm.org/D66463
Files:
clang/lib/Analysis/CloneDetection.cpp
lldb/source/Utility/RegularExpression.cpp
llvm/include/llvm/Support/Regex.h
Index: llvm/include/llvm/Support/Regex.h
===================================================================
--- llvm/include/llvm/Support/Regex.h
+++ llvm/include/llvm/Support/Regex.h
@@ -57,6 +57,7 @@
/// isValid - returns the error encountered during regex compilation, or
/// matching, if any.
bool isValid(std::string &Error) const;
+ bool isValid() const { return !error; }
/// getNumMatches - In a valid regex, return the number of parenthesized
/// matches it contains. The number filled in by match will include this
Index: lldb/source/Utility/RegularExpression.cpp
===================================================================
--- lldb/source/Utility/RegularExpression.cpp
+++ lldb/source/Utility/RegularExpression.cpp
@@ -28,10 +28,7 @@
return m_regex.match(str, matches);
}
-bool RegularExpression::IsValid() const {
- std::string discarded;
- return m_regex.isValid(discarded);
-}
+bool RegularExpression::IsValid() const { return m_regex.isValid(); }
llvm::StringRef RegularExpression::GetText() const { return m_regex_text; }
Index: clang/lib/Analysis/CloneDetection.cpp
===================================================================
--- clang/lib/Analysis/CloneDetection.cpp
+++ clang/lib/Analysis/CloneDetection.cpp
@@ -153,9 +153,8 @@
bool FilenamePatternConstraint::isAutoGenerated(
const CloneDetector::CloneGroup &Group) {
- std::string Error;
if (IgnoredFilesPattern.empty() || Group.empty() ||
- !IgnoredFilesRegex->isValid(Error))
+ !IgnoredFilesRegex->isValid())
return false;
for (const StmtSequence &S : Group) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D66463.216087.patch
Type: text/x-patch
Size: 1627 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190820/ad269aea/attachment.bin>
More information about the llvm-commits
mailing list