diff options
author | Jan Kratochvil <jan.kratochvil@redhat.com> | 2019-08-20 09:24:20 +0000 |
---|---|---|
committer | Jan Kratochvil <jan.kratochvil@redhat.com> | 2019-08-20 09:24:20 +0000 |
commit | f9d90bc5f690de43cbfd8bd15f6f3d3e01471615 (patch) | |
tree | 3c62c4c7ea05d724f34236e40c08bf1526f0d5ac /lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp | |
parent | 12d83b427015083f40964c706a5b9e428d9d88df (diff) | |
download | bcm5719-llvm-f9d90bc5f690de43cbfd8bd15f6f3d3e01471615.tar.gz bcm5719-llvm-f9d90bc5f690de43cbfd8bd15f6f3d3e01471615.zip |
[lldb] D66174 `RegularExpression` cleanup
I find as a good cleanup to drop the Compile method. As I do not find TIMTOWTDI
as an advantage and there is already constructor parameter to compile the
regex.
Differential Revision: https://reviews.llvm.org/D66392
llvm-svn: 369352
Diffstat (limited to 'lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp')
-rw-r--r-- | lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp index 2e0c8d52ddd..38bd79d68cf 100644 --- a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp +++ b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp @@ -442,21 +442,12 @@ bool ParseCoordinate(llvm::StringRef coord_s, RSCoordinate &coord) { // elements fails the contents of &coord are undefined and `false` is // returned, `true` otherwise - RegularExpression regex; llvm::SmallVector<llvm::StringRef, 4> matches; - bool matched = false; - if (regex.Compile(llvm::StringRef("^([0-9]+),([0-9]+),([0-9]+)$")) && - regex.Execute(coord_s, &matches)) - matched = true; - else if (regex.Compile(llvm::StringRef("^([0-9]+),([0-9]+)$")) && - regex.Execute(coord_s, &matches)) - matched = true; - else if (regex.Compile(llvm::StringRef("^([0-9]+)$")) && - regex.Execute(coord_s, &matches)) - matched = true; - - if (!matched) + if (!RegularExpression("^([0-9]+),([0-9]+),([0-9]+)$") + .Execute(coord_s, &matches) && + !RegularExpression("^([0-9]+),([0-9]+)$").Execute(coord_s, &matches) && + !RegularExpression("^([0-9]+)$").Execute(coord_s, &matches)) return false; auto get_index = [&](size_t idx, uint32_t &i) -> bool { |