[all-commits] [llvm/llvm-project] bbea36: [lldb][NFC] Remove all uses of StringRef::withNull...
Raphael Isemann via All-commits
all-commits at lists.llvm.org
Tue May 18 00:41:58 PDT 2021
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: bbea361039c11dc2e6e281c80fa8aa569f1c7c2d
https://github.com/llvm/llvm-project/commit/bbea361039c11dc2e6e281c80fa8aa569f1c7c2d
Author: Raphael Isemann <teemperor at gmail.com>
Date: 2021-05-18 (Tue, 18 May 2021)
Changed paths:
M lldb/include/lldb/Interpreter/OptionValueRegex.h
M lldb/include/lldb/Interpreter/OptionValueString.h
M lldb/source/API/SBDebugger.cpp
M lldb/source/API/SBLanguageRuntime.cpp
M lldb/source/API/SBPlatform.cpp
M lldb/source/API/SBTypeCategory.cpp
M lldb/source/Breakpoint/BreakpointResolverName.cpp
M lldb/source/Commands/CommandObjectFrame.cpp
M lldb/source/Commands/CommandObjectTarget.cpp
M lldb/source/Commands/CommandObjectType.cpp
M lldb/source/Interpreter/CommandInterpreter.cpp
M lldb/source/Interpreter/OptionValue.cpp
M lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
M lldb/source/Target/ThreadPlanStepInRange.cpp
Log Message:
-----------
[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
More information about the All-commits
mailing list