diff options
author | Raphael Isemann <teemperor@gmail.com> | 2021-05-18 09:03:28 +0200 |
---|---|---|
committer | Raphael Isemann <teemperor@gmail.com> | 2021-05-18 09:41:20 +0200 |
commit | bbea361039c11dc2e6e281c80fa8aa569f1c7c2d (patch) | |
tree | 8cc88badd02c15c063f5ffe1f4f42f1432efcfef /lldb/source/Commands/CommandObjectTarget.cpp | |
parent | 2e92f1a9bcd5550761be936ac9c0848e6d9fcb40 (diff) | |
download | llvm-bbea361039c11dc2e6e281c80fa8aa569f1c7c2d.zip llvm-bbea361039c11dc2e6e281c80fa8aa569f1c7c2d.tar.gz llvm-bbea361039c11dc2e6e281c80fa8aa569f1c7c2d.tar.bz2 |
[lldb][NFC] Remove all uses of StringRef::withNullAsEmpty in LLDB
A long time ago LLDB wanted to start using StringRef instead of
C-Strings/ConstString but was blocked by the fact that the StringRef constructor
that takes a C-string was asserting that the C-string isn't a nullptr. To
workaround this, D24697 introduced a special function called `withNullAsEmpty`
and that's what LLDB (and only LLDB) started to use to build StringRefs from
C-strings.
A bit later it seems that `withNullAsEmpty` was declared too awkward to use and
instead the assert in the StringRef constructor got removed (see D24904). The
rest of LLDB was then converted to StringRef by just calling the now perfectly
usable implicit constructor.
However, all the calls to `withNullAsEmpty` just remained and are now just
strange artefacts in the code base that just look out of place. It's also
curiously a LLDB-exclusive function and no other project ever called it since
it's introduction half a decade ago.
This patch removes all uses of `withNullAsEmpty`. The follow up will be to
remove the function from StringRef.
Reviewed By: JDevlieghere
Differential Revision: https://reviews.llvm.org/D102597
Diffstat (limited to 'lldb/source/Commands/CommandObjectTarget.cpp')
-rw-r--r-- | lldb/source/Commands/CommandObjectTarget.cpp | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/lldb/source/Commands/CommandObjectTarget.cpp b/lldb/source/Commands/CommandObjectTarget.cpp index f8d3a79..bc038e3 100644 --- a/lldb/source/Commands/CommandObjectTarget.cpp +++ b/lldb/source/Commands/CommandObjectTarget.cpp @@ -848,8 +848,7 @@ protected: size_t matches = 0; bool use_var_name = false; if (m_option_variable.use_regex) { - RegularExpression regex( - llvm::StringRef::withNullAsEmpty(arg.c_str())); + RegularExpression regex(arg.ref()); if (!regex.IsValid()) { result.GetErrorStream().Printf( "error: invalid regular expression: '%s'\n", arg.c_str()); |