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/CommandObjectFrame.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/CommandObjectFrame.cpp')
-rw-r--r-- | lldb/source/Commands/CommandObjectFrame.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lldb/source/Commands/CommandObjectFrame.cpp b/lldb/source/Commands/CommandObjectFrame.cpp index a656a99..b51bdb7 100644 --- a/lldb/source/Commands/CommandObjectFrame.cpp +++ b/lldb/source/Commands/CommandObjectFrame.cpp @@ -460,7 +460,7 @@ public: protected: llvm::StringRef GetScopeString(VariableSP var_sp) { if (!var_sp) - return llvm::StringRef::withNullAsEmpty(nullptr); + return llvm::StringRef(); switch (var_sp->GetScope()) { case eValueTypeVariableGlobal: @@ -477,7 +477,7 @@ protected: break; } - return llvm::StringRef::withNullAsEmpty(nullptr); + return llvm::StringRef(); } bool DoExecute(Args &command, CommandReturnObject &result) override { |