aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Interpreter/CommandInterpreter.cpp
diff options
context:
space:
mode:
authorRaphael Isemann <teemperor@gmail.com>2021-05-18 09:03:28 +0200
committerRaphael Isemann <teemperor@gmail.com>2021-05-18 09:41:20 +0200
commitbbea361039c11dc2e6e281c80fa8aa569f1c7c2d (patch)
tree8cc88badd02c15c063f5ffe1f4f42f1432efcfef /lldb/source/Interpreter/CommandInterpreter.cpp
parent2e92f1a9bcd5550761be936ac9c0848e6d9fcb40 (diff)
downloadllvm-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/Interpreter/CommandInterpreter.cpp')
-rw-r--r--lldb/source/Interpreter/CommandInterpreter.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp b/lldb/source/Interpreter/CommandInterpreter.cpp
index a7aea8d..8122084 100644
--- a/lldb/source/Interpreter/CommandInterpreter.cpp
+++ b/lldb/source/Interpreter/CommandInterpreter.cpp
@@ -2986,9 +2986,9 @@ void CommandInterpreter::GetLLDBCommandsFromIOHandler(
IOHandlerSP io_handler_sp(
new IOHandlerEditline(debugger, IOHandler::Type::CommandList,
"lldb", // Name of input reader for history
- llvm::StringRef::withNullAsEmpty(prompt), // Prompt
- llvm::StringRef(), // Continuation prompt
- true, // Get multiple lines
+ llvm::StringRef(prompt), // Prompt
+ llvm::StringRef(), // Continuation prompt
+ true, // Get multiple lines
debugger.GetUseColor(),
0, // Don't show line numbers
delegate, // IOHandlerDelegate
@@ -3006,9 +3006,9 @@ void CommandInterpreter::GetPythonCommandsFromIOHandler(
IOHandlerSP io_handler_sp(
new IOHandlerEditline(debugger, IOHandler::Type::PythonCode,
"lldb-python", // Name of input reader for history
- llvm::StringRef::withNullAsEmpty(prompt), // Prompt
- llvm::StringRef(), // Continuation prompt
- true, // Get multiple lines
+ llvm::StringRef(prompt), // Prompt
+ llvm::StringRef(), // Continuation prompt
+ true, // Get multiple lines
debugger.GetUseColor(),
0, // Don't show line numbers
delegate, // IOHandlerDelegate