[Lldb-commits] [lldb] [lldb] Make argument to ConstString::AsCString explicit (PR #190183)

Michael Buch via lldb-commits lldb-commits at lists.llvm.org
Thu Apr 2 07:33:19 PDT 2026


https://github.com/Michael137 created https://github.com/llvm/llvm-project/pull/190183

This patch makes the default parameter to ConstString::AsCString explicit. Currently it defaults to `nullptr`. However, there a bunch of callsites that do `printf("%s", foo.AsCString())`, which is UB (I have at least 1 crash on me where this was the root cause).

Alternatively we could change the default to `""` instead of `nullptr`, but code that did `if (foo.AsCString())` would then change meaning.

Command I ran to generate this patch:
```
rg "\.AsCString\(\)" lldb -l | xargs sed -i '' 's/\.AsCString()/.AsCString(nullptr)/g'
```

In a follow-up PR I intend to change the callsites that do `printf("%s", foo.AsCString(nullptr)` to pass `""` as the fallback parameter.

>From 218bb52ff375fe9b7306e0864110dbbe5df1a7fd Mon Sep 17 00:00:00 2001
From: Michael Buch <michaelbuch12 at gmail.com>
Date: Thu, 2 Apr 2026 15:27:38 +0100
Subject: [PATCH] [lldb] Make argument to ConstString::AsCString explicit

This patch makes the default parameter to ConstString::AsCString explicit. Currently it defaults to `nullptr`. However, there a bunch of callsites that do `printf("%s", foo.AsCString())`, which is UB (I have at least 1 crash on me where this was the root cause).

Alternatively we could change the default to `""` instead of `nullptr`, but code that did `if (foo.AsCString())` would then change meaning.

Command I ran to generate this patch:
```
rg "\.AsCString\(\)" lldb -l | xargs sed -i '' 's/\.AsCString()/.AsCString(nullptr)/g'
```

In a follow-up PR I intend to change the callsites that do `printf("%s", foo.AsCString(nullptr)` to pass `""` as the fallback parameter.
---
 .../lldb/DataFormatters/FormattersContainer.h |  4 +-
 .../lldb/DataFormatters/TypeSynthetic.h       |  4 +-
 .../Interfaces/ScriptedInterface.h            |  4 +-
 lldb/include/lldb/Utility/ConstString.h       |  7 +-
 lldb/source/API/SBAttachInfo.cpp              |  2 +-
 lldb/source/API/SBCommandInterpreter.cpp      | 11 +--
 lldb/source/API/SBCommunication.cpp           |  2 +-
 lldb/source/API/SBDebugger.cpp                |  6 +-
 lldb/source/API/SBEvent.cpp                   |  2 +-
 lldb/source/API/SBFileSpec.cpp                |  2 +-
 lldb/source/API/SBFunction.cpp                | 13 +--
 lldb/source/API/SBLanguageRuntime.cpp         |  4 +-
 lldb/source/API/SBLaunchInfo.cpp              |  7 +-
 lldb/source/API/SBMemoryRegionInfo.cpp        |  2 +-
 lldb/source/API/SBModule.cpp                  |  2 +-
 lldb/source/API/SBPlatform.cpp                |  5 +-
 lldb/source/API/SBProcess.cpp                 |  8 +-
 lldb/source/API/SBSymbol.cpp                  |  9 +-
 lldb/source/API/SBTarget.cpp                  |  6 +-
 lldb/source/API/SBThread.cpp                  | 18 ++--
 lldb/source/API/SBThreadPlan.cpp              | 14 +--
 lldb/source/API/SBValue.cpp                   | 26 +++---
 lldb/source/API/SBWatchpoint.cpp              |  2 +-
 lldb/source/Breakpoint/Breakpoint.cpp         |  4 +-
 lldb/source/Breakpoint/BreakpointIDList.cpp   |  2 +-
 lldb/source/Breakpoint/BreakpointLocation.cpp |  4 +-
 lldb/source/Breakpoint/BreakpointOptions.cpp  |  6 +-
 .../BreakpointResolverFileRegex.cpp           |  2 +-
 .../Commands/CommandObjectBreakpoint.cpp      | 26 +++---
 .../source/Commands/CommandObjectCommands.cpp | 34 +++----
 lldb/source/Commands/CommandObjectFrame.cpp   |  7 +-
 lldb/source/Commands/CommandObjectMemory.cpp  | 23 ++---
 .../Commands/CommandObjectMemoryTag.cpp       |  6 +-
 .../source/Commands/CommandObjectPlatform.cpp | 35 ++++----
 lldb/source/Commands/CommandObjectPlugin.cpp  |  2 +-
 lldb/source/Commands/CommandObjectProcess.cpp | 24 ++---
 .../source/Commands/CommandObjectRegister.cpp |  4 +-
 .../source/Commands/CommandObjectSettings.cpp | 20 ++---
 lldb/source/Commands/CommandObjectSource.cpp  | 19 ++--
 lldb/source/Commands/CommandObjectTarget.cpp  | 29 +++---
 lldb/source/Commands/CommandObjectThread.cpp  | 12 +--
 lldb/source/Commands/CommandObjectTrace.cpp   |  4 +-
 lldb/source/Commands/CommandObjectType.cpp    | 34 +++----
 .../Commands/CommandObjectWatchpoint.cpp      |  4 +-
 lldb/source/Core/Address.cpp                  |  2 +-
 lldb/source/Core/AddressRange.cpp             |  2 +-
 lldb/source/Core/Debugger.cpp                 |  5 +-
 lldb/source/Core/Disassembler.cpp             |  8 +-
 lldb/source/Core/DynamicLoader.cpp            |  2 +-
 lldb/source/Core/FormatEntity.cpp             | 12 +--
 lldb/source/Core/IOHandlerCursesGUI.cpp       |  8 +-
 lldb/source/Core/Mangled.cpp                  |  4 +-
 lldb/source/Core/Module.cpp                   |  7 +-
 lldb/source/Core/ModuleList.cpp               |  4 +-
 lldb/source/Core/Section.cpp                  |  4 +-
 lldb/source/Core/SourceManager.cpp            |  2 +-
 lldb/source/DataFormatters/FormatManager.cpp  |  3 +-
 lldb/source/DataFormatters/TypeSummary.cpp    |  2 +-
 lldb/source/DataFormatters/TypeSynthetic.cpp  |  4 +-
 .../DataFormatters/ValueObjectPrinter.cpp     |  6 +-
 lldb/source/Expression/DWARFExpression.cpp    |  8 +-
 lldb/source/Expression/FunctionCaller.cpp     |  2 +-
 lldb/source/Expression/IRExecutionUnit.cpp    |  8 +-
 lldb/source/Expression/LLVMUserExpression.cpp |  4 +-
 lldb/source/Expression/Materializer.cpp       | 89 ++++++++++---------
 lldb/source/Expression/REPL.cpp               | 14 +--
 lldb/source/Expression/UserExpression.cpp     |  2 +-
 .../Host/common/NativeRegisterContext.cpp     |  3 +-
 lldb/source/Host/common/Socket.cpp            |  4 +-
 .../posix/ConnectionFileDescriptorPosix.cpp   |  6 +-
 .../windows/ConnectionGenericFileWindows.cpp  |  7 +-
 .../source/Interpreter/CommandInterpreter.cpp |  2 +-
 lldb/source/Interpreter/CommandObject.cpp     |  2 +-
 .../Interpreter/OptionValueDictionary.cpp     |  2 +-
 .../Interpreter/OptionValuePathMappings.cpp   |  8 +-
 .../Interpreter/OptionValueProperties.cpp     |  2 +-
 .../Plugins/ABI/AArch64/ABIMacOSX_arm64.cpp   |  2 +-
 .../Plugins/ABI/AArch64/ABISysV_arm64.cpp     |  5 +-
 lldb/source/Plugins/ABI/ARC/ABISysV_arc.cpp   |  3 +-
 lldb/source/Plugins/ABI/ARM/ABIMacOSX_arm.cpp |  2 +-
 lldb/source/Plugins/ABI/ARM/ABISysV_arm.cpp   |  2 +-
 .../ABI/LoongArch/ABISysV_loongarch.cpp       |  3 +-
 lldb/source/Plugins/ABI/Mips/ABISysV_mips.cpp |  2 +-
 .../Plugins/ABI/Mips/ABISysV_mips64.cpp       |  2 +-
 .../Plugins/ABI/PowerPC/ABISysV_ppc.cpp       |  4 +-
 .../Plugins/ABI/PowerPC/ABISysV_ppc64.cpp     |  4 +-
 .../Plugins/ABI/RISCV/ABISysV_riscv.cpp       |  3 +-
 .../Plugins/ABI/SystemZ/ABISysV_s390x.cpp     |  4 +-
 .../source/Plugins/ABI/X86/ABIMacOSX_i386.cpp |  2 +-
 lldb/source/Plugins/ABI/X86/ABISysV_i386.cpp  |  2 +-
 .../source/Plugins/ABI/X86/ABISysV_x86_64.cpp |  4 +-
 .../Plugins/ABI/X86/ABIWindows_x86_64.cpp     |  4 +-
 .../DynamicLoaderDarwinKernel.cpp             |  4 +-
 .../POSIX-DYLD/DYLDRendezvous.cpp             |  4 +-
 .../POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp     |  4 +-
 .../ExpressionParser/Clang/ClangASTSource.cpp |  9 +-
 .../Clang/ClangExpressionDeclMap.cpp          | 11 ++-
 .../Clang/ClangExpressionParser.cpp           | 14 +--
 .../Clang/ClangExpressionSourceCode.cpp       |  8 +-
 .../Clang/ClangModulesDeclVendor.cpp          |  2 +-
 .../Clang/ClangUserExpression.cpp             |  9 +-
 .../Clang/ClangUtilityFunction.cpp            |  2 +-
 .../TSan/InstrumentationRuntimeTSan.cpp       |  2 +-
 .../UBSan/InstrumentationRuntimeUBSan.cpp     |  2 +-
 .../Utility/ReportRetriever.cpp               |  2 +-
 .../Language/CPlusPlus/BlockPointer.cpp       |  4 +-
 .../Language/CPlusPlus/CPlusPlusLanguage.cpp  |  2 +-
 .../Plugins/Language/CPlusPlus/Coroutines.cpp |  2 +-
 .../CPlusPlus/GenericInitializerList.cpp      |  4 +-
 .../Language/CPlusPlus/GenericOptional.cpp    |  2 +-
 .../Plugins/Language/CPlusPlus/LibCxx.cpp     |  4 +-
 .../Language/CPlusPlus/LibCxxAtomic.cpp       |  2 +-
 .../Plugins/Language/CPlusPlus/LibCxxMap.cpp  |  2 +-
 .../Language/CPlusPlus/LibCxxProxyArray.cpp   |  4 +-
 .../Language/CPlusPlus/LibCxxQueue.cpp        |  2 +-
 .../Language/CPlusPlus/LibCxxSliceArray.cpp   |  4 +-
 .../Plugins/Language/CPlusPlus/LibCxxSpan.cpp |  4 +-
 .../Language/CPlusPlus/LibCxxUnorderedMap.cpp |  2 +-
 .../Language/CPlusPlus/LibCxxValarray.cpp     |  4 +-
 .../Language/CPlusPlus/LibCxxVector.cpp       | 12 +--
 .../Plugins/Language/CPlusPlus/LibStdcpp.cpp  |  6 +-
 .../CPlusPlus/LibStdcppUniquePointer.cpp      |  2 +-
 .../Language/CPlusPlus/MsvcStlAtomic.cpp      |  2 +-
 .../Language/CPlusPlus/MsvcStlDeque.cpp       |  4 +-
 .../CPlusPlus/MsvcStlSmartPointer.cpp         |  4 +-
 .../Language/CPlusPlus/MsvcStlSpan.cpp        |  4 +-
 .../Language/CPlusPlus/MsvcStlVector.cpp      | 12 +--
 lldb/source/Plugins/Language/ObjC/Cocoa.cpp   |  2 +-
 .../Plugins/Language/ObjC/NSDictionary.cpp    |  2 +-
 lldb/source/Plugins/Language/ObjC/NSError.cpp |  2 +-
 .../Plugins/Language/ObjC/NSException.cpp     |  2 +-
 .../CPlusPlus/ItaniumABIRuntime.cpp           | 14 +--
 .../AppleObjCRuntime/AppleObjCDeclVendor.cpp  |  6 +-
 .../AppleObjCRuntime/AppleObjCRuntime.cpp     |  2 +-
 .../AppleObjCRuntime/AppleObjCRuntimeV1.cpp   |  2 +-
 .../AppleObjCRuntime/AppleObjCRuntimeV2.cpp   | 16 ++--
 .../AppleObjCTrampolineHandler.cpp            |  4 +-
 .../ObjC/ObjCLanguageRuntime.h                |  4 +-
 .../MemoryHistory/asan/MemoryHistoryASan.cpp  |  2 +-
 .../Plugins/ObjectFile/ELF/ObjectFileELF.cpp  | 22 ++---
 .../ObjectFile/JSON/ObjectFileJSON.cpp        |  2 +-
 .../ObjectFile/Mach-O/ObjectFileMachO.cpp     | 22 ++---
 .../Minidump/MinidumpFileBuilder.cpp          |  5 +-
 .../Minidump/ObjectFileMinidump.cpp           | 18 ++--
 .../ObjectFile/PECOFF/ObjectFilePECOFF.cpp    |  2 +-
 .../Plugins/Platform/Android/AdbClient.cpp    | 14 +--
 .../Platform/Android/PlatformAndroid.cpp      |  8 +-
 .../PlatformAndroidRemoteGDBServer.cpp        |  2 +-
 .../Platform/MacOSX/PlatformDarwinDevice.cpp  | 38 ++++----
 .../Platform/MacOSX/PlatformDarwinKernel.cpp  |  8 +-
 ...latformiOSSimulatorCoreSimulatorSupport.mm |  2 +-
 .../Plugins/Platform/POSIX/PlatformPOSIX.cpp  | 18 ++--
 .../Platform/Windows/PlatformWindows.cpp      | 29 +++---
 .../gdb-server/PlatformRemoteGDBServer.cpp    | 14 +--
 .../Process/FreeBSD/NativeProcessFreeBSD.cpp  |  2 +-
 .../Process/Linux/NativeProcessLinux.cpp      | 10 +--
 .../Process/Linux/NativeThreadLinux.cpp       |  2 +-
 .../Process/MacOSX-Kernel/ProcessKDP.cpp      |  2 +-
 .../Process/NetBSD/NativeProcessNetBSD.cpp    |  2 +-
 .../NativeRegisterContextDBReg_x86.cpp        |  2 +-
 .../GDBRemoteCommunicationServer.cpp          |  2 +-
 .../GDBRemoteCommunicationServerLLGS.cpp      | 22 ++---
 .../GDBRemoteCommunicationServerPlatform.cpp  |  2 +-
 .../Process/gdb-remote/ProcessGDBRemote.cpp   | 33 +++----
 .../mach-core/RegisterContextUnifiedCore.cpp  |  4 +-
 .../Process/scripted/ScriptedFrame.cpp        |  7 +-
 .../Process/scripted/ScriptedProcess.cpp      |  2 +-
 .../Process/scripted/ScriptedThread.cpp       |  4 +-
 .../Lua/ScriptInterpreterLua.cpp              |  2 +-
 .../ScriptedFramePythonInterface.cpp          |  9 +-
 .../ScriptedPlatformPythonInterface.cpp       |  4 +-
 .../ScriptedProcessPythonInterface.cpp        |  2 +-
 .../Interfaces/ScriptedPythonInterface.h      |  2 +-
 .../DarwinLog/StructuredDataDarwinLog.cpp     |  5 +-
 .../Plugins/SymbolFile/CTF/SymbolFileCTF.cpp  |  7 +-
 .../SymbolFile/DWARF/DWARFASTParserClang.cpp  | 22 ++---
 .../SymbolFile/DWARF/DWARFDebugInfoEntry.cpp  |  6 +-
 .../SymbolFile/DWARF/ManualDWARFIndex.cpp     |  4 +-
 .../SymbolFile/DWARF/SymbolFileDWARF.cpp      |  8 +-
 .../DWARF/SymbolFileDWARFDebugMap.cpp         | 10 +--
 .../Plugins/SymbolFile/PDB/SymbolFilePDB.cpp  |  3 +-
 .../SymbolFile/Symtab/SymbolFileSymtab.cpp    |  7 +-
 .../SymbolLocatorDebugSymbols.cpp             | 12 +--
 .../Default/SymbolLocatorDefault.cpp          |  2 +-
 .../MacOSX/AppleGetItemInfoHandler.cpp        |  2 +-
 .../MacOSX/AppleGetPendingItemsHandler.cpp    |  2 +-
 .../MacOSX/AppleGetQueuesHandler.cpp          |  2 +-
 .../MacOSX/AppleGetThreadItemInfoHandler.cpp  |  2 +-
 .../MacOSX/SystemRuntimeMacOSX.cpp            |  2 +-
 .../intel-pt/TraceIntelPTBundleSaver.cpp      |  3 +-
 .../TypeSystem/Clang/TypeSystemClang.cpp      |  2 +-
 .../x86/x86AssemblyInspectionEngine.cpp       |  3 +-
 lldb/source/Symbol/Function.cpp               |  4 +-
 lldb/source/Symbol/SymbolContext.cpp          |  8 +-
 lldb/source/Symbol/Symtab.cpp                 |  4 +-
 lldb/source/Symbol/Type.cpp                   |  8 +-
 lldb/source/Symbol/Variable.cpp               |  4 +-
 lldb/source/Target/DynamicRegisterInfo.cpp    | 27 +++---
 lldb/source/Target/ModuleCache.cpp            | 23 ++---
 lldb/source/Target/Platform.cpp               | 18 ++--
 lldb/source/Target/Process.cpp                | 28 +++---
 lldb/source/Target/RegisterContextUnwind.cpp  | 13 +--
 lldb/source/Target/SectionLoadList.cpp        |  7 +-
 lldb/source/Target/StackFrame.cpp             | 10 +--
 lldb/source/Target/StopInfo.cpp               |  6 +-
 lldb/source/Target/Target.cpp                 | 19 ++--
 lldb/source/Target/Thread.cpp                 | 10 +--
 lldb/source/Target/ThreadPlanStepInRange.cpp  | 14 +--
 .../Target/ThreadPlanStepInstruction.cpp      |  2 +-
 .../source/Target/ThreadPlanStepOverRange.cpp |  4 +-
 lldb/source/Target/Trace.cpp                  |  2 +-
 lldb/source/Target/TraceDumper.cpp            |  7 +-
 lldb/source/Utility/Status.cpp                |  2 +-
 lldb/source/ValueObject/DILEval.cpp           | 16 ++--
 lldb/source/ValueObject/ValueObject.cpp       |  8 +-
 lldb/source/ValueObject/ValueObjectChild.cpp  |  3 +-
 .../ValueObject/ValueObjectSynthetic.cpp      | 33 +++----
 lldb/tools/lldb-server/lldb-gdbserver.cpp     |  6 +-
 lldb/tools/lldb-server/lldb-platform.cpp      | 28 +++---
 lldb/tools/lldb-test/lldb-test.cpp            |  2 +-
 .../Expression/DiagnosticManagerTest.cpp      |  2 +-
 .../Interpreter/TestCommandPaths.cpp          |  2 +-
 .../Platform/Android/AdbClientTest.cpp        |  5 +-
 .../Platform/Android/PlatformAndroidTest.cpp  |  9 +-
 lldb/unittests/Symbol/TestTypeSystemClang.cpp |  2 +-
 .../DWARF/DWARFASTParserClangTests.cpp        |  2 +-
 .../SymbolFile/PDB/SymbolFilePDBTests.cpp     |  5 +-
 lldb/unittests/Target/ModuleCacheTest.cpp     |  2 +-
 lldb/unittests/Utility/ConstStringTest.cpp    |  2 +-
 lldb/unittests/Utility/StatusTest.cpp         | 12 +--
 lldb/unittests/debugserver/RNBSocketTest.cpp  | 10 +--
 231 files changed, 924 insertions(+), 834 deletions(-)

diff --git a/lldb/include/lldb/DataFormatters/FormattersContainer.h b/lldb/include/lldb/DataFormatters/FormattersContainer.h
index 0761dcfcb12ea..da2db0ed38ecb 100644
--- a/lldb/include/lldb/DataFormatters/FormattersContainer.h
+++ b/lldb/include/lldb/DataFormatters/FormattersContainer.h
@@ -58,7 +58,7 @@ class TypeMatcher {
     if (type.IsEmpty())
       return type;
 
-    llvm::StringRef type_lexer(type.AsCString());
+    llvm::StringRef type_lexer(type.AsCString(nullptr));
 
     type_lexer.consume_front("class ");
     type_lexer.consume_front("enum ");
@@ -104,7 +104,7 @@ class TypeMatcher {
       // Skip callback matching in these cases.
       if (candidate_type.GetScriptInterpreter())
         return candidate_type.GetScriptInterpreter()->FormatterCallbackFunction(
-            m_name.AsCString(),
+            m_name.AsCString(nullptr),
             std::make_shared<TypeImpl>(candidate_type.GetType()));
     }
     return false;
diff --git a/lldb/include/lldb/DataFormatters/TypeSynthetic.h b/lldb/include/lldb/DataFormatters/TypeSynthetic.h
index c4509206ad753..c732332a75830 100644
--- a/lldb/include/lldb/DataFormatters/TypeSynthetic.h
+++ b/lldb/include/lldb/DataFormatters/TypeSynthetic.h
@@ -53,7 +53,7 @@ class SyntheticChildrenFrontEnd {
   /// subscripting with TypeOptions::eTypeOptionCustomSubscripting.
   virtual llvm::Expected<size_t> GetIndexOfChildWithName(ConstString name) {
     return llvm::createStringError("Type has no child named '%s'",
-                                   name.AsCString());
+                                   name.AsCString(nullptr));
   }
 
   /// This function is assumed to always succeed and if it fails, the front-end
@@ -121,7 +121,7 @@ class SyntheticValueProviderFrontEnd : public SyntheticChildrenFrontEnd {
 
   llvm::Expected<size_t> GetIndexOfChildWithName(ConstString name) override {
     return llvm::createStringError("Type has no child named '%s'",
-                                   name.AsCString());
+                                   name.AsCString(nullptr));
   }
 
   lldb::ChildCacheState Update() override {
diff --git a/lldb/include/lldb/Interpreter/Interfaces/ScriptedInterface.h b/lldb/include/lldb/Interpreter/Interfaces/ScriptedInterface.h
index 8ace90927b582..32c94328832c7 100644
--- a/lldb/include/lldb/Interpreter/Interfaces/ScriptedInterface.h
+++ b/lldb/include/lldb/Interpreter/Interfaces/ScriptedInterface.h
@@ -62,7 +62,7 @@ class ScriptedInterface {
         llvm::Twine(caller_name + llvm::Twine(" ERROR = ") +
                     llvm::Twine(error_msg))
             .str();
-    if (const char *detailed_error = error.AsCString())
+    if (const char *detailed_error = error.AsCString(nullptr))
       full_error_message +=
           llvm::Twine(llvm::Twine(" (") + llvm::Twine(detailed_error) +
                       llvm::Twine(")"))
@@ -84,7 +84,7 @@ class ScriptedInterface {
     }
 
     if (error.Fail())
-      return ErrorWithMessage<bool>(caller, error.AsCString(), error);
+      return ErrorWithMessage<bool>(caller, error.AsCString(nullptr), error);
 
     return true;
   }
diff --git a/lldb/include/lldb/Utility/ConstString.h b/lldb/include/lldb/Utility/ConstString.h
index 692ecb63bd763..3d85a14a7ae39 100644
--- a/lldb/include/lldb/Utility/ConstString.h
+++ b/lldb/include/lldb/Utility/ConstString.h
@@ -178,14 +178,9 @@ class ConstString {
 
   /// Get the string value as a C string.
   ///
-  /// Get the value of the contained string as a NULL terminated C string
-  /// value.
-  ///
-  /// If \a value_if_empty is nullptr, then nullptr will be returned.
-  ///
   /// \return Returns \a value_if_empty if the string is empty, otherwise
   ///     the C string value contained in this object.
-  const char *AsCString(const char *value_if_empty = nullptr) const {
+  const char *AsCString(const char *value_if_empty) const {
     return (IsEmpty() ? value_if_empty : m_string);
   }
 
diff --git a/lldb/source/API/SBAttachInfo.cpp b/lldb/source/API/SBAttachInfo.cpp
index a9f712c79c7fe..df707ef988ed6 100644
--- a/lldb/source/API/SBAttachInfo.cpp
+++ b/lldb/source/API/SBAttachInfo.cpp
@@ -280,7 +280,7 @@ const char *SBAttachInfo::GetScriptedProcessClassName() const {
   // Constify this string so that it is saved in the string pool.  Otherwise it
   // would be freed when this function goes out of scope.
   ConstString class_name(metadata_sp->GetClassName().data());
-  return class_name.AsCString();
+  return class_name.AsCString(nullptr);
 }
 
 void SBAttachInfo::SetScriptedProcessClassName(const char *class_name) {
diff --git a/lldb/source/API/SBCommandInterpreter.cpp b/lldb/source/API/SBCommandInterpreter.cpp
index 34323bc5a2c37..ca38ecde9261f 100644
--- a/lldb/source/API/SBCommandInterpreter.cpp
+++ b/lldb/source/API/SBCommandInterpreter.cpp
@@ -526,7 +526,7 @@ const char *SBCommandInterpreter::GetBroadcasterClass() {
   LLDB_INSTRUMENT();
 
   return ConstString(CommandInterpreter::GetStaticBroadcasterClass())
-      .AsCString();
+      .AsCString(nullptr);
 }
 
 const char *SBCommandInterpreter::GetArgumentTypeAsCString(
@@ -661,21 +661,22 @@ SBCommand::operator bool() const {
 const char *SBCommand::GetName() {
   LLDB_INSTRUMENT_VA(this);
 
-  return (IsValid() ? ConstString(m_opaque_sp->GetCommandName()).AsCString()
-                    : nullptr);
+  return (IsValid()
+              ? ConstString(m_opaque_sp->GetCommandName()).AsCString(nullptr)
+              : nullptr);
 }
 
 const char *SBCommand::GetHelp() {
   LLDB_INSTRUMENT_VA(this);
 
-  return (IsValid() ? ConstString(m_opaque_sp->GetHelp()).AsCString()
+  return (IsValid() ? ConstString(m_opaque_sp->GetHelp()).AsCString(nullptr)
                     : nullptr);
 }
 
 const char *SBCommand::GetHelpLong() {
   LLDB_INSTRUMENT_VA(this);
 
-  return (IsValid() ? ConstString(m_opaque_sp->GetHelpLong()).AsCString()
+  return (IsValid() ? ConstString(m_opaque_sp->GetHelpLong()).AsCString(nullptr)
                     : nullptr);
 }
 
diff --git a/lldb/source/API/SBCommunication.cpp b/lldb/source/API/SBCommunication.cpp
index ee33e2abd854e..565b37f52b34a 100644
--- a/lldb/source/API/SBCommunication.cpp
+++ b/lldb/source/API/SBCommunication.cpp
@@ -171,5 +171,5 @@ const char *SBCommunication::GetBroadcasterClass() {
   LLDB_INSTRUMENT();
 
   return ConstString(ThreadedCommunication::GetStaticBroadcasterClass())
-      .AsCString();
+      .AsCString(nullptr);
 }
diff --git a/lldb/source/API/SBDebugger.cpp b/lldb/source/API/SBDebugger.cpp
index e97fdd0e352f2..4bba1e8ad0e37 100644
--- a/lldb/source/API/SBDebugger.cpp
+++ b/lldb/source/API/SBDebugger.cpp
@@ -113,7 +113,7 @@ SBDebugger &SBDebugger::operator=(const SBDebugger &rhs) {
 const char *SBDebugger::GetBroadcasterClass() {
   LLDB_INSTRUMENT();
 
-  return ConstString(Debugger::GetStaticBroadcasterClass()).AsCString();
+  return ConstString(Debugger::GetStaticBroadcasterClass()).AsCString(nullptr);
 }
 
 const char *SBDebugger::GetProgressFromEvent(const lldb::SBEvent &event,
@@ -132,7 +132,7 @@ const char *SBDebugger::GetProgressFromEvent(const lldb::SBEvent &event,
   total = progress_data->GetTotal();
   is_debugger_specific = progress_data->IsDebuggerSpecific();
   ConstString message(progress_data->GetMessage());
-  return message.AsCString();
+  return message.AsCString(nullptr);
 }
 
 lldb::SBStructuredData
@@ -1269,7 +1269,7 @@ const char *SBDebugger::GetInstanceName() {
   if (!m_opaque_sp)
     return nullptr;
 
-  return ConstString(m_opaque_sp->GetInstanceName()).AsCString();
+  return ConstString(m_opaque_sp->GetInstanceName()).AsCString(nullptr);
 }
 
 SBError SBDebugger::SetInternalVariable(const char *var_name, const char *value,
diff --git a/lldb/source/API/SBEvent.cpp b/lldb/source/API/SBEvent.cpp
index aa9c0ff097d45..9f09ff85e0340 100644
--- a/lldb/source/API/SBEvent.cpp
+++ b/lldb/source/API/SBEvent.cpp
@@ -96,7 +96,7 @@ const char *SBEvent::GetBroadcasterClass() const {
   const Event *lldb_event = get();
   if (lldb_event)
     return ConstString(lldb_event->GetBroadcaster()->GetBroadcasterClass())
-        .AsCString();
+        .AsCString(nullptr);
   else
     return "unknown class";
 }
diff --git a/lldb/source/API/SBFileSpec.cpp b/lldb/source/API/SBFileSpec.cpp
index a7df9afc4b8eb..9ce3602012efd 100644
--- a/lldb/source/API/SBFileSpec.cpp
+++ b/lldb/source/API/SBFileSpec.cpp
@@ -108,7 +108,7 @@ int SBFileSpec::ResolvePath(const char *src_path, char *dst_path,
 const char *SBFileSpec::GetFilename() const {
   LLDB_INSTRUMENT_VA(this);
 
-  return m_opaque_up->GetFilename().AsCString();
+  return m_opaque_up->GetFilename().AsCString(nullptr);
 }
 
 const char *SBFileSpec::GetDirectory() const {
diff --git a/lldb/source/API/SBFunction.cpp b/lldb/source/API/SBFunction.cpp
index 65b02d6b309ca..752e02dc54713 100644
--- a/lldb/source/API/SBFunction.cpp
+++ b/lldb/source/API/SBFunction.cpp
@@ -57,7 +57,7 @@ const char *SBFunction::GetName() const {
   LLDB_INSTRUMENT_VA(this);
 
   if (m_opaque_ptr)
-    return m_opaque_ptr->GetName().AsCString();
+    return m_opaque_ptr->GetName().AsCString(nullptr);
 
   return nullptr;
 }
@@ -66,7 +66,8 @@ const char *SBFunction::GetDisplayName() const {
   LLDB_INSTRUMENT_VA(this);
 
   if (m_opaque_ptr)
-    return m_opaque_ptr->GetMangled().GetDisplayDemangledName().AsCString();
+    return m_opaque_ptr->GetMangled().GetDisplayDemangledName().AsCString(
+        nullptr);
 
   return nullptr;
 }
@@ -75,7 +76,7 @@ const char *SBFunction::GetMangledName() const {
   LLDB_INSTRUMENT_VA(this);
 
   if (m_opaque_ptr)
-    return m_opaque_ptr->GetMangled().GetMangledName().AsCString();
+    return m_opaque_ptr->GetMangled().GetMangledName().AsCString(nullptr);
   return nullptr;
 }
 
@@ -85,7 +86,7 @@ const char *SBFunction::GetBaseName() const {
   if (!m_opaque_ptr)
     return nullptr;
 
-  return m_opaque_ptr->GetMangled().GetBaseName().AsCString();
+  return m_opaque_ptr->GetMangled().GetBaseName().AsCString(nullptr);
 }
 
 bool SBFunction::operator==(const SBFunction &rhs) const {
@@ -105,10 +106,10 @@ bool SBFunction::GetDescription(SBStream &s) {
 
   if (m_opaque_ptr) {
     s.Printf("SBFunction: id = 0x%8.8" PRIx64 ", name = %s",
-             m_opaque_ptr->GetID(), m_opaque_ptr->GetName().AsCString());
+             m_opaque_ptr->GetID(), m_opaque_ptr->GetName().AsCString(nullptr));
     Type *func_type = m_opaque_ptr->GetType();
     if (func_type)
-      s.Printf(", type = %s", func_type->GetName().AsCString());
+      s.Printf(", type = %s", func_type->GetName().AsCString(nullptr));
     return true;
   }
   s.Printf("No value");
diff --git a/lldb/source/API/SBLanguageRuntime.cpp b/lldb/source/API/SBLanguageRuntime.cpp
index 958652ab6f136..036a5e56e4569 100644
--- a/lldb/source/API/SBLanguageRuntime.cpp
+++ b/lldb/source/API/SBLanguageRuntime.cpp
@@ -56,13 +56,13 @@ bool SBLanguageRuntime::SupportsExceptionBreakpointsOnCatch(
 const char *
 SBLanguageRuntime::GetThrowKeywordForLanguage(lldb::LanguageType language) {
   if (Language *lang_plugin = Language::FindPlugin(language))
-    return ConstString(lang_plugin->GetThrowKeyword()).AsCString();
+    return ConstString(lang_plugin->GetThrowKeyword()).AsCString(nullptr);
   return nullptr;
 }
 
 const char *
 SBLanguageRuntime::GetCatchKeywordForLanguage(lldb::LanguageType language) {
   if (Language *lang_plugin = Language::FindPlugin(language))
-    return ConstString(lang_plugin->GetCatchKeyword()).AsCString();
+    return ConstString(lang_plugin->GetCatchKeyword()).AsCString(nullptr);
   return nullptr;
 }
diff --git a/lldb/source/API/SBLaunchInfo.cpp b/lldb/source/API/SBLaunchInfo.cpp
index d6b52e8a67a49..07a450dae3771 100644
--- a/lldb/source/API/SBLaunchInfo.cpp
+++ b/lldb/source/API/SBLaunchInfo.cpp
@@ -210,7 +210,8 @@ void SBLaunchInfo::Clear() {
 const char *SBLaunchInfo::GetWorkingDirectory() const {
   LLDB_INSTRUMENT_VA(this);
 
-  return m_opaque_sp->GetWorkingDirectory().GetPathAsConstString().AsCString();
+  return m_opaque_sp->GetWorkingDirectory().GetPathAsConstString().AsCString(
+      nullptr);
 }
 
 void SBLaunchInfo::SetWorkingDirectory(const char *working_dir) {
@@ -249,7 +250,7 @@ const char *SBLaunchInfo::GetShell() {
   // Constify this string so that it is saved in the string pool.  Otherwise it
   // would be freed when this function goes out of scope.
   ConstString shell(m_opaque_sp->GetShell().GetPath().c_str());
-  return shell.AsCString();
+  return shell.AsCString(nullptr);
 }
 
 void SBLaunchInfo::SetShell(const char *path) {
@@ -342,7 +343,7 @@ const char *SBLaunchInfo::GetScriptedProcessClassName() const {
   // Constify this string so that it is saved in the string pool.  Otherwise it
   // would be freed when this function goes out of scope.
   ConstString class_name(metadata_sp->GetClassName().data());
-  return class_name.AsCString();
+  return class_name.AsCString(nullptr);
 }
 
 void SBLaunchInfo::SetScriptedProcessClassName(const char *class_name) {
diff --git a/lldb/source/API/SBMemoryRegionInfo.cpp b/lldb/source/API/SBMemoryRegionInfo.cpp
index cd25be5d52769..7e1a381b6078d 100644
--- a/lldb/source/API/SBMemoryRegionInfo.cpp
+++ b/lldb/source/API/SBMemoryRegionInfo.cpp
@@ -121,7 +121,7 @@ bool SBMemoryRegionInfo::IsMapped() {
 const char *SBMemoryRegionInfo::GetName() {
   LLDB_INSTRUMENT_VA(this);
 
-  return m_opaque_up->GetName().AsCString();
+  return m_opaque_up->GetName().AsCString(nullptr);
 }
 
 bool SBMemoryRegionInfo::HasDirtyMemoryPageList() {
diff --git a/lldb/source/API/SBModule.cpp b/lldb/source/API/SBModule.cpp
index c48d1abd88c56..ea0cb2ae356b8 100644
--- a/lldb/source/API/SBModule.cpp
+++ b/lldb/source/API/SBModule.cpp
@@ -684,5 +684,5 @@ const char *SBModule::GetObjectName() const {
 
   if (!m_opaque_sp)
     return nullptr;
-  return m_opaque_sp->GetObjectName().AsCString();
+  return m_opaque_sp->GetObjectName().AsCString(nullptr);
 }
diff --git a/lldb/source/API/SBPlatform.cpp b/lldb/source/API/SBPlatform.cpp
index 567744e36829f..15b000cdf3661 100644
--- a/lldb/source/API/SBPlatform.cpp
+++ b/lldb/source/API/SBPlatform.cpp
@@ -347,7 +347,7 @@ const char *SBPlatform::GetName() {
 
   PlatformSP platform_sp(GetSP());
   if (platform_sp)
-    return ConstString(platform_sp->GetName()).AsCString();
+    return ConstString(platform_sp->GetName()).AsCString(nullptr);
   return nullptr;
 }
 
@@ -362,7 +362,8 @@ const char *SBPlatform::GetWorkingDirectory() {
 
   PlatformSP platform_sp(GetSP());
   if (platform_sp)
-    return platform_sp->GetWorkingDirectory().GetPathAsConstString().AsCString();
+    return platform_sp->GetWorkingDirectory().GetPathAsConstString().AsCString(
+        nullptr);
   return nullptr;
 }
 
diff --git a/lldb/source/API/SBProcess.cpp b/lldb/source/API/SBProcess.cpp
index 14aa9432eed83..14ce236b4f1b5 100644
--- a/lldb/source/API/SBProcess.cpp
+++ b/lldb/source/API/SBProcess.cpp
@@ -81,7 +81,7 @@ SBProcess::~SBProcess() = default;
 const char *SBProcess::GetBroadcasterClassName() {
   LLDB_INSTRUMENT();
 
-  return ConstString(Process::GetStaticBroadcasterClass()).AsCString();
+  return ConstString(Process::GetStaticBroadcasterClass()).AsCString(nullptr);
 }
 
 const char *SBProcess::GetPluginName() {
@@ -824,7 +824,7 @@ SBBroadcaster SBProcess::GetBroadcaster() const {
 const char *SBProcess::GetBroadcasterClass() {
   LLDB_INSTRUMENT();
 
-  return ConstString(Process::GetStaticBroadcasterClass()).AsCString();
+  return ConstString(Process::GetStaticBroadcasterClass()).AsCString(nullptr);
 }
 
 lldb::SBAddressRangeList SBProcess::FindRangesInMemory(
@@ -1014,7 +1014,7 @@ bool SBProcess::GetDescription(SBStream &description) {
     Module *exe_module = process_sp->GetTarget().GetExecutableModulePointer();
     const char *exe_name = nullptr;
     if (exe_module)
-      exe_name = exe_module->GetFileSpec().GetFilename().AsCString();
+      exe_name = exe_module->GetFileSpec().GetFilename().AsCString(nullptr);
 
     strm.Printf("SBProcess: pid = %" PRIu64 ", state = %s, threads = %d%s%s",
                 process_sp->GetID(), lldb_private::StateAsCString(GetState()),
@@ -1196,7 +1196,7 @@ const char *SBProcess::GetExtendedBacktraceTypeAtIndex(uint32_t idx) {
     const std::vector<ConstString> &names =
         runtime->GetExtendedBacktraceTypes();
     if (idx < names.size()) {
-      return names[idx].AsCString();
+      return names[idx].AsCString(nullptr);
     }
   }
   return nullptr;
diff --git a/lldb/source/API/SBSymbol.cpp b/lldb/source/API/SBSymbol.cpp
index bbaf074295b89..19f2f5e62fd48 100644
--- a/lldb/source/API/SBSymbol.cpp
+++ b/lldb/source/API/SBSymbol.cpp
@@ -55,7 +55,7 @@ const char *SBSymbol::GetName() const {
 
   const char *name = nullptr;
   if (m_opaque_ptr)
-    name = m_opaque_ptr->GetName().AsCString();
+    name = m_opaque_ptr->GetName().AsCString(nullptr);
 
   return name;
 }
@@ -65,7 +65,8 @@ const char *SBSymbol::GetDisplayName() const {
 
   const char *name = nullptr;
   if (m_opaque_ptr)
-    name = m_opaque_ptr->GetMangled().GetDisplayDemangledName().AsCString();
+    name =
+        m_opaque_ptr->GetMangled().GetDisplayDemangledName().AsCString(nullptr);
 
   return name;
 }
@@ -75,7 +76,7 @@ const char *SBSymbol::GetMangledName() const {
 
   const char *name = nullptr;
   if (m_opaque_ptr)
-    name = m_opaque_ptr->GetMangled().GetMangledName().AsCString();
+    name = m_opaque_ptr->GetMangled().GetMangledName().AsCString(nullptr);
   return name;
 }
 
@@ -85,7 +86,7 @@ const char *SBSymbol::GetBaseName() const {
   if (!m_opaque_ptr)
     return nullptr;
 
-  return m_opaque_ptr->GetMangled().GetBaseName().AsCString();
+  return m_opaque_ptr->GetMangled().GetBaseName().AsCString(nullptr);
 }
 
 bool SBSymbol::operator==(const SBSymbol &rhs) const {
diff --git a/lldb/source/API/SBTarget.cpp b/lldb/source/API/SBTarget.cpp
index 32046802c5ce7..fd35208196781 100644
--- a/lldb/source/API/SBTarget.cpp
+++ b/lldb/source/API/SBTarget.cpp
@@ -158,7 +158,7 @@ SBModule SBTarget::GetModuleAtIndexFromEvent(const uint32_t idx,
 const char *SBTarget::GetBroadcasterClassName() {
   LLDB_INSTRUMENT();
 
-  return ConstString(Target::GetStaticBroadcasterClass()).AsCString();
+  return ConstString(Target::GetStaticBroadcasterClass()).AsCString(nullptr);
 }
 
 bool SBTarget::IsValid() const {
@@ -1652,7 +1652,7 @@ const char *SBTarget::GetLabel() const {
   LLDB_INSTRUMENT_VA(this);
 
   if (TargetSP target_sp = GetSP())
-    return ConstString(target_sp->GetLabel().data()).AsCString();
+    return ConstString(target_sp->GetLabel().data()).AsCString(nullptr);
   return nullptr;
 }
 
@@ -1668,7 +1668,7 @@ const char *SBTarget::GetTargetSessionName() const {
   LLDB_INSTRUMENT_VA(this);
 
   if (TargetSP target_sp = GetSP())
-    return ConstString(target_sp->GetTargetSessionName()).AsCString();
+    return ConstString(target_sp->GetTargetSessionName()).AsCString(nullptr);
   return nullptr;
 }
 
diff --git a/lldb/source/API/SBThread.cpp b/lldb/source/API/SBThread.cpp
index 9efc39c70d1a4..e3a8ee6950ed5 100644
--- a/lldb/source/API/SBThread.cpp
+++ b/lldb/source/API/SBThread.cpp
@@ -54,7 +54,7 @@ using namespace lldb_private;
 const char *SBThread::GetBroadcasterClassName() {
   LLDB_INSTRUMENT();
 
-  return ConstString(Thread::GetStaticBroadcasterClass()).AsCString();
+  return ConstString(Thread::GetStaticBroadcasterClass()).AsCString(nullptr);
 }
 
 // Constructors
@@ -579,7 +579,7 @@ void SBThread::StepInto(const char *target_name, uint32_t end_line,
   if (new_plan_status.Success())
     error = ResumeNewPlan(std::move(*exe_ctx), new_plan_sp.get());
   else
-    error = Status::FromErrorString(new_plan_status.AsCString());
+    error = Status::FromErrorString(new_plan_status.AsCString(nullptr));
 }
 
 void SBThread::StepOut() {
@@ -618,7 +618,7 @@ void SBThread::StepOut(SBError &error) {
   if (new_plan_status.Success())
     error = ResumeNewPlan(std::move(*exe_ctx), new_plan_sp.get());
   else
-    error = Status::FromErrorString(new_plan_status.AsCString());
+    error = Status::FromErrorString(new_plan_status.AsCString(nullptr));
 }
 
 void SBThread::StepOutOfFrame(SBFrame &sb_frame) {
@@ -666,7 +666,7 @@ void SBThread::StepOutOfFrame(SBFrame &sb_frame, SBError &error) {
   if (new_plan_status.Success())
     error = ResumeNewPlan(std::move(*exe_ctx), new_plan_sp.get());
   else
-    error = Status::FromErrorString(new_plan_status.AsCString());
+    error = Status::FromErrorString(new_plan_status.AsCString(nullptr));
 }
 
 void SBThread::StepInstruction(bool step_over) {
@@ -699,7 +699,7 @@ void SBThread::StepInstruction(bool step_over, SBError &error) {
   if (new_plan_status.Success())
     error = ResumeNewPlan(std::move(*exe_ctx), new_plan_sp.get());
   else
-    error = Status::FromErrorString(new_plan_status.AsCString());
+    error = Status::FromErrorString(new_plan_status.AsCString(nullptr));
 }
 
 void SBThread::RunToAddress(lldb::addr_t addr) {
@@ -738,7 +738,7 @@ void SBThread::RunToAddress(lldb::addr_t addr, SBError &error) {
   if (new_plan_status.Success())
     error = ResumeNewPlan(std::move(*exe_ctx), new_plan_sp.get());
   else
-    error = Status::FromErrorString(new_plan_status.AsCString());
+    error = Status::FromErrorString(new_plan_status.AsCString(nullptr));
 }
 
 SBError SBThread::StepOverUntil(lldb::SBFrame &sb_frame,
@@ -853,7 +853,7 @@ SBError SBThread::StepOverUntil(lldb::SBFrame &sb_frame,
       if (new_plan_status.Success())
         sb_error = ResumeNewPlan(std::move(*exe_ctx), new_plan_sp.get());
       else
-        sb_error = Status::FromErrorString(new_plan_status.AsCString());
+        sb_error = Status::FromErrorString(new_plan_status.AsCString(nullptr));
     }
   } else {
     sb_error = Status::FromErrorString("this SBThread object is invalid");
@@ -901,7 +901,7 @@ SBError SBThread::StepUsingScriptedThreadPlan(const char *script_class_name,
       false, script_class_name, obj_sp, false, new_plan_status);
 
   if (new_plan_status.Fail()) {
-    error = Status::FromErrorString(new_plan_status.AsCString());
+    error = Status::FromErrorString(new_plan_status.AsCString(nullptr));
     return error;
   }
 
@@ -911,7 +911,7 @@ SBError SBThread::StepUsingScriptedThreadPlan(const char *script_class_name,
   if (new_plan_status.Success())
     error = ResumeNewPlan(std::move(*exe_ctx), new_plan_sp.get());
   else
-    error = Status::FromErrorString(new_plan_status.AsCString());
+    error = Status::FromErrorString(new_plan_status.AsCString(nullptr));
 
   return error;
 }
diff --git a/lldb/source/API/SBThreadPlan.cpp b/lldb/source/API/SBThreadPlan.cpp
index c8ca6c81a3efb..4778c79cb004f 100644
--- a/lldb/source/API/SBThreadPlan.cpp
+++ b/lldb/source/API/SBThreadPlan.cpp
@@ -240,7 +240,7 @@ SBThreadPlan SBThreadPlan::QueueThreadPlanForStepOverRange(
             false, range, sc, eAllThreads, plan_status));
 
     if (plan_status.Fail())
-      error.SetErrorString(plan_status.AsCString());
+      error.SetErrorString(plan_status.AsCString(nullptr));
     else
       plan.GetSP()->SetPrivate(true);
 
@@ -280,7 +280,7 @@ SBThreadPlan::QueueThreadPlanForStepInRange(SBAddress &sb_start_address,
             false, range, sc, nullptr, eAllThreads, plan_status));
 
     if (plan_status.Fail())
-      error.SetErrorString(plan_status.AsCString());
+      error.SetErrorString(plan_status.AsCString(nullptr));
     else
       plan.GetSP()->SetPrivate(true);
 
@@ -316,7 +316,7 @@ SBThreadPlan::QueueThreadPlanForStepOut(uint32_t frame_idx_to_step_to,
             frame_idx_to_step_to, plan_status));
 
     if (plan_status.Fail())
-      error.SetErrorString(plan_status.AsCString());
+      error.SetErrorString(plan_status.AsCString(nullptr));
     else
       plan.GetSP()->SetPrivate(true);
 
@@ -338,7 +338,7 @@ SBThreadPlan::QueueThreadPlanForStepSingleInstruction(bool step_over,
             step_over, false, false, plan_status));
 
     if (plan_status.Fail())
-      error.SetErrorString(plan_status.AsCString());
+      error.SetErrorString(plan_status.AsCString(nullptr));
     else
       plan.GetSP()->SetPrivate(true);
 
@@ -372,7 +372,7 @@ SBThreadPlan SBThreadPlan::QueueThreadPlanForRunToAddress(SBAddress sb_address,
             false, *address, false, plan_status));
 
     if (plan_status.Fail())
-      error.SetErrorString(plan_status.AsCString());
+      error.SetErrorString(plan_status.AsCString(nullptr));
     else
       plan.GetSP()->SetPrivate(true);
 
@@ -403,7 +403,7 @@ SBThreadPlan::QueueThreadPlanForStepScripted(const char *script_class_name,
             false, script_class_name, empty_args, false, plan_status));
 
     if (plan_status.Fail())
-      error.SetErrorString(plan_status.AsCString());
+      error.SetErrorString(plan_status.AsCString(nullptr));
     else
       plan.GetSP()->SetPrivate(true);
 
@@ -427,7 +427,7 @@ SBThreadPlan::QueueThreadPlanForStepScripted(const char *script_class_name,
             false, script_class_name, args_obj, false, plan_status));
 
     if (plan_status.Fail())
-      error.SetErrorString(plan_status.AsCString());
+      error.SetErrorString(plan_status.AsCString(nullptr));
     else
       plan.GetSP()->SetPrivate(true);
 
diff --git a/lldb/source/API/SBValue.cpp b/lldb/source/API/SBValue.cpp
index 6b7a2edc616f0..861ab9a293b2b 100644
--- a/lldb/source/API/SBValue.cpp
+++ b/lldb/source/API/SBValue.cpp
@@ -107,8 +107,8 @@ SBError SBValue::GetError() {
   if (value_sp)
     sb_error.SetError(value_sp->GetError().Clone());
   else
-    sb_error = Status::FromErrorStringWithFormat("error: %s",
-                                                 locker.GetError().AsCString());
+    sb_error = Status::FromErrorStringWithFormat(
+        "error: %s", locker.GetError().AsCString(nullptr));
 
   return sb_error;
 }
@@ -219,7 +219,7 @@ const char *SBValue::GetObjectDescription() {
     llvm::consumeError(str.takeError());
     return nullptr;
   }
-  return ConstString(*str).AsCString();
+  return ConstString(*str).AsCString(nullptr);
 }
 
 SBType SBValue::GetType() {
@@ -304,8 +304,8 @@ bool SBValue::SetValueFromCString(const char *value_str, lldb::SBError &error) {
   if (value_sp) {
     success = value_sp->SetValueFromCString(value_str, error.ref());
   } else
-    error = Status::FromErrorStringWithFormat("Could not get value: %s",
-                                              locker.GetError().AsCString());
+    error = Status::FromErrorStringWithFormat(
+        "Could not get value: %s", locker.GetError().AsCString(nullptr));
 
   return success;
 }
@@ -750,8 +750,8 @@ int64_t SBValue::GetValueAsSigned(SBError &error, int64_t fail_value) {
       error = Status::FromErrorString("could not resolve value");
     return ret_val;
   } else
-    error = Status::FromErrorStringWithFormat("could not get SBValue: %s",
-                                              locker.GetError().AsCString());
+    error = Status::FromErrorStringWithFormat(
+        "could not get SBValue: %s", locker.GetError().AsCString(nullptr));
 
   return fail_value;
 }
@@ -770,8 +770,8 @@ uint64_t SBValue::GetValueAsUnsigned(SBError &error, uint64_t fail_value) {
       error = Status::FromErrorString("could not resolve value");
     return ret_val;
   } else
-    error = Status::FromErrorStringWithFormat("could not get SBValue: %s",
-                                              locker.GetError().AsCString());
+    error = Status::FromErrorStringWithFormat(
+        "could not get SBValue: %s", locker.GetError().AsCString(nullptr));
 
   return fail_value;
 }
@@ -1293,14 +1293,14 @@ bool SBValue::SetData(lldb::SBData &data, SBError &error) {
 
       if (!set_error.Success()) {
         error = Status::FromErrorStringWithFormat("Couldn't set data: %s",
-                                                  set_error.AsCString());
+                                                  set_error.AsCString(nullptr));
         ret = false;
       }
     }
   } else {
     error = Status::FromErrorStringWithFormat(
         "Couldn't set data: could not get SBValue: %s",
-        locker.GetError().AsCString());
+        locker.GetError().AsCString(nullptr));
     ret = false;
   }
 
@@ -1391,8 +1391,8 @@ lldb::SBWatchpoint SBValue::Watch(bool resolve_location, bool read, bool write,
       }
     }
   } else if (target_sp) {
-    error = Status::FromErrorStringWithFormat("could not get SBValue: %s",
-                                              locker.GetError().AsCString());
+    error = Status::FromErrorStringWithFormat(
+        "could not get SBValue: %s", locker.GetError().AsCString(nullptr));
   } else {
     error = Status::FromErrorString(
         "could not set watchpoint, a target is required");
diff --git a/lldb/source/API/SBWatchpoint.cpp b/lldb/source/API/SBWatchpoint.cpp
index 21e2dcc01968e..30528b8d34652 100644
--- a/lldb/source/API/SBWatchpoint.cpp
+++ b/lldb/source/API/SBWatchpoint.cpp
@@ -326,7 +326,7 @@ const char *SBWatchpoint::GetWatchSpec() {
   // so that the C string we return has a sufficiently long
   // lifetime. Note this a memory leak but should be fairly
   // low impact.
-  return ConstString(watchpoint_sp->GetWatchSpec()).AsCString();
+  return ConstString(watchpoint_sp->GetWatchSpec()).AsCString(nullptr);
 }
 
 bool SBWatchpoint::IsWatchingReads() {
diff --git a/lldb/source/Breakpoint/Breakpoint.cpp b/lldb/source/Breakpoint/Breakpoint.cpp
index 201d8d20c4901..94a7b6a86f678 100644
--- a/lldb/source/Breakpoint/Breakpoint.cpp
+++ b/lldb/source/Breakpoint/Breakpoint.cpp
@@ -172,7 +172,7 @@ lldb::BreakpointSP Breakpoint::CreateFromStructuredData(
     if (create_error.Fail()) {
       error = Status::FromErrorStringWithFormat(
           "Error creating breakpoint filter from data: %s.",
-          create_error.AsCString());
+          create_error.AsCString(nullptr));
       return result_sp;
     }
   }
@@ -188,7 +188,7 @@ lldb::BreakpointSP Breakpoint::CreateFromStructuredData(
     if (create_error.Fail()) {
       error = Status::FromErrorStringWithFormat(
           "Error creating breakpoint options from data: %s.",
-          create_error.AsCString());
+          create_error.AsCString(nullptr));
       return result_sp;
     }
   }
diff --git a/lldb/source/Breakpoint/BreakpointIDList.cpp b/lldb/source/Breakpoint/BreakpointIDList.cpp
index 8c46b39c02a9e..1c41261f5b158 100644
--- a/lldb/source/Breakpoint/BreakpointIDList.cpp
+++ b/lldb/source/Breakpoint/BreakpointIDList.cpp
@@ -98,7 +98,7 @@ llvm::Error BreakpointIDList::FindAndReplaceIDRanges(
       if (!error.Success()) {
         new_args.Clear();
         return llvm::createStringError(llvm::inconvertibleErrorCode(),
-                                       error.AsCString());
+                                       error.AsCString(nullptr));
       }
       names_found.insert(std::string(current_arg));
     } else if ((i + 2 < old_args.size()) &&
diff --git a/lldb/source/Breakpoint/BreakpointLocation.cpp b/lldb/source/Breakpoint/BreakpointLocation.cpp
index 4bc6fff70c894..e8b7724715f72 100644
--- a/lldb/source/Breakpoint/BreakpointLocation.cpp
+++ b/lldb/source/Breakpoint/BreakpointLocation.cpp
@@ -252,7 +252,7 @@ bool BreakpointLocation::ConditionSaysStop(ExecutionContext &exe_ctx,
         error));
     if (error.Fail()) {
       LLDB_LOGF(log, "Error getting condition expression: %s.",
-                error.AsCString());
+                error.AsCString(nullptr));
       m_user_expression_sp.reset();
       return true;
     }
@@ -618,7 +618,7 @@ void BreakpointLocation::GetDescription(Stream *s,
                   sc.function->GetMangled().GetMangledName()) {
             s->EOL();
             s->Indent("mangled function = ");
-            s->PutCString(mangled_name.AsCString());
+            s->PutCString(mangled_name.AsCString(nullptr));
           }
         }
 
diff --git a/lldb/source/Breakpoint/BreakpointOptions.cpp b/lldb/source/Breakpoint/BreakpointOptions.cpp
index b0b794f0f93bf..90231b980c02a 100644
--- a/lldb/source/Breakpoint/BreakpointOptions.cpp
+++ b/lldb/source/Breakpoint/BreakpointOptions.cpp
@@ -287,7 +287,7 @@ std::unique_ptr<BreakpointOptions> BreakpointOptions::CreateFromStructuredData(
     if (cmds_error.Fail()) {
       error = Status::FromErrorStringWithFormat(
           "Failed to deserialize breakpoint command options: %s.",
-          cmds_error.AsCString());
+          cmds_error.AsCString(nullptr));
       return nullptr;
     }
   }
@@ -317,7 +317,7 @@ std::unique_ptr<BreakpointOptions> BreakpointOptions::CreateFromStructuredData(
           interp->SetBreakpointCommandCallback(*bp_options, cmd_data_up);
       if (script_error.Fail()) {
         error = Status::FromErrorStringWithFormat(
-            "Error generating script callback: %s.", error.AsCString());
+            "Error generating script callback: %s.", error.AsCString(nullptr));
         return nullptr;
       }
     }
@@ -334,7 +334,7 @@ std::unique_ptr<BreakpointOptions> BreakpointOptions::CreateFromStructuredData(
     if (thread_spec_error.Fail()) {
       error = Status::FromErrorStringWithFormat(
           "Failed to deserialize breakpoint thread spec options: %s.",
-          thread_spec_error.AsCString());
+          thread_spec_error.AsCString(nullptr));
       return nullptr;
     }
     bp_options->SetThreadSpec(thread_spec_up);
diff --git a/lldb/source/Breakpoint/BreakpointResolverFileRegex.cpp b/lldb/source/Breakpoint/BreakpointResolverFileRegex.cpp
index 05fa7b9309688..ccdb554ff27e3 100644
--- a/lldb/source/Breakpoint/BreakpointResolverFileRegex.cpp
+++ b/lldb/source/Breakpoint/BreakpointResolverFileRegex.cpp
@@ -123,7 +123,7 @@ Searcher::CallbackReturn BreakpointResolverFileRegex::SearchCallback(
             sc_ctx
                 .GetFunctionName(
                     Mangled::NamePreference::ePreferDemangledWithoutArguments)
-                .AsCString());
+                .AsCString(nullptr));
         if (!m_function_names.count(name)) {
           sc_to_remove.push_back(i);
         }
diff --git a/lldb/source/Commands/CommandObjectBreakpoint.cpp b/lldb/source/Commands/CommandObjectBreakpoint.cpp
index d78374ddd6edf..e81c62ec02b89 100644
--- a/lldb/source/Commands/CommandObjectBreakpoint.cpp
+++ b/lldb/source/Commands/CommandObjectBreakpoint.cpp
@@ -637,7 +637,7 @@ class CommandObjectBreakpointAddException : public CommandObjectParsed {
     if (precond_error.Fail()) {
       result.AppendErrorWithFormat(
           "Error setting extra exception arguments: %s",
-          precond_error.AsCString());
+          precond_error.AsCString(nullptr));
       target.RemoveBreakpointByID(bp_sp->GetID());
       return;
     }
@@ -1422,7 +1422,8 @@ class CommandObjectBreakpointAddScripted : public CommandObjectParsed {
         m_python_class_options.GetStructuredData(), &error);
     if (error.Fail()) {
       result.AppendErrorWithFormat(
-          "error setting extra exception arguments: %s", error.AsCString());
+          "error setting extra exception arguments: %s",
+          error.AsCString(nullptr));
       target.RemoveBreakpointByID(bp_sp->GetID());
       return;
     }
@@ -1720,8 +1721,9 @@ class CommandObjectBreakpointSet : public CommandObjectParsed {
         OptionValueFileColonLine value;
         Status fcl_err = value.SetValueFromString(option_arg);
         if (!fcl_err.Success()) {
-          error = Status::FromError(CreateOptionParsingError(
-              option_arg, short_option, long_option, fcl_err.AsCString()));
+          error = Status::FromError(
+              CreateOptionParsingError(option_arg, short_option, long_option,
+                                       fcl_err.AsCString(nullptr)));
         } else {
           m_filenames.AppendIfUnique(value.GetFileSpec());
           m_line_num = value.GetLineNumber();
@@ -1957,7 +1959,7 @@ class CommandObjectBreakpointSet : public CommandObjectParsed {
       if (precond_error.Fail()) {
         result.AppendErrorWithFormat(
             "Error setting extra exception arguments: %s",
-            precond_error.AsCString());
+            precond_error.AsCString(nullptr));
         target.RemoveBreakpointByID(bp_sp->GetID());
         return;
       }
@@ -1971,7 +1973,8 @@ class CommandObjectBreakpointSet : public CommandObjectParsed {
           m_python_class_options.GetStructuredData(), &error);
       if (error.Fail()) {
         result.AppendErrorWithFormat(
-            "Error setting extra exception arguments: %s", error.AsCString());
+            "Error setting extra exception arguments: %s",
+            error.AsCString(nullptr));
         target.RemoveBreakpointByID(bp_sp->GetID());
         return;
       }
@@ -2921,7 +2924,7 @@ class CommandObjectBreakpointNameConfigure : public CommandObjectParsed {
       Status error;
       if (!BreakpointID::StringIsBreakpointName(entry.ref(), error)) {
         result.AppendErrorWithFormat("Invalid breakpoint name: %s - %s",
-                                     entry.c_str(), error.AsCString());
+                                     entry.c_str(), error.AsCString(nullptr));
         return;
       }
     }
@@ -3343,8 +3346,9 @@ class CommandObjectBreakpointRead : public CommandObjectParsed {
         Status name_error;
         if (!BreakpointID::StringIsBreakpointName(llvm::StringRef(option_arg),
                                                   name_error)) {
-          error = Status::FromError(CreateOptionParsingError(
-              option_arg, short_option, long_option, name_error.AsCString()));
+          error = Status::FromError(
+              CreateOptionParsingError(option_arg, short_option, long_option,
+                                       name_error.AsCString(nullptr)));
         }
         m_names.push_back(std::string(option_arg));
         break;
@@ -3456,7 +3460,7 @@ class CommandObjectBreakpointRead : public CommandObjectParsed {
                                                     m_options.m_names, new_bps);
 
     if (!error.Success()) {
-      result.AppendError(error.AsCString());
+      result.AppendError(error.AsCString(nullptr));
       return;
     }
 
@@ -3576,7 +3580,7 @@ class CommandObjectBreakpointWrite : public CommandObjectParsed {
                                                      m_options.m_append);
     if (!error.Success()) {
       result.AppendErrorWithFormat("error serializing breakpoints: %s.",
-                                   error.AsCString());
+                                   error.AsCString(nullptr));
     }
   }
 
diff --git a/lldb/source/Commands/CommandObjectCommands.cpp b/lldb/source/Commands/CommandObjectCommands.cpp
index 70f6955507593..73165540bb133 100644
--- a/lldb/source/Commands/CommandObjectCommands.cpp
+++ b/lldb/source/Commands/CommandObjectCommands.cpp
@@ -817,8 +817,8 @@ a number follows 'f':"
           Status error = AppendRegexSubstitution(line, check_only);
           if (error.Fail()) {
             if (!GetDebugger().GetCommandInterpreter().GetBatchCommandMode())
-              GetDebugger().GetAsyncOutputStream()->Printf("error: %s\n",
-                                                           error.AsCString());
+              GetDebugger().GetAsyncOutputStream()->Printf(
+                  "error: %s\n", error.AsCString(nullptr));
           }
         }
       }
@@ -873,7 +873,7 @@ a number follows 'f':"
       }
     }
     if (error.Fail()) {
-      result.AppendError(error.AsCString());
+      result.AppendError(error.AsCString(nullptr));
     }
   }
 
@@ -1099,7 +1099,7 @@ class CommandObjectPythonFunction : public CommandObjectRaw {
     if (!scripter || !scripter->RunScriptBasedCommand(
                          m_function_name.c_str(), raw_command_line, m_synchro,
                          result, error, m_exe_ctx)) {
-      result.AppendError(error.AsCString());
+      result.AppendError(error.AsCString(nullptr));
     } else {
       // Don't change the status if the command already set it...
       if (result.GetStatus() == eReturnStatusInvalid) {
@@ -1205,7 +1205,7 @@ class CommandObjectScriptingObjectRaw : public CommandObjectRaw {
     if (!scripter ||
         !scripter->RunScriptBasedCommand(m_cmd_obj_sp, raw_command_line,
                                          m_synchro, result, error, m_exe_ctx)) {
-      result.AppendError(error.AsCString());
+      result.AppendError(error.AsCString(nullptr));
     } else {
       // Don't change the status if the command already set it...
       if (result.GetStatus() == eReturnStatusInvalid) {
@@ -1835,11 +1835,11 @@ class CommandObjectScriptingObjectParsed : public CommandObjectParsed {
 
     if (opt_error.Fail())
       result.AppendErrorWithFormat("failed to parse option definitions: %s",
-                                   opt_error.AsCString());
+                                   opt_error.AsCString(nullptr));
     if (arg_error.Fail())
       result.AppendErrorWithFormat("%sfailed to parse argument definitions: %s",
-                                   opt_error.Fail() ? ", also " : "", 
-                                   arg_error.AsCString());
+                                   opt_error.Fail() ? ", also " : "",
+                                   arg_error.AsCString(nullptr));
 
     if (!result.Succeeded())
       return {};
@@ -2137,7 +2137,7 @@ class CommandObjectScriptingObjectParsed : public CommandObjectParsed {
     if (!scripter ||
         !scripter->RunScriptBasedParsedCommand(m_cmd_obj_sp, args,
                                          m_synchro, result, error, m_exe_ctx)) {
-      result.AppendError(error.AsCString());
+      result.AppendError(error.AsCString(nullptr));
     } else {
       // Don't change the status if the command already set it...
       if (result.GetStatus() == eReturnStatusInvalid) {
@@ -2256,7 +2256,7 @@ class CommandObjectCommandsScriptImport : public CommandObjectParsed {
         result.SetStatus(eReturnStatusSuccessFinishNoResult);
       } else {
         result.AppendErrorWithFormat("module importing failed: %s",
-                                     error.AsCString());
+                                     error.AsCString(nullptr));
       }
     }
   }
@@ -2419,7 +2419,7 @@ class CommandObjectCommandsScriptAdd : public CommandObjectParsed,
                 LockedStreamFile locked_stream = error_sp->Lock();
                 locked_stream.Printf(
                     "error: unable to add selected command: '%s'",
-                    error.AsCString());
+                    error.AsCString(nullptr));
               }
             } else {
               llvm::Error llvm_error = m_container->LoadUserSubcommand(
@@ -2481,7 +2481,7 @@ class CommandObjectCommandsScriptAdd : public CommandObjectParsed,
 
     if (path_error.Fail()) {
       result.AppendErrorWithFormat("error in command path: %s",
-                                   path_error.AsCString());
+                                   path_error.AsCString(nullptr));
       return;
     }
 
@@ -2542,7 +2542,7 @@ class CommandObjectCommandsScriptAdd : public CommandObjectParsed,
           m_interpreter.AddUserCommand(m_cmd_name, new_cmd_sp, m_overwrite);
       if (add_error.Fail())
         result.AppendErrorWithFormat("cannot add command: %s",
-                                     add_error.AsCString());
+                                     add_error.AsCString(nullptr));
     } else {
       llvm::Error llvm_error =
           m_container->LoadUserSubcommand(m_cmd_name, new_cmd_sp, m_overwrite);
@@ -2668,7 +2668,7 @@ class CommandObjectCommandsScriptDelete : public CommandObjectParsed {
                                                            error);
     if (error.Fail()) {
       result.AppendErrorWithFormat("could not resolve command path: %s",
-                                   error.AsCString());
+                                   error.AsCString(nullptr));
       return;
     }
     if (!container) {
@@ -2824,7 +2824,7 @@ class CommandObjectCommandsContainerAdd : public CommandObjectParsed {
           cmd_name, cmd_sp, m_options.m_overwrite);
       if (add_error.Fail()) {
         result.AppendErrorWithFormat("error adding command: %s",
-                                     add_error.AsCString());
+                                     add_error.AsCString(nullptr));
         return;
       }
       result.SetStatus(eReturnStatusSuccessFinishNoResult);
@@ -2839,7 +2839,7 @@ class CommandObjectCommandsContainerAdd : public CommandObjectParsed {
 
     if (!add_to_me) {
       result.AppendErrorWithFormat("error adding command: %s",
-                                   path_error.AsCString());
+                                   path_error.AsCString(nullptr));
       return;
     }
 
@@ -2934,7 +2934,7 @@ class CommandObjectCommandsContainerDelete : public CommandObjectParsed {
 
     if (!container) {
       result.AppendErrorWithFormat("error removing container command: %s",
-                                   path_error.AsCString());
+                                   path_error.AsCString(nullptr));
       return;
     }
     const char *leaf = command.GetArgumentAtIndex(num_args - 1);
diff --git a/lldb/source/Commands/CommandObjectFrame.cpp b/lldb/source/Commands/CommandObjectFrame.cpp
index 1488e3bfe5890..17e19ea95e56f 100644
--- a/lldb/source/Commands/CommandObjectFrame.cpp
+++ b/lldb/source/Commands/CommandObjectFrame.cpp
@@ -524,7 +524,7 @@ may even involve JITing and running code in the target program.)");
         frame->GetVariableList(m_option_variable.show_globals, &error);
 
     if (error.Fail() && (!variable_list || variable_list->GetSize() == 0)) {
-      result.AppendError(error.AsCString());
+      result.AppendError(error.AsCString(nullptr));
     }
 
     ValueObjectSP valobj_sp;
@@ -691,7 +691,7 @@ may even involve JITing and running code in the target program.)");
                 options.SetVariableFormatDisplayLanguage(
                     valobj_sp->GetPreferredDisplayLanguage());
                 options.SetRootValueObjectName(
-                    var_sp ? var_sp->GetName().AsCString() : nullptr);
+                    var_sp ? var_sp->GetName().AsCString(nullptr) : nullptr);
                 if (llvm::Error error =
                         valobj_sp->Dump(result.GetOutputStream(), options))
                   result.AppendError(toString(std::move(error)));
@@ -715,7 +715,8 @@ may even involve JITing and running code in the target program.)");
             options.SetFormat(m_option_format.GetFormat());
             options.SetVariableFormatDisplayLanguage(
                 rec_value_sp->GetPreferredDisplayLanguage());
-            options.SetRootValueObjectName(rec_value_sp->GetName().AsCString());
+            options.SetRootValueObjectName(
+                rec_value_sp->GetName().AsCString(nullptr));
             if (llvm::Error error =
                     rec_value_sp->Dump(result.GetOutputStream(), options))
               result.AppendError(toString(std::move(error)));
diff --git a/lldb/source/Commands/CommandObjectMemory.cpp b/lldb/source/Commands/CommandObjectMemory.cpp
index 21ee0f21b8e0e..87976bca7bf88 100644
--- a/lldb/source/Commands/CommandObjectMemory.cpp
+++ b/lldb/source/Commands/CommandObjectMemory.cpp
@@ -539,7 +539,7 @@ class CommandObjectMemoryRead : public CommandObjectParsed {
 
     // Look for invalid combinations of settings
     if (error.Fail()) {
-      result.AppendError(error.AsCString());
+      result.AppendError(error.AsCString(nullptr));
       return;
     }
 
@@ -582,7 +582,7 @@ class CommandObjectMemoryRead : public CommandObjectParsed {
 
     if (addr == LLDB_INVALID_ADDRESS) {
       result.AppendError("invalid start address expression.");
-      result.AppendError(error.AsCString());
+      result.AppendError(error.AsCString(nullptr));
       return;
     }
 
@@ -592,7 +592,7 @@ class CommandObjectMemoryRead : public CommandObjectParsed {
 
       if (end_addr == LLDB_INVALID_ADDRESS) {
         result.AppendError("invalid end address expression.");
-        result.AppendError(error.AsCString());
+        result.AppendError(error.AsCString(nullptr));
         return;
       } else if (end_addr <= addr) {
         result.AppendErrorWithFormat(
@@ -659,7 +659,7 @@ class CommandObjectMemoryRead : public CommandObjectParsed {
       bytes_read = target->ReadMemory(address, data_sp->GetBytes(),
                                       data_sp->GetByteSize(), error, true);
       if (bytes_read == 0) {
-        const char *error_cstr = error.AsCString();
+        const char *error_cstr = error.AsCString(nullptr);
         if (error_cstr && error_cstr[0]) {
           result.AppendError(error_cstr);
         } else {
@@ -1293,7 +1293,7 @@ class CommandObjectMemoryWrite : public CommandObjectParsed {
 
     if (addr == LLDB_INVALID_ADDRESS) {
       result.AppendError("invalid address expression\n");
-      result.AppendError(error.AsCString());
+      result.AppendError(error.AsCString(nullptr));
       return;
     }
 
@@ -1327,7 +1327,7 @@ class CommandObjectMemoryWrite : public CommandObjectParsed {
           } else {
             result.AppendErrorWithFormat("Memory write to 0x%" PRIx64
                                          " failed: %s.\n",
-                                         addr, error.AsCString());
+                                         addr, error.AsCString(nullptr));
           }
         }
       } else {
@@ -1447,7 +1447,7 @@ class CommandObjectMemoryWrite : public CommandObjectParsed {
         } else {
           result.AppendErrorWithFormat("Memory write to 0x%" PRIx64
                                        " failed: %s.\n",
-                                       addr, error.AsCString());
+                                       addr, error.AsCString(nullptr));
           return;
         }
         break;
@@ -1511,7 +1511,7 @@ class CommandObjectMemoryWrite : public CommandObjectParsed {
       if (write_size != buffer_size) {
         result.AppendErrorWithFormat("Memory write to 0x%" PRIx64
                                      " failed: %s.\n",
-                                     addr, error.AsCString());
+                                     addr, error.AsCString(nullptr));
         return;
       }
     }
@@ -1572,7 +1572,7 @@ class CommandObjectMemoryHistory : public CommandObjectParsed {
 
     if (addr == LLDB_INVALID_ADDRESS) {
       result.AppendError("invalid address expression");
-      result.AppendError(error.AsCString());
+      result.AppendError(error.AsCString(nullptr));
       return;
     }
 
@@ -1763,7 +1763,8 @@ class CommandObjectMemoryRegion : public CommandObjectParsed {
                                              LLDB_INVALID_ADDRESS, &error);
       if (error.Fail() || load_addr == LLDB_INVALID_ADDRESS) {
         result.AppendErrorWithFormat("invalid address argument \"%s\": %s\n",
-                                     command[0].c_str(), error.AsCString());
+                                     command[0].c_str(),
+                                     error.AsCString(nullptr));
         return;
       }
     } else {
@@ -1814,7 +1815,7 @@ class CommandObjectMemoryRegion : public CommandObjectParsed {
       return;
     }
 
-    result.AppendErrorWithFormat("%s\n", error.AsCString());
+    result.AppendErrorWithFormat("%s\n", error.AsCString(nullptr));
   }
 
   std::optional<std::string> GetRepeatCommand(Args &current_command_args,
diff --git a/lldb/source/Commands/CommandObjectMemoryTag.cpp b/lldb/source/Commands/CommandObjectMemoryTag.cpp
index 23fad06518366..062f8a81986fe 100644
--- a/lldb/source/Commands/CommandObjectMemoryTag.cpp
+++ b/lldb/source/Commands/CommandObjectMemoryTag.cpp
@@ -55,7 +55,7 @@ class CommandObjectMemoryTagRead : public CommandObjectParsed {
         &m_exe_ctx, command[0].ref(), LLDB_INVALID_ADDRESS, &error);
     if (start_addr == LLDB_INVALID_ADDRESS) {
       result.AppendErrorWithFormatv("Invalid address expression, {0}",
-                                    error.AsCString());
+                                    error.AsCString(nullptr));
       return;
     }
 
@@ -67,7 +67,7 @@ class CommandObjectMemoryTagRead : public CommandObjectParsed {
                                                LLDB_INVALID_ADDRESS, &error);
       if (end_addr == LLDB_INVALID_ADDRESS) {
         result.AppendErrorWithFormatv("Invalid end address expression, {0}",
-                                      error.AsCString());
+                                      error.AsCString(nullptr));
         return;
       }
     }
@@ -206,7 +206,7 @@ class CommandObjectMemoryTagWrite : public CommandObjectParsed {
         &m_exe_ctx, command[0].ref(), LLDB_INVALID_ADDRESS, &error);
     if (start_addr == LLDB_INVALID_ADDRESS) {
       result.AppendErrorWithFormatv("Invalid address expression, {0}",
-                                    error.AsCString());
+                                    error.AsCString(nullptr));
       return;
     }
 
diff --git a/lldb/source/Commands/CommandObjectPlatform.cpp b/lldb/source/Commands/CommandObjectPlatform.cpp
index 0bca26d89e18d..fce540a9067b9 100644
--- a/lldb/source/Commands/CommandObjectPlatform.cpp
+++ b/lldb/source/Commands/CommandObjectPlatform.cpp
@@ -184,7 +184,7 @@ class CommandObjectPlatformSelect : public CommandObjectParsed {
           platform_sp->GetStatus(result.GetOutputStream());
           result.SetStatus(eReturnStatusSuccessFinishResult);
         } else {
-          result.AppendError(error.AsCString());
+          result.AppendError(error.AsCString(nullptr));
         }
       } else {
         result.AppendError("invalid platform name");
@@ -294,10 +294,10 @@ class CommandObjectPlatformConnect : public CommandObjectParsed {
 
         platform_sp->ConnectToWaitingProcesses(GetDebugger(), error);
         if (error.Fail()) {
-          result.AppendError(error.AsCString());
+          result.AppendError(error.AsCString(nullptr));
         }
       } else {
-        result.AppendErrorWithFormat("%s\n", error.AsCString());
+        result.AppendErrorWithFormat("%s\n", error.AsCString(nullptr));
       }
     } else {
       result.AppendError("no platform is currently selected\n");
@@ -353,7 +353,7 @@ class CommandObjectPlatformDisconnect : public CommandObjectParsed {
               ostrm.Printf("Disconnected from \"%s\"\n", hostname.c_str());
             result.SetStatus(eReturnStatusSuccessFinishResult);
           } else {
-            result.AppendErrorWithFormat("%s", error.AsCString());
+            result.AppendErrorWithFormat("%s", error.AsCString(nullptr));
           }
         } else {
           // Not connected...
@@ -439,7 +439,7 @@ class CommandObjectPlatformMkDir : public CommandObjectParsed {
       if (error.Success()) {
         result.SetStatus(eReturnStatusSuccessFinishResult);
       } else {
-        result.AppendError(error.AsCString());
+        result.AppendError(error.AsCString(nullptr));
       }
     } else {
       result.AppendError("no platform currently selected\n");
@@ -492,7 +492,7 @@ class CommandObjectPlatformFOpen : public CommandObjectParsed {
         result.AppendMessageWithFormatv("File Descriptor = {0}", fd);
         result.SetStatus(eReturnStatusSuccessFinishResult);
       } else {
-        result.AppendError(error.AsCString());
+        result.AppendError(error.AsCString(nullptr));
       }
     } else {
       result.AppendError("no platform currently selected\n");
@@ -540,7 +540,7 @@ class CommandObjectPlatformFClose : public CommandObjectParsed {
         result.AppendMessageWithFormatv("file {0} closed.", fd);
         result.SetStatus(eReturnStatusSuccessFinishResult);
       } else {
-        result.AppendError(error.AsCString());
+        result.AppendError(error.AsCString(nullptr));
       }
     } else {
       result.AppendError("no platform currently selected\n");
@@ -585,7 +585,7 @@ class CommandObjectPlatformFRead : public CommandObjectParsed {
         result.AppendMessageWithFormatv("Data = \"{0}\"", buffer.c_str());
         result.SetStatus(eReturnStatusSuccessFinishResult);
       } else {
-        result.AppendError(error.AsCString());
+        result.AppendError(error.AsCString(nullptr));
       }
     } else {
       result.AppendError("no platform currently selected\n");
@@ -678,7 +678,7 @@ class CommandObjectPlatformFWrite : public CommandObjectParsed {
         result.AppendMessageWithFormatv("Return = {0}", retcode);
         result.SetStatus(eReturnStatusSuccessFinishResult);
       } else {
-        result.AppendError(error.AsCString());
+        result.AppendError(error.AsCString(nullptr));
       }
     } else {
       result.AppendError("no platform currently selected\n");
@@ -834,7 +834,7 @@ class CommandObjectPlatformGetFile : public CommandObjectParsed {
         result.SetStatus(eReturnStatusSuccessFinishResult);
       } else {
         result.AppendMessageWithFormatv("get-file failed: {0}",
-                                        error.AsCString());
+                                        error.AsCString(nullptr));
       }
     } else {
       result.AppendError("no platform currently selected\n");
@@ -929,7 +929,7 @@ class CommandObjectPlatformGetPermissions : public CommandObjectParsed {
             llvm::format("%04o", permissions));
         result.SetStatus(eReturnStatusSuccessFinishResult);
       } else
-        result.AppendError(error.AsCString());
+        result.AppendError(error.AsCString(nullptr));
     } else {
       result.AppendError("no platform currently selected\n");
     }
@@ -1031,7 +1031,7 @@ class CommandObjectPlatformPutFile : public CommandObjectParsed {
       if (error.Success()) {
         result.SetStatus(eReturnStatusSuccessFinishNoResult);
       } else {
-        result.AppendError(error.AsCString());
+        result.AppendError(error.AsCString(nullptr));
       }
     } else {
       result.AppendError("no platform currently selected\n");
@@ -1132,7 +1132,7 @@ class CommandObjectPlatformProcessLaunch : public CommandObjectParsed {
           result.AppendError("failed to launch or debug process");
           return;
         } else if (!error.Success()) {
-          result.AppendError(error.AsCString());
+          result.AppendError(error.AsCString(nullptr));
           return;
         }
 
@@ -1169,7 +1169,7 @@ class CommandObjectPlatformProcessLaunch : public CommandObjectParsed {
             if (!error.Success()) {
               result.AppendErrorWithFormat(
                   "process resume at entry point failed: %s",
-                  error.AsCString());
+                  error.AsCString(nullptr));
             }
           }
         } break;
@@ -1550,7 +1550,7 @@ class CommandObjectPlatformProcessAttach : public CommandObjectParsed {
       ProcessSP remote_process_sp = platform_sp->Attach(
           m_options.attach_info, GetDebugger(), nullptr, err);
       if (err.Fail()) {
-        result.AppendError(err.AsCString());
+        result.AppendError(err.AsCString(nullptr));
       } else if (!remote_process_sp) {
         result.AppendError("could not attach: unknown reason");
       } else
@@ -1735,7 +1735,7 @@ class CommandObjectPlatformShell : public CommandObjectRaw {
     }
 
     if (error.Fail()) {
-      result.AppendError(error.AsCString());
+      result.AppendError(error.AsCString(nullptr));
     } else {
       result.SetStatus(eReturnStatusSuccessFinishResult);
     }
@@ -1793,7 +1793,8 @@ class CommandObjectPlatformInstall : public CommandObjectParsed {
     if (error.Success()) {
       result.SetStatus(eReturnStatusSuccessFinishNoResult);
     } else {
-      result.AppendErrorWithFormat("install failed: %s", error.AsCString());
+      result.AppendErrorWithFormat("install failed: %s",
+                                   error.AsCString(nullptr));
     }
   }
 };
diff --git a/lldb/source/Commands/CommandObjectPlugin.cpp b/lldb/source/Commands/CommandObjectPlugin.cpp
index c0ea20d0e9b22..67d310ac4b4d9 100644
--- a/lldb/source/Commands/CommandObjectPlugin.cpp
+++ b/lldb/source/Commands/CommandObjectPlugin.cpp
@@ -43,7 +43,7 @@ class CommandObjectPluginLoad : public CommandObjectParsed {
     if (GetDebugger().LoadPlugin(dylib_fspec, error))
       result.SetStatus(eReturnStatusSuccessFinishResult);
     else {
-      result.AppendError(error.AsCString());
+      result.AppendError(error.AsCString(nullptr));
     }
   }
 };
diff --git a/lldb/source/Commands/CommandObjectProcess.cpp b/lldb/source/Commands/CommandObjectProcess.cpp
index a4dfc23b0fea2..7510c03898e24 100644
--- a/lldb/source/Commands/CommandObjectProcess.cpp
+++ b/lldb/source/Commands/CommandObjectProcess.cpp
@@ -91,7 +91,7 @@ class CommandObjectProcessLaunchOrAttach : public CommandObjectParsed {
             } else {
               result.AppendErrorWithFormat(
                   "Failed to detach from process: %s\n",
-                  detach_error.AsCString());
+                  detach_error.AsCString(nullptr));
             }
           } else {
             Status destroy_error(process->Destroy(false));
@@ -100,7 +100,7 @@ class CommandObjectProcessLaunchOrAttach : public CommandObjectParsed {
               process = nullptr;
             } else {
               result.AppendErrorWithFormat("Failed to kill process: %s\n",
-                                           destroy_error.AsCString());
+                                           destroy_error.AsCString(nullptr));
             }
           }
         }
@@ -280,7 +280,7 @@ class CommandObjectProcessLaunch : public CommandObjectProcessLaunchOrAttach {
             "no error returned from Target::Launch, and target has no process");
       }
     } else {
-      result.AppendError(error.AsCString());
+      result.AppendError(error.AsCString(nullptr));
     }
   }
 
@@ -371,7 +371,8 @@ class CommandObjectProcessAttach : public CommandObjectProcessLaunchOrAttach {
             "no error returned from Target::Attach, and target has no process");
       }
     } else {
-      result.AppendErrorWithFormat("attach failed: %s\n", error.AsCString());
+      result.AppendErrorWithFormat("attach failed: %s\n",
+                                   error.AsCString(nullptr));
     }
 
     if (!result.Succeeded())
@@ -733,7 +734,7 @@ class CommandObjectProcessContinue : public CommandObjectParsed {
         }
       } else {
         result.AppendErrorWithFormat("Failed to resume process: %s.\n",
-                                     error.AsCString());
+                                     error.AsCString(nullptr));
       }
     } else {
       result.AppendErrorWithFormat(
@@ -827,7 +828,8 @@ class CommandObjectProcessDetach : public CommandObjectParsed {
     if (error.Success()) {
       result.SetStatus(eReturnStatusSuccessFinishResult);
     } else {
-      result.AppendErrorWithFormat("Detach failed: %s\n", error.AsCString());
+      result.AppendErrorWithFormat("Detach failed: %s\n",
+                                   error.AsCString(nullptr));
     }
   }
 
@@ -1064,7 +1066,7 @@ class CommandObjectProcessLoad : public CommandObjectParsed {
       } else {
         result.AppendErrorWithFormat("failed to load '%s': %s",
                                      image_path.str().c_str(),
-                                     error.AsCString());
+                                     error.AsCString(nullptr));
       }
     }
   }
@@ -1127,7 +1129,7 @@ class CommandObjectProcessUnload : public CommandObjectParsed {
           result.SetStatus(eReturnStatusSuccessFinishResult);
         } else {
           result.AppendErrorWithFormat("failed to unload image: %s",
-                                       error.AsCString());
+                                       error.AsCString(nullptr));
           break;
         }
       }
@@ -1187,7 +1189,7 @@ class CommandObjectProcessSignal : public CommandObjectParsed {
           result.SetStatus(eReturnStatusSuccessFinishResult);
         } else {
           result.AppendErrorWithFormat("Failed to send signal %i: %s\n", signo,
-                                       error.AsCString());
+                                       error.AsCString(nullptr));
         }
       }
     } else {
@@ -1226,7 +1228,7 @@ class CommandObjectProcessInterrupt : public CommandObjectParsed {
       result.SetStatus(eReturnStatusSuccessFinishResult);
     } else {
       result.AppendErrorWithFormat("Failed to halt process: %s\n",
-                                   error.AsCString());
+                                   error.AsCString(nullptr));
     }
   }
 };
@@ -1258,7 +1260,7 @@ class CommandObjectProcessKill : public CommandObjectParsed {
       result.SetStatus(eReturnStatusSuccessFinishResult);
     } else {
       result.AppendErrorWithFormat("Failed to kill process: %s\n",
-                                   error.AsCString());
+                                   error.AsCString(nullptr));
     }
   }
 };
diff --git a/lldb/source/Commands/CommandObjectRegister.cpp b/lldb/source/Commands/CommandObjectRegister.cpp
index fbb92e5c63877..a773e0b4d750f 100644
--- a/lldb/source/Commands/CommandObjectRegister.cpp
+++ b/lldb/source/Commands/CommandObjectRegister.cpp
@@ -366,11 +366,11 @@ class CommandObjectRegisterWrite : public CommandObjectParsed {
             return;
           }
         }
-        if (error.AsCString()) {
+        if (error.AsCString(nullptr)) {
           result.AppendErrorWithFormat(
               "Failed to write register '%s' with value '%s': %s\n",
               reg_name.str().c_str(), value_str.str().c_str(),
-              error.AsCString());
+              error.AsCString(nullptr));
         } else {
           result.AppendErrorWithFormat(
               "Failed to write register '%s' with value '%s'",
diff --git a/lldb/source/Commands/CommandObjectSettings.cpp b/lldb/source/Commands/CommandObjectSettings.cpp
index 126f57c738115..95ee0cbc1e938 100644
--- a/lldb/source/Commands/CommandObjectSettings.cpp
+++ b/lldb/source/Commands/CommandObjectSettings.cpp
@@ -198,7 +198,7 @@ insert-before or insert-after.");
       Status error(GetDebugger().SetPropertyValue(
           &m_exe_ctx, eVarSetOperationClear, var_name, llvm::StringRef()));
       if (error.Fail()) {
-        result.AppendError(error.AsCString());
+        result.AppendError(error.AsCString(nullptr));
       }
       return;
     }
@@ -225,7 +225,7 @@ insert-before or insert-after.");
     }
 
     if (error.Fail() && !m_options.m_exists) {
-      result.AppendError(error.AsCString());
+      result.AppendError(error.AsCString(nullptr));
       return;
     }
 
@@ -296,7 +296,7 @@ class CommandObjectSettingsShow : public CommandObjectParsed {
         if (error.Success()) {
           result.GetOutputStream().EOL();
         } else {
-          result.AppendError(error.AsCString());
+          result.AppendError(error.AsCString(nullptr));
         }
       }
     } else {
@@ -400,7 +400,7 @@ class CommandObjectSettingsWrite : public CommandObjectParsed {
       Status error(GetDebugger().DumpPropertyValue(
           &clean_ctx, out_file, arg.ref(), OptionValue::eDumpGroupExport));
       if (!error.Success()) {
-        result.AppendError(error.AsCString());
+        result.AppendError(error.AsCString(nullptr));
       }
     }
   }
@@ -630,7 +630,7 @@ class CommandObjectSettingsRemove : public CommandObjectRaw {
     Status error(GetDebugger().SetPropertyValue(
         &m_exe_ctx, eVarSetOperationRemove, var_name, var_value));
     if (error.Fail()) {
-      result.AppendError(error.AsCString());
+      result.AppendError(error.AsCString(nullptr));
     }
   }
 };
@@ -721,7 +721,7 @@ class CommandObjectSettingsReplace : public CommandObjectRaw {
     Status error(GetDebugger().SetPropertyValue(
         &m_exe_ctx, eVarSetOperationReplace, var_name, var_value));
     if (error.Fail()) {
-      result.AppendError(error.AsCString());
+      result.AppendError(error.AsCString(nullptr));
     } else {
       result.SetStatus(eReturnStatusSuccessFinishNoResult);
     }
@@ -817,7 +817,7 @@ class CommandObjectSettingsInsertBefore : public CommandObjectRaw {
     Status error(GetDebugger().SetPropertyValue(
         &m_exe_ctx, eVarSetOperationInsertBefore, var_name, var_value));
     if (error.Fail()) {
-      result.AppendError(error.AsCString());
+      result.AppendError(error.AsCString(nullptr));
     }
   }
 };
@@ -910,7 +910,7 @@ class CommandObjectSettingsInsertAfter : public CommandObjectRaw {
     Status error(GetDebugger().SetPropertyValue(
         &m_exe_ctx, eVarSetOperationInsertAfter, var_name, var_value));
     if (error.Fail()) {
-      result.AppendError(error.AsCString());
+      result.AppendError(error.AsCString(nullptr));
     }
   }
 };
@@ -994,7 +994,7 @@ class CommandObjectSettingsAppend : public CommandObjectRaw {
     Status error(GetDebugger().SetPropertyValue(
         &m_exe_ctx, eVarSetOperationAppend, var_name, var_value));
     if (error.Fail()) {
-      result.AppendError(error.AsCString());
+      result.AppendError(error.AsCString(nullptr));
     }
   }
 };
@@ -1086,7 +1086,7 @@ class CommandObjectSettingsClear : public CommandObjectParsed {
     Status error(GetDebugger().SetPropertyValue(
         &m_exe_ctx, eVarSetOperationClear, var_name, llvm::StringRef()));
     if (error.Fail()) {
-      result.AppendError(error.AsCString());
+      result.AppendError(error.AsCString(nullptr));
     }
   }
 
diff --git a/lldb/source/Commands/CommandObjectSource.cpp b/lldb/source/Commands/CommandObjectSource.cpp
index db9dcea4e6a8d..dc6185906a0c7 100644
--- a/lldb/source/Commands/CommandObjectSource.cpp
+++ b/lldb/source/Commands/CommandObjectSource.cpp
@@ -202,8 +202,8 @@ class CommandObjectSourceInfo : public CommandObjectParsed {
     uint32_t num_matches = 0;
     assert(module);
     if (cu) {
-      assert(file_spec.GetFilename().AsCString());
-      bool has_path = (file_spec.GetDirectory().AsCString() != nullptr);
+      assert(file_spec.GetFilename().AsCString(nullptr));
+      bool has_path = (file_spec.GetDirectory().AsCString(nullptr) != nullptr);
       const SupportFileList &cu_file_list = cu->GetSupportFiles();
       size_t file_idx = cu_file_list.FindFileIndex(0, file_spec, has_path);
       if (file_idx != UINT32_MAX) {
@@ -428,9 +428,9 @@ class CommandObjectSourceInfo : public CommandObjectParsed {
           StreamString error_strm;
           if (!GetSymbolContextsForAddress(module_list, addr, sc_list_lines,
                                            error_strm))
-            result.AppendWarningWithFormat("in symbol '%s': %s",
-                                           sc.GetFunctionName().AsCString(),
-                                           error_strm.GetData());
+            result.AppendWarningWithFormat(
+                "in symbol '%s': %s", sc.GetFunctionName().AsCString(nullptr),
+                error_strm.GetData());
           else
             context_found_for_symbol = true;
         }
@@ -438,12 +438,12 @@ class CommandObjectSourceInfo : public CommandObjectParsed {
       if (!context_found_for_symbol)
         result.AppendWarningWithFormat("Unable to find line information"
                                        " for matching symbol '%s'.\n",
-                                       sc.GetFunctionName().AsCString());
+                                       sc.GetFunctionName().AsCString(nullptr));
     }
     if (sc_list_lines.GetSize() == 0) {
       result.AppendErrorWithFormat("No line information could be found"
                                    " for any symbols matching '%s'.\n",
-                                   name.AsCString());
+                                   name.AsCString(nullptr));
       return false;
     }
     FileSpec file_spec;
@@ -451,7 +451,7 @@ class CommandObjectSourceInfo : public CommandObjectParsed {
                                    module_list, file_spec)) {
       result.AppendErrorWithFormat(
           "Unable to dump line information for symbol '%s'.\n",
-          name.AsCString());
+          name.AsCString(nullptr));
       return false;
     }
     return true;
@@ -650,7 +650,8 @@ class CommandObjectSourceList : public CommandObjectParsed {
         Status fcl_err = value.SetValueFromString(option_arg);
         if (!fcl_err.Success()) {
           error = Status::FromErrorStringWithFormat(
-              "Invalid value for file:line specifier: %s", fcl_err.AsCString());
+              "Invalid value for file:line specifier: %s",
+              fcl_err.AsCString(nullptr));
         } else {
           file_name = value.GetFileSpec().GetPath();
           start_line = value.GetLineNumber();
diff --git a/lldb/source/Commands/CommandObjectTarget.cpp b/lldb/source/Commands/CommandObjectTarget.cpp
index dccb7256b1cb7..1e5e1674e961a 100644
--- a/lldb/source/Commands/CommandObjectTarget.cpp
+++ b/lldb/source/Commands/CommandObjectTarget.cpp
@@ -296,7 +296,7 @@ class CommandObjectTargetCreate : public CommandObjectParsed {
           target_sp));
 
       if (!target_sp) {
-        result.AppendError(error.AsCString());
+        result.AppendError(error.AsCString(nullptr));
         return;
       }
 
@@ -339,7 +339,7 @@ class CommandObjectTargetCreate : public CommandObjectParsed {
             if (!platform_sp->GetFileExists(remote_file)) {
               Status err = platform_sp->PutFile(file_spec, remote_file);
               if (err.Fail()) {
-                result.AppendError(err.AsCString());
+                result.AppendError(err.AsCString(nullptr));
                 return;
               }
             }
@@ -353,7 +353,7 @@ class CommandObjectTargetCreate : public CommandObjectParsed {
               // copy the remote file to the local file
               Status err = platform_sp->GetFile(remote_file, file_spec);
               if (err.Fail()) {
-                result.AppendError(err.AsCString());
+                result.AppendError(err.AsCString(nullptr));
                 return;
               }
             } else {
@@ -2839,7 +2839,7 @@ class CommandObjectTargetModulesAdd : public CommandObjectParsed {
           ModuleSP module_sp(
               target.GetOrCreateModule(module_spec, true /* notify */, &error));
           if (!module_sp) {
-            const char *error_cstr = error.AsCString();
+            const char *error_cstr = error.AsCString(nullptr);
             if (error_cstr)
               result.AppendError(error_cstr);
             else
@@ -3066,7 +3066,7 @@ class CommandObjectTargetModulesLoad
                 }
                 Status error = process->WriteObjectFile(std::move(loadables));
                 if (error.Fail()) {
-                  result.AppendError(error.AsCString());
+                  result.AppendError(error.AsCString(nullptr));
                   return;
                 }
                 if (set_pc) {
@@ -3641,8 +3641,8 @@ class CommandObjectTargetModulesShowUnwind : public CommandObjectParsed {
 
       result.GetOutputStream().Printf(
           "UNWIND PLANS for %s`%s (start addr 0x%" PRIx64 ")\n",
-          sc.module_sp->GetPlatformFileSpec().GetFilename().AsCString(),
-          funcname.AsCString(), start_addr);
+          sc.module_sp->GetPlatformFileSpec().GetFilename().AsCString(nullptr),
+          funcname.AsCString(nullptr), start_addr);
 
       Args args;
       target->GetUserSpecifiedTrapHandlerNames(args);
@@ -3673,18 +3673,19 @@ class CommandObjectTargetModulesShowUnwind : public CommandObjectParsed {
               func_unwinders_sp->GetUnwindPlanAtNonCallSite(*target, *thread)) {
         result.GetOutputStream().Printf(
             "Asynchronous (not restricted to call-sites) UnwindPlan is '%s'\n",
-            plan_sp->GetSourceName().AsCString());
+            plan_sp->GetSourceName().AsCString(nullptr));
       }
       if (std::shared_ptr<const UnwindPlan> plan_sp =
               func_unwinders_sp->GetUnwindPlanAtCallSite(*target, *thread)) {
         result.GetOutputStream().Printf(
             "Synchronous (restricted to call-sites) UnwindPlan is '%s'\n",
-            plan_sp->GetSourceName().AsCString());
+            plan_sp->GetSourceName().AsCString(nullptr));
       }
       if (std::shared_ptr<const UnwindPlan> plan_sp =
               func_unwinders_sp->GetUnwindPlanFastUnwind(*target, *thread)) {
-        result.GetOutputStream().Printf("Fast UnwindPlan is '%s'\n",
-                                        plan_sp->GetSourceName().AsCString());
+        result.GetOutputStream().Printf(
+            "Fast UnwindPlan is '%s'\n",
+            plan_sp->GetSourceName().AsCString(nullptr));
       }
 
       result.GetOutputStream().Printf("\n");
@@ -4402,14 +4403,14 @@ class CommandObjectTargetSymbolsAdd : public CommandObjectParsed {
           // in the debug info files in case the platform supports that.
           Status error;
           module_sp->LoadScriptingResourceInTarget(target, error);
-          if (error.Fail() && error.AsCString())
+          if (error.Fail() && error.AsCString(nullptr))
             result.AppendWarningWithFormat(
                 "unable to load scripting data for module %s - error "
                 "reported was %s",
                 module_sp->GetFileSpec()
                     .GetFileNameStrippingExtension()
                     .GetCString(),
-                error.AsCString());
+                error.AsCString(nullptr));
 
           flush = true;
           result.SetStatus(eReturnStatusSuccessFinishResult);
@@ -5088,7 +5089,7 @@ Filter Options:
       else {
         // FIXME: Set the stop hook ID counter back.
         result.AppendErrorWithFormat("Couldn't add stop hook: %s",
-                                     error.AsCString());
+                                     error.AsCString(nullptr));
         target.UndoCreateStopHook(new_hook_sp->GetID());
         return;
       }
diff --git a/lldb/source/Commands/CommandObjectThread.cpp b/lldb/source/Commands/CommandObjectThread.cpp
index 6786741cd04b6..21808976103fe 100644
--- a/lldb/source/Commands/CommandObjectThread.cpp
+++ b/lldb/source/Commands/CommandObjectThread.cpp
@@ -599,7 +599,7 @@ class CommandObjectThreadStepWithTypeAndScope : public CommandObjectParsed {
         error = process->Resume();
 
       if (!error.Success()) {
-        result.AppendMessage(error.AsCString());
+        result.AppendMessage(error.AsCString(nullptr));
         return;
       }
 
@@ -771,7 +771,7 @@ class CommandObjectThreadContinue : public CommandObjectParsed {
         }
       } else {
         result.AppendErrorWithFormat("Failed to resume process: %s\n",
-                                     error.AsCString());
+                                     error.AsCString(nullptr));
       }
     } else {
       result.AppendErrorWithFormat(
@@ -1076,7 +1076,7 @@ class CommandObjectThreadUntil : public CommandObjectParsed {
         }
       } else {
         result.AppendErrorWithFormat("Failed to resume process: %s.\n",
-                                     error.AsCString());
+                                     error.AsCString(nullptr));
       }
     }
   }
@@ -1546,7 +1546,7 @@ class CommandObjectThreadReturn : public CommandObjectRaw {
       error = thread->UnwindInnermostExpression();
       if (!error.Success()) {
         result.AppendErrorWithFormat("Unwinding expression failed - %s.",
-                                     error.AsCString());
+                                     error.AsCString(nullptr));
       } else {
         bool success =
             thread->SetSelectedFrameByIndexNoisily(0, result.GetOutputStream());
@@ -1586,7 +1586,7 @@ class CommandObjectThreadReturn : public CommandObjectRaw {
         if (return_valobj_sp)
           result.AppendErrorWithFormat(
               "Error evaluating result expression: %s",
-              return_valobj_sp->GetError().AsCString());
+              return_valobj_sp->GetError().AsCString(nullptr));
         else
           result.AppendErrorWithFormat(
               "Unknown error evaluating result expression.");
@@ -1601,7 +1601,7 @@ class CommandObjectThreadReturn : public CommandObjectRaw {
     if (!error.Success()) {
       result.AppendErrorWithFormat(
           "Error returning from frame %d of thread %d: %s.", frame_idx,
-          thread_sp->GetIndexID(), error.AsCString());
+          thread_sp->GetIndexID(), error.AsCString(nullptr));
       return;
     }
 
diff --git a/lldb/source/Commands/CommandObjectTrace.cpp b/lldb/source/Commands/CommandObjectTrace.cpp
index 5e212e05461a6..9c960d5751d72 100644
--- a/lldb/source/Commands/CommandObjectTrace.cpp
+++ b/lldb/source/Commands/CommandObjectTrace.cpp
@@ -277,7 +277,7 @@ class CommandObjectTraceDump : public CommandObjectParsed {
     if (error.Success()) {
       result.SetStatus(eReturnStatusSuccessFinishResult);
     } else {
-      result.AppendErrorWithFormat("%s\n", error.AsCString());
+      result.AppendErrorWithFormat("%s\n", error.AsCString(nullptr));
     }
   }
 
@@ -367,7 +367,7 @@ class CommandObjectTraceSchema : public CommandObjectParsed {
     if (error.Success()) {
       result.SetStatus(eReturnStatusSuccessFinishResult);
     } else {
-      result.AppendErrorWithFormat("%s\n", error.AsCString());
+      result.AppendErrorWithFormat("%s\n", error.AsCString(nullptr));
     }
   }
 
diff --git a/lldb/source/Commands/CommandObjectType.cpp b/lldb/source/Commands/CommandObjectType.cpp
index 5c90006d9addf..4d33bf78f50e2 100644
--- a/lldb/source/Commands/CommandObjectType.cpp
+++ b/lldb/source/Commands/CommandObjectType.cpp
@@ -225,7 +225,7 @@ class CommandObjectTypeSummaryAdd : public CommandObjectParsed,
                              &error);
                   if (error.Fail()) {
                     LockedStreamFile locked_stream = error_sp->Lock();
-                    locked_stream.Printf("error: %s", error.AsCString());
+                    locked_stream.Printf("error: %s", error.AsCString(nullptr));
                   }
                 }
 
@@ -237,16 +237,17 @@ class CommandObjectTypeSummaryAdd : public CommandObjectParsed,
                         options->m_name, script_format, &error);
                     if (error.Fail()) {
                       LockedStreamFile locked_stream = error_sp->Lock();
-                      locked_stream.Printf("error: %s", error.AsCString());
+                      locked_stream.Printf("error: %s",
+                                           error.AsCString(nullptr));
                     }
                   } else {
                     LockedStreamFile locked_stream = error_sp->Lock();
-                    locked_stream.Printf("error: %s", error.AsCString());
+                    locked_stream.Printf("error: %s", error.AsCString(nullptr));
                   }
                 } else {
-                  if (error.AsCString()) {
+                  if (error.AsCString(nullptr)) {
                     LockedStreamFile locked_stream = error_sp->Lock();
-                    locked_stream.Printf("error: %s", error.AsCString());
+                    locked_stream.Printf("error: %s", error.AsCString(nullptr));
                   }
                 }
               }
@@ -481,7 +482,8 @@ class CommandObjectTypeSynthAdd : public CommandObjectParsed,
                                  options->m_match_type, options->m_category,
                                  &error)) {
                       LockedStreamFile locked_stream = error_sp->Lock();
-                      locked_stream.Printf("error: %s\n", error.AsCString());
+                      locked_stream.Printf("error: %s\n",
+                                           error.AsCString(nullptr));
                       break;
                     }
                   } else {
@@ -1358,7 +1360,7 @@ bool CommandObjectTypeSummaryAdd::Execute_ScriptSummary(
     AddSummary(ConstString(entry.ref()), script_format, m_options.m_match_type,
                m_options.m_category, &error);
     if (error.Fail()) {
-      result.AppendError(error.AsCString());
+      result.AppendError(error.AsCString(nullptr));
       return false;
     }
   }
@@ -1366,7 +1368,7 @@ bool CommandObjectTypeSummaryAdd::Execute_ScriptSummary(
   if (m_options.m_name) {
     AddNamedSummary(m_options.m_name, script_format, &error);
     if (error.Fail()) {
-      result.AppendError(error.AsCString());
+      result.AppendError(error.AsCString(nullptr));
       result.AppendError("added to types, but not given a name");
       return false;
     }
@@ -1429,7 +1431,7 @@ bool CommandObjectTypeSummaryAdd::Execute_StringSummary(
                &error);
 
     if (error.Fail()) {
-      result.AppendError(error.AsCString());
+      result.AppendError(error.AsCString(nullptr));
       return false;
     }
   }
@@ -1437,7 +1439,7 @@ bool CommandObjectTypeSummaryAdd::Execute_StringSummary(
   if (m_options.m_name) {
     AddNamedSummary(m_options.m_name, entry, &error);
     if (error.Fail()) {
-      result.AppendError(error.AsCString());
+      result.AppendError(error.AsCString(nullptr));
       result.AppendError("added to types, but not given a name");
       return false;
     }
@@ -1616,7 +1618,7 @@ bool CommandObjectTypeSummaryAdd::AddSummary(ConstString type_name,
   }
 
   if (match_type == eFormatterMatchCallback) {
-    const char *function_name = type_name.AsCString();
+    const char *function_name = type_name.AsCString(nullptr);
     ScriptInterpreter *interpreter = GetDebugger().GetScriptInterpreter();
     if (interpreter && !interpreter->CheckObjectExists(function_name)) {
       *error = Status::FromErrorStringWithFormat(
@@ -2219,7 +2221,7 @@ bool CommandObjectTypeSynthAdd::Execute_PythonClass(
     ConstString typeCS(arg_entry.ref());
     if (!AddSynth(typeCS, entry, m_options.m_match_type, m_options.m_category,
                   &error)) {
-      result.AppendError(error.AsCString());
+      result.AppendError(error.AsCString(nullptr));
       return false;
     }
   }
@@ -2265,7 +2267,7 @@ bool CommandObjectTypeSynthAdd::AddSynth(ConstString type_name,
         *error = Status::FromErrorStringWithFormat(
             "cannot add synthetic for type %s when "
             "filter is defined in same category!",
-            type_name.AsCString());
+            type_name.AsCString(nullptr));
       return false;
     }
   }
@@ -2281,7 +2283,7 @@ bool CommandObjectTypeSynthAdd::AddSynth(ConstString type_name,
   }
 
   if (match_type == eFormatterMatchCallback) {
-    const char *function_name = type_name.AsCString();
+    const char *function_name = type_name.AsCString(nullptr);
     ScriptInterpreter *interpreter = GetDebugger().GetScriptInterpreter();
     if (interpreter && !interpreter->CheckObjectExists(function_name)) {
       *error = Status::FromErrorStringWithFormat(
@@ -2408,7 +2410,7 @@ class CommandObjectTypeFilterAdd : public CommandObjectParsed {
               "cannot add filter for type %s when "
               "synthetic is defined in same "
               "category!",
-              type_name.AsCString());
+              type_name.AsCString(nullptr));
         return false;
       }
     }
@@ -2522,7 +2524,7 @@ all children of my_foo as if no filter was defined:"
       if (!AddFilter(typeCS, entry,
                      m_options.m_regex ? eRegexFilter : eRegularFilter,
                      m_options.m_category, &error)) {
-        result.AppendError(error.AsCString());
+        result.AppendError(error.AsCString(nullptr));
         return;
       }
     }
diff --git a/lldb/source/Commands/CommandObjectWatchpoint.cpp b/lldb/source/Commands/CommandObjectWatchpoint.cpp
index 9d2095b0bf35d..0d7c82436cb4f 100644
--- a/lldb/source/Commands/CommandObjectWatchpoint.cpp
+++ b/lldb/source/Commands/CommandObjectWatchpoint.cpp
@@ -1037,7 +1037,7 @@ class CommandObjectWatchpointSetExpression : public CommandObjectRaw {
       result.AppendError("expression evaluation of address to watch failed");
       result.AppendErrorWithFormat("expression evaluated: \n%s", expr.data());
       if (valobj_sp && !valobj_sp->GetError().Success())
-        result.AppendError(valobj_sp->GetError().AsCString());
+        result.AppendError(valobj_sp->GetError().AsCString(nullptr));
       return;
     }
 
@@ -1107,7 +1107,7 @@ class CommandObjectWatchpointSetExpression : public CommandObjectRaw {
                                    ", size=%" PRIu64 ").\n",
                                    addr, (uint64_t)size);
       if (error.AsCString(nullptr))
-        result.AppendError(error.AsCString());
+        result.AppendError(error.AsCString(nullptr));
     }
   }
 
diff --git a/lldb/source/Core/Address.cpp b/lldb/source/Core/Address.cpp
index 6e4f6e1b73492..6906f5a5b0227 100644
--- a/lldb/source/Core/Address.cpp
+++ b/lldb/source/Core/Address.cpp
@@ -503,7 +503,7 @@ bool Address::Dump(Stream *s, ExecutionContextScope *exe_scope, DumpStyle style,
               const Symbol *symbol =
                   symtab->FindSymbolContainingFileAddress(file_Addr);
               if (symbol) {
-                const char *symbol_name = symbol->GetName().AsCString();
+                const char *symbol_name = symbol->GetName().AsCString(nullptr);
                 if (symbol_name) {
                   s->PutCStringColorHighlighted(symbol_name, settings);
                   addr_t delta =
diff --git a/lldb/source/Core/AddressRange.cpp b/lldb/source/Core/AddressRange.cpp
index 315fcf1a6da32..6ae50b8894bd9 100644
--- a/lldb/source/Core/AddressRange.cpp
+++ b/lldb/source/Core/AddressRange.cpp
@@ -229,7 +229,7 @@ bool AddressRange::GetDescription(Stream *s, Target *target) const {
   const auto section_sp = m_base_addr.GetSection();
   if (section_sp) {
     if (const auto object_file = section_sp->GetObjectFile())
-      file_name = object_file->GetFileSpec().GetFilename().AsCString();
+      file_name = object_file->GetFileSpec().GetFilename().AsCString(nullptr);
   }
   start_addr = m_base_addr.GetFileAddress();
   const addr_t end_addr = (start_addr == LLDB_INVALID_ADDRESS)
diff --git a/lldb/source/Core/Debugger.cpp b/lldb/source/Core/Debugger.cpp
index e1b2ce1b063e0..2179de28c4927 100644
--- a/lldb/source/Core/Debugger.cpp
+++ b/lldb/source/Core/Debugger.cpp
@@ -353,7 +353,7 @@ Status Debugger::SetPropertyValue(const ExecutionContext *exe_ctx,
         if (!target_sp->LoadScriptingResources(errors)) {
           lldb::StreamUP s = GetAsyncErrorStream();
           for (auto &error : errors)
-            s->Printf("%s\n", error.AsCString());
+            s->Printf("%s\n", error.AsCString(nullptr));
         }
       }
     }
@@ -2316,7 +2316,8 @@ bool Debugger::StartEventHandlerThread() {
     // function. We do this by listening to events for the
     // eBroadcastBitEventThreadIsListening from the m_sync_broadcaster
     ConstString full_name("lldb.debugger.event-handler");
-    ListenerSP listener_sp(Listener::MakeListener(full_name.AsCString()));
+    ListenerSP listener_sp(
+        Listener::MakeListener(full_name.AsCString(nullptr)));
     listener_sp->StartListeningForEvents(&m_sync_broadcaster,
                                          eBroadcastBitEventThreadIsListening);
 
diff --git a/lldb/source/Core/Disassembler.cpp b/lldb/source/Core/Disassembler.cpp
index 3011b6aede3d2..4e8d2a5fa902a 100644
--- a/lldb/source/Core/Disassembler.cpp
+++ b/lldb/source/Core/Disassembler.cpp
@@ -387,7 +387,7 @@ VariableAnnotator::AnnotateStructured(Instruction &inst) {
     if (!v || v->IsArtificial())
       continue;
 
-    const char *nm = v->GetName().AsCString();
+    const char *nm = v->GetName().AsCString(nullptr);
     llvm::StringRef name = nm ? nm : "<anon>";
 
     DWARFExpressionList &exprs = v->LocationExpressionList();
@@ -413,13 +413,13 @@ VariableAnnotator::AnnotateStructured(Instruction &inst) {
 
     const Declaration &decl = v->GetDeclaration();
     if (decl.GetFile()) {
-      decl_file = decl.GetFile().GetFilename().AsCString();
+      decl_file = decl.GetFile().GetFilename().AsCString(nullptr);
       if (decl.GetLine() > 0)
         decl_line = decl.GetLine();
     }
 
     if (Type *type = v->GetType())
-      if (const char *type_str = type->GetName().AsCString())
+      if (const char *type_str = type->GetName().AsCString(nullptr))
         type_name = type_str;
 
     current_vars.try_emplace(
@@ -1369,7 +1369,7 @@ size_t Disassembler::AppendInstructions(Target &target, Address start,
 
   if (bytes_read == 0) {
     if (error_strm_ptr) {
-      if (const char *error_cstr = error.AsCString())
+      if (const char *error_cstr = error.AsCString(nullptr))
         error_strm_ptr->Printf("error: %s\n", error_cstr);
     }
     return 0;
diff --git a/lldb/source/Core/DynamicLoader.cpp b/lldb/source/Core/DynamicLoader.cpp
index 0259e7e63a161..bb0ea9cc34f40 100644
--- a/lldb/source/Core/DynamicLoader.cpp
+++ b/lldb/source/Core/DynamicLoader.cpp
@@ -289,7 +289,7 @@ ModuleSP DynamicLoader::LoadBinaryWithUUIDAndAddress(
         module_sp = std::make_shared<Module>(module_spec);
       } else if (force_symbol_search && error.AsCString("") &&
                  error.AsCString("")[0] != '\0') {
-        *target.GetDebugger().GetAsyncErrorStream() << error.AsCString();
+        *target.GetDebugger().GetAsyncErrorStream() << error.AsCString(nullptr);
       }
     }
 
diff --git a/lldb/source/Core/FormatEntity.cpp b/lldb/source/Core/FormatEntity.cpp
index 3646f88ac9206..07f4ac799f329 100644
--- a/lldb/source/Core/FormatEntity.cpp
+++ b/lldb/source/Core/FormatEntity.cpp
@@ -464,7 +464,7 @@ static bool RunScriptFormatKeyword(Stream &s, const SymbolContext *sc,
         s.Printf("%s", script_output.c_str());
         return true;
       } else {
-        s.Printf("<error: %s>", error.AsCString());
+        s.Printf("<error: %s>", error.AsCString(nullptr));
       }
     }
   }
@@ -908,7 +908,7 @@ bool FormatEntity::Formatter::DumpValue(Stream &s,
   if (target->IsBitfield() && was_var_indexed) {
     // TODO: check for a (T:n)-specific summary - we should still obey that
     StreamString bitfield_name;
-    bitfield_name.Printf("%s:%d", target->GetTypeName().AsCString(),
+    bitfield_name.Printf("%s:%d", target->GetTypeName().AsCString(nullptr),
                          target->GetBitfieldBitSize());
     auto type_sp = std::make_shared<TypeNameSpecifierImpl>(
         bitfield_name.GetString(), lldb::eFormatterMatchExact);
@@ -1219,7 +1219,7 @@ static bool PrintFunctionNameWithArgs(Stream &s,
 
   const char *cstr = sc.GetPossiblyInlinedFunctionName()
                          .GetName(Mangled::ePreferDemangled)
-                         .AsCString();
+                         .AsCString(nullptr);
   if (!cstr)
     return false;
 
@@ -1823,7 +1823,7 @@ bool FormatEntity::Formatter::Format(const Entry &entry, Stream &s,
 
       const char *name = m_sc->GetPossiblyInlinedFunctionName()
                              .GetName(Mangled::NamePreference::ePreferDemangled)
-                             .AsCString();
+                             .AsCString(nullptr);
       if (name) {
         s.PutCString(name);
         return true;
@@ -1868,7 +1868,7 @@ bool FormatEntity::Formatter::Format(const Entry &entry, Stream &s,
           m_sc->GetPossiblyInlinedFunctionName()
               .GetName(
                   Mangled::NamePreference::ePreferDemangledWithoutArguments)
-              .AsCString();
+              .AsCString(nullptr);
       if (name) {
         s.PutCString(name);
         return true;
@@ -1940,7 +1940,7 @@ bool FormatEntity::Formatter::Format(const Entry &entry, Stream &s,
 
     const char *name = m_sc->GetPossiblyInlinedFunctionName()
                            .GetName(Mangled::NamePreference::ePreferMangled)
-                           .AsCString();
+                           .AsCString(nullptr);
     if (!name)
       return false;
 
diff --git a/lldb/source/Core/IOHandlerCursesGUI.cpp b/lldb/source/Core/IOHandlerCursesGUI.cpp
index 47ba35877651a..06eef15000ec2 100644
--- a/lldb/source/Core/IOHandlerCursesGUI.cpp
+++ b/lldb/source/Core/IOHandlerCursesGUI.cpp
@@ -2961,7 +2961,7 @@ class ProcessAttachFormDelegate : public FormDelegate {
     if (!module_sp->IsExecutable())
       return "";
 
-    return module_sp->GetFileSpec().GetFilename().AsCString();
+    return module_sp->GetFileSpec().GetFilename().AsCString(nullptr);
   }
 
   bool StopRunningProcess() {
@@ -3044,7 +3044,7 @@ class ProcessAttachFormDelegate : public FormDelegate {
     Status status = target->Attach(attach_info, &stream);
 
     if (status.Fail()) {
-      SetError(status.AsCString());
+      SetError(status.AsCString(nullptr));
       return;
     }
 
@@ -3146,7 +3146,7 @@ class TargetCreateFormDelegate : public FormDelegate {
         &platform_options, target_sp);
 
     if (status.Fail()) {
-      SetError(status.AsCString());
+      SetError(status.AsCString(nullptr));
       return nullptr;
     }
 
@@ -3604,7 +3604,7 @@ class ProcessLaunchFormDelegate : public FormDelegate {
     Status status = target->Launch(launch_info, &stream);
 
     if (status.Fail()) {
-      SetError(status.AsCString());
+      SetError(status.AsCString(nullptr));
       return;
     }
 
diff --git a/lldb/source/Core/Mangled.cpp b/lldb/source/Core/Mangled.cpp
index f7683c55baf84..171930ed348de 100644
--- a/lldb/source/Core/Mangled.cpp
+++ b/lldb/source/Core/Mangled.cpp
@@ -394,7 +394,7 @@ void Mangled::Dump(Stream *s) const {
     *s << ", mangled = " << m_mangled;
   }
   if (m_demangled) {
-    const char *demangled = m_demangled.AsCString();
+    const char *demangled = m_demangled.AsCString(nullptr);
     s->Printf(", demangled = %s", demangled[0] ? demangled : "<error>");
   }
 }
@@ -566,7 +566,7 @@ ConstString Mangled::GetBaseName() const {
   if (!demangled_name)
     return {};
 
-  const char *name_str = demangled_name.AsCString();
+  const char *name_str = demangled_name.AsCString(nullptr);
   const auto &range = demangled_info->BasenameRange;
   return ConstString(
       llvm::StringRef(name_str + range.first, range.second - range.first));
diff --git a/lldb/source/Core/Module.cpp b/lldb/source/Core/Module.cpp
index 808c8a347e9b2..114620ebbaa35 100644
--- a/lldb/source/Core/Module.cpp
+++ b/lldb/source/Core/Module.cpp
@@ -332,7 +332,8 @@ ObjectFile *Module::GetMemoryObjectFile(const lldb::ProcessSP &process_sp,
         }
       } else {
         error = Status::FromErrorStringWithFormat(
-            "unable to read header from memory: %s", readmem_error.AsCString());
+            "unable to read header from memory: %s",
+            readmem_error.AsCString(nullptr));
       }
     } else {
       error = Status::FromErrorString("invalid process");
@@ -1257,7 +1258,7 @@ const Symbol *Module::FindFirstSymbolWithNameAndType(ConstString name,
                                                      SymbolType symbol_type) {
   LLDB_SCOPED_TIMERF(
       "Module::FindFirstSymbolWithNameAndType (name = %s, type = %i)",
-      name.AsCString(), symbol_type);
+      name.AsCString(nullptr), symbol_type);
   if (Symtab *symtab = GetSymtab())
     return symtab->FindFirstSymbolWithNameAndType(
         name, symbol_type, Symtab::eDebugAny, Symtab::eVisibilityAny);
@@ -1284,7 +1285,7 @@ void Module::SymbolIndicesToSymbolContextList(
 void Module::FindFunctionSymbols(ConstString name, uint32_t name_type_mask,
                                  SymbolContextList &sc_list) {
   LLDB_SCOPED_TIMERF("Module::FindSymbolsFunctions (name = %s, mask = 0x%8.8x)",
-                     name.AsCString(), name_type_mask);
+                     name.AsCString(nullptr), name_type_mask);
   if (Symtab *symtab = GetSymtab())
     symtab->FindFunctionSymbols(name, name_type_mask, sc_list);
 }
diff --git a/lldb/source/Core/ModuleList.cpp b/lldb/source/Core/ModuleList.cpp
index b54d787de3512..ea9401e797e14 100644
--- a/lldb/source/Core/ModuleList.cpp
+++ b/lldb/source/Core/ModuleList.cpp
@@ -1348,14 +1348,14 @@ bool ModuleList::LoadScriptingResourcesInTarget(Target *target,
     if (module) {
       Status error;
       if (!module->LoadScriptingResourceInTarget(target, error)) {
-        if (error.Fail() && error.AsCString()) {
+        if (error.Fail() && error.AsCString(nullptr)) {
           error = Status::FromErrorStringWithFormat(
               "unable to load scripting data for "
               "module %s - error reported was %s",
               module->GetFileSpec()
                   .GetFileNameStrippingExtension()
                   .GetCString(),
-              error.AsCString());
+              error.AsCString(nullptr));
           errors.push_back(std::move(error));
           if (!continue_on_error)
             return false;
diff --git a/lldb/source/Core/Section.cpp b/lldb/source/Core/Section.cpp
index 0596946bb9f18..a1a88070d9c4c 100644
--- a/lldb/source/Core/Section.cpp
+++ b/lldb/source/Core/Section.cpp
@@ -320,10 +320,10 @@ void Section::DumpName(llvm::raw_ostream &s) const {
 
     if (m_obj_file) {
       const FileSpec &file_spec = m_obj_file->GetFileSpec();
-      name = file_spec.GetFilename().AsCString();
+      name = file_spec.GetFilename().AsCString(nullptr);
     }
     if ((!name || !name[0]) && module_sp)
-      name = module_sp->GetFileSpec().GetFilename().AsCString();
+      name = module_sp->GetFileSpec().GetFilename().AsCString(nullptr);
     if (name && name[0])
       s << name << '.';
   }
diff --git a/lldb/source/Core/SourceManager.cpp b/lldb/source/Core/SourceManager.cpp
index abb5bfb5bcfd5..4635d5e5eee4e 100644
--- a/lldb/source/Core/SourceManager.cpp
+++ b/lldb/source/Core/SourceManager.cpp
@@ -519,7 +519,7 @@ void SourceManager::File::CommonInitializerImpl(SupportFileNSP support_file_nsp,
           SymbolContextList sc_list;
           size_t num_matches =
               target_sp->GetImages().ResolveSymbolContextForFilePath(
-                  file_spec.GetFilename().AsCString(), 0, check_inlines,
+                  file_spec.GetFilename().AsCString(nullptr), 0, check_inlines,
                   SymbolContextItem(eSymbolContextModule |
                                     eSymbolContextCompUnit),
                   sc_list);
diff --git a/lldb/source/DataFormatters/FormatManager.cpp b/lldb/source/DataFormatters/FormatManager.cpp
index 4984e8756c237..06851a900325a 100644
--- a/lldb/source/DataFormatters/FormatManager.cpp
+++ b/lldb/source/DataFormatters/FormatManager.cpp
@@ -189,7 +189,8 @@ void FormatManager::GetPossibleMatches(
       target_sp->GetDebugger().GetScriptInterpreter();
   if (valobj.GetBitfieldBitSize() > 0) {
     StreamString sstring;
-    sstring.Printf("%s:%d", type_name.AsCString(), valobj.GetBitfieldBitSize());
+    sstring.Printf("%s:%d", type_name.AsCString(nullptr),
+                   valobj.GetBitfieldBitSize());
     ConstString bitfieldname(sstring.GetString());
     entries.push_back({bitfieldname, script_interpreter,
                        TypeImpl(compiler_type), current_flags,
diff --git a/lldb/source/DataFormatters/TypeSummary.cpp b/lldb/source/DataFormatters/TypeSummary.cpp
index 4f01466f85148..071eb2923ae84 100644
--- a/lldb/source/DataFormatters/TypeSummary.cpp
+++ b/lldb/source/DataFormatters/TypeSummary.cpp
@@ -123,7 +123,7 @@ std::string StringSummaryFormat::GetDescription() {
 
   sstr.Printf("`%s`%s%s%s%s%s%s%s%s%s ptr-match-depth=%u", m_format_str.c_str(),
               m_error.Fail() ? " error: " : "",
-              m_error.Fail() ? m_error.AsCString() : "",
+              m_error.Fail() ? m_error.AsCString(nullptr) : "",
               Cascades() ? "" : " (not cascading)",
               !DoesPrintChildren(nullptr) ? "" : " (show children)",
               !DoesPrintValue(nullptr) ? " (hide value)" : "",
diff --git a/lldb/source/DataFormatters/TypeSynthetic.cpp b/lldb/source/DataFormatters/TypeSynthetic.cpp
index e25296e91fa25..e5df2da403e4c 100644
--- a/lldb/source/DataFormatters/TypeSynthetic.cpp
+++ b/lldb/source/DataFormatters/TypeSynthetic.cpp
@@ -71,7 +71,7 @@ TypeFilterImpl::FrontEnd::GetIndexOfChildWithName(ConstString name) {
     }
   }
   return llvm::createStringError("Type has no child named '%s'",
-                                 name.AsCString());
+                                 name.AsCString(nullptr));
 }
 
 std::string TypeFilterImpl::GetDescription() {
@@ -226,7 +226,7 @@ llvm::Expected<size_t>
 ScriptedSyntheticChildren::FrontEnd::GetIndexOfChildWithName(ConstString name) {
   if (!m_wrapper_sp || m_interpreter == nullptr)
     return llvm::createStringError("Type has no child named '%s'",
-                                   name.AsCString());
+                                   name.AsCString(nullptr));
   return m_interpreter->GetIndexOfChildWithName(m_wrapper_sp,
                                                 name.GetCString());
 }
diff --git a/lldb/source/DataFormatters/ValueObjectPrinter.cpp b/lldb/source/DataFormatters/ValueObjectPrinter.cpp
index cb9955b611d0c..fdb9bcf74de62 100644
--- a/lldb/source/DataFormatters/ValueObjectPrinter.cpp
+++ b/lldb/source/DataFormatters/ValueObjectPrinter.cpp
@@ -186,7 +186,7 @@ void ValueObjectPrinter::SetupMostSpecializedValue() {
 const char *ValueObjectPrinter::GetRootNameForDisplay() {
   const char *root_valobj_name =
       m_options.m_root_valobj_name.empty()
-          ? GetMostSpecializedValue().GetName().AsCString()
+          ? GetMostSpecializedValue().GetName().AsCString(nullptr)
           : m_options.m_root_valobj_name.c_str();
   return root_valobj_name ? root_valobj_name : "";
 }
@@ -396,7 +396,7 @@ void ValueObjectPrinter::GetValueSummaryError(std::string &value,
     if (val_cstr)
       value.assign(val_cstr);
   }
-  const char *err_cstr = valobj.GetError().AsCString();
+  const char *err_cstr = valobj.GetError().AsCString(nullptr);
   if (err_cstr)
     error.assign(err_cstr);
 
@@ -796,7 +796,7 @@ bool ValueObjectPrinter::PrintChildrenOneLiner(bool hide_names) {
           m_stream->PutCString(", ");
         did_print_children = true;
         if (!hide_names) {
-          const char *name = child_sp.get()->GetName().AsCString();
+          const char *name = child_sp.get()->GetName().AsCString(nullptr);
           if (name && *name) {
             m_stream->PutCString(name);
             m_stream->PutCString(" = ");
diff --git a/lldb/source/Expression/DWARFExpression.cpp b/lldb/source/Expression/DWARFExpression.cpp
index 7f59fe827cf25..c8fd81b198e16 100644
--- a/lldb/source/Expression/DWARFExpression.cpp
+++ b/lldb/source/Expression/DWARFExpression.cpp
@@ -973,7 +973,7 @@ static llvm::Error Evaluate_DW_OP_deref_size(
         return llvm::createStringError(
             "failed to dereference pointer for DW_OP_deref_size: "
             "%s\n",
-            error.AsCString());
+            error.AsCString(nullptr));
 
       ObjectFile *objfile = module_sp->GetObjectFile();
 
@@ -1007,7 +1007,7 @@ static llvm::Error Evaluate_DW_OP_deref_size(
       return llvm::createStringError(
           "failed to dereference pointer from 0x%" PRIx64
           " for DW_OP_deref_size: %s\n",
-          pointer_addr, error.AsCString());
+          pointer_addr, error.AsCString(nullptr));
 
     stack.back().GetScalar() = DerefSizeExtractDataHelper(
         addr_bytes, sizeof(addr_bytes), process->GetByteOrder(), size);
@@ -1147,8 +1147,8 @@ llvm::Expected<Value> DWARFExpression::Evaluate(
     //                  if (error_ptr)
     //                      error_ptr->SetErrorStringWithFormat ("Section %s in
     //                      %s is not currently loaded.\n",
-    //                      sect->GetName().AsCString(),
-    //                      sect->GetModule()->GetFileSpec().GetFilename().AsCString());
+    //                      sect->GetName().AsCString(nullptr),
+    //                      sect->GetModule()->GetFileSpec().GetFilename().AsCString(nullptr));
     //                  return false;
     //              }
     //          }
diff --git a/lldb/source/Expression/FunctionCaller.cpp b/lldb/source/Expression/FunctionCaller.cpp
index 6ea3faee98688..cefc47742a6f7 100644
--- a/lldb/source/Expression/FunctionCaller.cpp
+++ b/lldb/source/Expression/FunctionCaller.cpp
@@ -102,7 +102,7 @@ bool FunctionCaller::WriteFunctionWrapper(
   if (!jit_error.Success()) {
     diagnostic_manager.Printf(lldb::eSeverityError,
                               "Error in PrepareForExecution: %s.",
-                              jit_error.AsCString());
+                              jit_error.AsCString(nullptr));
     return false;
   }
 
diff --git a/lldb/source/Expression/IRExecutionUnit.cpp b/lldb/source/Expression/IRExecutionUnit.cpp
index 60b9de0d21b2e..73b91e6476ebb 100644
--- a/lldb/source/Expression/IRExecutionUnit.cpp
+++ b/lldb/source/Expression/IRExecutionUnit.cpp
@@ -126,7 +126,7 @@ Status IRExecutionUnit::DisassembleFunction(Stream &stream,
 
   if (func_local_addr == LLDB_INVALID_ADDRESS) {
     ret = Status::FromErrorStringWithFormat(
-        "Couldn't find function %s for disassembly", m_name.AsCString());
+        "Couldn't find function %s for disassembly", m_name.AsCString(nullptr));
     return ret;
   }
 
@@ -141,7 +141,7 @@ Status IRExecutionUnit::DisassembleFunction(Stream &stream,
 
   if (func_range.first == 0 && func_range.second == 0) {
     ret = Status::FromErrorStringWithFormat(
-        "Couldn't find code range for function %s", m_name.AsCString());
+        "Couldn't find code range for function %s", m_name.AsCString(nullptr));
     return ret;
   }
 
@@ -615,8 +615,8 @@ uint8_t *IRExecutionUnit::MemoryManager::allocateDataSection(
 
 void IRExecutionUnit::CollectCandidateCNames(std::vector<ConstString> &C_names,
                                              ConstString name) {
-  if (m_strip_underscore && name.AsCString()[0] == '_')
-    C_names.insert(C_names.begin(), ConstString(&name.AsCString()[1]));
+  if (m_strip_underscore && name.AsCString(nullptr)[0] == '_')
+    C_names.insert(C_names.begin(), ConstString(&name.AsCString(nullptr)[1]));
   C_names.push_back(name);
 }
 
diff --git a/lldb/source/Expression/LLVMUserExpression.cpp b/lldb/source/Expression/LLVMUserExpression.cpp
index 2d59194027b57..05156f349721f 100644
--- a/lldb/source/Expression/LLVMUserExpression.cpp
+++ b/lldb/source/Expression/LLVMUserExpression.cpp
@@ -123,7 +123,7 @@ LLVMUserExpression::DoExecute(DiagnosticManager &diagnostic_manager,
     if (!interpreter_error.Success()) {
       diagnostic_manager.Printf(lldb::eSeverityError,
                                 "supposed to interpret, but failed: %s",
-                                interpreter_error.AsCString());
+                                interpreter_error.AsCString(nullptr));
       return lldb::eExpressionDiscarded;
     }
   } else {
@@ -369,7 +369,7 @@ bool LLVMUserExpression::PrepareToExecuteJITExpression(
     if (!materialize_error.Success()) {
       diagnostic_manager.Printf(lldb::eSeverityError,
                                 "Couldn't materialize: %s",
-                                materialize_error.AsCString());
+                                materialize_error.AsCString(nullptr));
       return false;
     }
   }
diff --git a/lldb/source/Expression/Materializer.cpp b/lldb/source/Expression/Materializer.cpp
index 98c921493d97b..860f717bbd056 100644
--- a/lldb/source/Expression/Materializer.cpp
+++ b/lldb/source/Expression/Materializer.cpp
@@ -134,8 +134,8 @@ class EntityPersistentVariable : public Materializer::Entity {
     if (!write_error.Success()) {
       err = Status::FromErrorStringWithFormat(
           "couldn't write %s to the target: %s",
-          m_persistent_variable_sp->GetName().AsCString(),
-          write_error.AsCString());
+          m_persistent_variable_sp->GetName().AsCString(nullptr),
+          write_error.AsCString(nullptr));
       return;
     }
   }
@@ -154,7 +154,7 @@ class EntityPersistentVariable : public Materializer::Entity {
       err = Status::FromErrorStringWithFormat(
           "couldn't deallocate memory for %s: %s",
           m_persistent_variable_sp->GetName().GetCString(),
-          deallocate_error.AsCString());
+          deallocate_error.AsCString(nullptr));
     }
   }
 
@@ -168,7 +168,7 @@ class EntityPersistentVariable : public Materializer::Entity {
               "EntityPersistentVariable::Materialize [address = 0x%" PRIx64
               ", m_name = %s, m_flags = 0x%hx]",
               (uint64_t)load_addr,
-              m_persistent_variable_sp->GetName().AsCString(),
+              m_persistent_variable_sp->GetName().AsCString(nullptr),
               m_persistent_variable_sp->m_flags);
 
     if (m_persistent_variable_sp->m_flags &
@@ -196,13 +196,13 @@ class EntityPersistentVariable : public Materializer::Entity {
       if (!write_error.Success()) {
         err = Status::FromErrorStringWithFormat(
             "couldn't write the location of %s to memory: %s",
-            m_persistent_variable_sp->GetName().AsCString(),
-            write_error.AsCString());
+            m_persistent_variable_sp->GetName().AsCString(nullptr),
+            write_error.AsCString(nullptr));
       }
     } else {
       err = Status::FromErrorStringWithFormat(
           "no materialization happened for persistent variable %s",
-          m_persistent_variable_sp->GetName().AsCString());
+          m_persistent_variable_sp->GetName().AsCString(nullptr));
       return;
     }
   }
@@ -218,7 +218,7 @@ class EntityPersistentVariable : public Materializer::Entity {
               "EntityPersistentVariable::Dematerialize [address = 0x%" PRIx64
               ", m_name = %s, m_flags = 0x%hx]",
               (uint64_t)process_address + m_offset,
-              m_persistent_variable_sp->GetName().AsCString(),
+              m_persistent_variable_sp->GetName().AsCString(nullptr),
               m_persistent_variable_sp->m_flags);
 
     if (m_delegate) {
@@ -245,7 +245,7 @@ class EntityPersistentVariable : public Materializer::Entity {
           err = Status::FromErrorStringWithFormat(
               "couldn't read the address of program-allocated variable %s: %s",
               m_persistent_variable_sp->GetName().GetCString(),
-              read_error.AsCString());
+              read_error.AsCString(nullptr));
           return;
         }
 
@@ -319,7 +319,7 @@ class EntityPersistentVariable : public Materializer::Entity {
           err = Status::FromErrorStringWithFormat(
               "couldn't read the contents of %s from memory: %s",
               m_persistent_variable_sp->GetName().GetCString(),
-              read_error.AsCString());
+              read_error.AsCString(nullptr));
           return;
         }
 
@@ -329,7 +329,7 @@ class EntityPersistentVariable : public Materializer::Entity {
     } else {
       err = Status::FromErrorStringWithFormat(
           "no dematerialization happened for persistent variable %s",
-          m_persistent_variable_sp->GetName().AsCString());
+          m_persistent_variable_sp->GetName().AsCString(nullptr));
       return;
     }
 
@@ -353,7 +353,7 @@ class EntityPersistentVariable : public Materializer::Entity {
 
     dump_stream.Printf("0x%" PRIx64 ": EntityPersistentVariable (%s)\n",
                        load_addr,
-                       m_persistent_variable_sp->GetName().AsCString());
+                       m_persistent_variable_sp->GetName().AsCString(nullptr));
 
     {
       dump_stream.Printf("Pointer:\n");
@@ -459,7 +459,8 @@ class EntityVariableBase : public Materializer::Entity {
 
     if (!valobj_sp) {
       err = Status::FromErrorStringWithFormat(
-          "couldn't get a value object for variable %s", GetName().AsCString());
+          "couldn't get a value object for variable %s",
+          GetName().AsCString(nullptr));
       return;
     }
 
@@ -467,8 +468,8 @@ class EntityVariableBase : public Materializer::Entity {
 
     if (valobj_error.Fail()) {
       err = Status::FromErrorStringWithFormat(
-          "couldn't get the value of variable %s: %s", GetName().AsCString(),
-          valobj_error.AsCString());
+          "couldn't get the value of variable %s: %s",
+          GetName().AsCString(nullptr), valobj_error.AsCString(nullptr));
       return;
     }
 
@@ -480,7 +481,7 @@ class EntityVariableBase : public Materializer::Entity {
       if (!extract_error.Success()) {
         err = Status::FromErrorStringWithFormat(
             "couldn't read contents of reference variable %s: %s",
-            GetName().AsCString(), extract_error.AsCString());
+            GetName().AsCString(nullptr), extract_error.AsCString(nullptr));
         return;
       }
 
@@ -494,7 +495,7 @@ class EntityVariableBase : public Materializer::Entity {
         err = Status::FromErrorStringWithFormat(
             "couldn't write the contents of reference "
             "variable %s to memory: %s",
-            GetName().AsCString(), write_error.AsCString());
+            GetName().AsCString(nullptr), write_error.AsCString(nullptr));
         return;
       }
     } else {
@@ -507,7 +508,7 @@ class EntityVariableBase : public Materializer::Entity {
         if (!write_error.Success()) {
           err = Status::FromErrorStringWithFormat(
               "couldn't write the address of variable %s to memory: %s",
-              GetName().AsCString(), write_error.AsCString());
+              GetName().AsCString(nullptr), write_error.AsCString(nullptr));
           return;
         }
       } else {
@@ -516,15 +517,15 @@ class EntityVariableBase : public Materializer::Entity {
         valobj_sp->GetData(data, extract_error);
         if (!extract_error.Success()) {
           err = Status::FromErrorStringWithFormat(
-              "couldn't get the value of %s: %s", GetName().AsCString(),
-              extract_error.AsCString());
+              "couldn't get the value of %s: %s", GetName().AsCString(nullptr),
+              extract_error.AsCString(nullptr));
           return;
         }
 
         if (m_temporary_allocation != LLDB_INVALID_ADDRESS) {
           err = Status::FromErrorStringWithFormat(
               "trying to create a temporary region for %s but one exists",
-              GetName().AsCString());
+              GetName().AsCString(nullptr));
           return;
         }
 
@@ -534,12 +535,12 @@ class EntityVariableBase : public Materializer::Entity {
             err = Status::FromErrorStringWithFormat(
                 "the variable '%s' has no location, "
                 "it may have been optimized out",
-                GetName().AsCString());
+                GetName().AsCString(nullptr));
           } else {
             err = Status::FromErrorStringWithFormat(
                 "size of variable %s (%" PRIu64
                 ") is larger than the ValueObject's size (%" PRIu64 ")",
-                GetName().AsCString(),
+                GetName().AsCString(nullptr),
                 llvm::expectedToOptional(GetByteSize(scope)).value_or(0),
                 data.GetByteSize());
           }
@@ -549,7 +550,8 @@ class EntityVariableBase : public Materializer::Entity {
         std::optional<size_t> opt_bit_align = GetTypeBitAlign(scope);
         if (!opt_bit_align) {
           err = Status::FromErrorStringWithFormat(
-              "can't get the type alignment for %s", GetName().AsCString());
+              "can't get the type alignment for %s",
+              GetName().AsCString(nullptr));
           return;
         }
 
@@ -564,7 +566,7 @@ class EntityVariableBase : public Materializer::Entity {
         } else {
           err = Status::FromErrorStringWithFormat(
               "couldn't allocate a temporary region for %s: %s",
-              GetName().AsCString(),
+              GetName().AsCString(nullptr),
               toString(address_or_error.takeError()).c_str());
           return;
         }
@@ -582,7 +584,7 @@ class EntityVariableBase : public Materializer::Entity {
         if (!write_error.Success()) {
           err = Status::FromErrorStringWithFormat(
               "couldn't write to the temporary region for %s: %s",
-              GetName().AsCString(), write_error.AsCString());
+              GetName().AsCString(nullptr), write_error.AsCString(nullptr));
           return;
         }
 
@@ -594,7 +596,8 @@ class EntityVariableBase : public Materializer::Entity {
         if (!pointer_write_error.Success()) {
           err = Status::FromErrorStringWithFormat(
               "couldn't write the address of the temporary region for %s: %s",
-              GetName().AsCString(), pointer_write_error.AsCString());
+              GetName().AsCString(nullptr),
+              pointer_write_error.AsCString(nullptr));
         }
       }
     }
@@ -609,7 +612,7 @@ class EntityVariableBase : public Materializer::Entity {
     LLDB_LOGF(log,
               "EntityVariable::Dematerialize [address = 0x%" PRIx64
               ", m_variable_sp = %s]",
-              (uint64_t)load_addr, GetName().AsCString());
+              (uint64_t)load_addr, GetName().AsCString(nullptr));
 
     if (m_temporary_allocation != LLDB_INVALID_ADDRESS) {
       ExecutionContextScope *scope = frame_sp.get();
@@ -622,7 +625,7 @@ class EntityVariableBase : public Materializer::Entity {
       if (!valobj_sp) {
         err = Status::FromErrorStringWithFormat(
             "couldn't get a value object for variable %s",
-            GetName().AsCString());
+            GetName().AsCString(nullptr));
         return;
       }
 
@@ -637,7 +640,8 @@ class EntityVariableBase : public Materializer::Entity {
 
       if (!extract_error.Success()) {
         err = Status::FromErrorStringWithFormat(
-            "couldn't get the data for variable %s", GetName().AsCString());
+            "couldn't get the data for variable %s",
+            GetName().AsCString(nullptr));
         return;
       }
 
@@ -659,7 +663,7 @@ class EntityVariableBase : public Materializer::Entity {
         if (!set_error.Success()) {
           err = Status::FromErrorStringWithFormat(
               "couldn't write the new contents of %s back into the variable",
-              GetName().AsCString());
+              GetName().AsCString(nullptr));
           return;
         }
       }
@@ -671,7 +675,7 @@ class EntityVariableBase : public Materializer::Entity {
       if (!free_error.Success()) {
         err = Status::FromErrorStringWithFormat(
             "couldn't free the temporary region for %s: %s",
-            GetName().AsCString(), free_error.AsCString());
+            GetName().AsCString(nullptr), free_error.AsCString(nullptr));
         return;
       }
 
@@ -948,7 +952,7 @@ class EntityResultVariable : public Materializer::Entity {
       if (!opt_bit_align) {
         err = Status::FromErrorStringWithFormat(
             "can't get the alignment of type  \"%s\"",
-            m_type.GetTypeName().AsCString());
+            m_type.GetTypeName().AsCString(nullptr));
         return;
       }
 
@@ -978,7 +982,7 @@ class EntityResultVariable : public Materializer::Entity {
         err = Status::FromErrorStringWithFormat(
             "couldn't write the address of the "
             "temporary region for the result: %s",
-            pointer_write_error.AsCString());
+            pointer_write_error.AsCString(nullptr));
       }
     }
   }
@@ -1061,7 +1065,7 @@ class EntityResultVariable : public Materializer::Entity {
       err = Status::FromErrorStringWithFormat(
           "couldn't dematerialize a result variable: "
           "failed to make persistent variable %s",
-          name.AsCString());
+          name.AsCString(nullptr));
       return;
     }
 
@@ -1229,7 +1233,7 @@ class EntitySymbol : public Materializer::Entity {
     LLDB_LOGF(log,
               "EntitySymbol::Materialize [address = 0x%" PRIx64
               ", m_symbol = %s]",
-              (uint64_t)load_addr, m_symbol.GetName().AsCString());
+              (uint64_t)load_addr, m_symbol.GetName().AsCString(nullptr));
 
     const Address sym_address = m_symbol.GetAddress();
 
@@ -1245,7 +1249,7 @@ class EntitySymbol : public Materializer::Entity {
     if (!target_sp) {
       err = Status::FromErrorStringWithFormat(
           "couldn't resolve symbol %s because there is no target",
-          m_symbol.GetName().AsCString());
+          m_symbol.GetName().AsCString(nullptr));
       return;
     }
 
@@ -1261,7 +1265,8 @@ class EntitySymbol : public Materializer::Entity {
     if (!pointer_write_error.Success()) {
       err = Status::FromErrorStringWithFormat(
           "couldn't write the address of symbol %s: %s",
-          m_symbol.GetName().AsCString(), pointer_write_error.AsCString());
+          m_symbol.GetName().AsCString(nullptr),
+          pointer_write_error.AsCString(nullptr));
       return;
     }
   }
@@ -1276,7 +1281,7 @@ class EntitySymbol : public Materializer::Entity {
     LLDB_LOGF(log,
               "EntitySymbol::Dematerialize [address = 0x%" PRIx64
               ", m_symbol = %s]",
-              (uint64_t)load_addr, m_symbol.GetName().AsCString());
+              (uint64_t)load_addr, m_symbol.GetName().AsCString(nullptr));
 
     // no work needs to be done
   }
@@ -1290,7 +1295,7 @@ class EntitySymbol : public Materializer::Entity {
     const lldb::addr_t load_addr = process_address + m_offset;
 
     dump_stream.Printf("0x%" PRIx64 ": EntitySymbol (%s)\n", load_addr,
-                       m_symbol.GetName().AsCString());
+                       m_symbol.GetName().AsCString(nullptr));
 
     {
       dump_stream.Printf("Pointer:\n");
@@ -1387,7 +1392,7 @@ class EntityRegister : public Materializer::Entity {
     if (!write_error.Success()) {
       err = Status::FromErrorStringWithFormat(
           "couldn't write the contents of register %s: %s",
-          m_register_info.name, write_error.AsCString());
+          m_register_info.name, write_error.AsCString(nullptr));
       return;
     }
   }
@@ -1423,7 +1428,7 @@ class EntityRegister : public Materializer::Entity {
     if (!extract_error.Success()) {
       err = Status::FromErrorStringWithFormat(
           "couldn't get the data for register %s: %s", m_register_info.name,
-          extract_error.AsCString());
+          extract_error.AsCString(nullptr));
       return;
     }
 
diff --git a/lldb/source/Expression/REPL.cpp b/lldb/source/Expression/REPL.cpp
index 20d4cb700e161..c0bd693833f38 100644
--- a/lldb/source/Expression/REPL.cpp
+++ b/lldb/source/Expression/REPL.cpp
@@ -387,7 +387,7 @@ void REPL::IOHandlerInputComplete(IOHandler &io_handler, std::string &code) {
             add_to_code = false;
             [[fallthrough]];
           case lldb::eExpressionDiscarded:
-            locked_error_stream.Printf("%s\n", error.AsCString());
+            locked_error_stream.Printf("%s\n", error.AsCString(nullptr));
             break;
 
           case lldb::eExpressionCompleted:
@@ -430,23 +430,25 @@ void REPL::IOHandlerInputComplete(IOHandler &io_handler, std::string &code) {
 
           case lldb::eExpressionTimedOut:
             locked_error_stream.Printf("error: timeout\n");
-            if (error.AsCString())
-              locked_error_stream.Printf("error: %s\n", error.AsCString());
+            if (error.AsCString(nullptr))
+              locked_error_stream.Printf("error: %s\n",
+                                         error.AsCString(nullptr));
             break;
           case lldb::eExpressionResultUnavailable:
             // Shoulnd't happen???
             locked_error_stream.Printf("error: could not fetch result -- %s\n",
-                                       error.AsCString());
+                                       error.AsCString(nullptr));
             break;
           case lldb::eExpressionStoppedForDebug:
             // Shoulnd't happen???
             locked_error_stream.Printf("error: stopped for debug -- %s\n",
-                                       error.AsCString());
+                                       error.AsCString(nullptr));
             break;
           case lldb::eExpressionThreadVanished:
             // Shoulnd't happen???
             locked_error_stream.Printf(
-                "error: expression thread vanished -- %s\n", error.AsCString());
+                "error: expression thread vanished -- %s\n",
+                error.AsCString(nullptr));
             break;
           }
         }
diff --git a/lldb/source/Expression/UserExpression.cpp b/lldb/source/Expression/UserExpression.cpp
index d39bcced48390..96fb1d1029df5 100644
--- a/lldb/source/Expression/UserExpression.cpp
+++ b/lldb/source/Expression/UserExpression.cpp
@@ -258,7 +258,7 @@ UserExpression::Evaluate(ExecutionContext &exe_ctx,
           expr, full_prefix, language, desired_type, options, ctx_obj, error));
   if (error.Fail() || !user_expression_sp) {
     LLDB_LOG(log, "== [UserExpression::Evaluate] Getting expression: {0} ==",
-             error.AsCString());
+             error.AsCString(nullptr));
     set_error(std::move(error));
     return lldb::eExpressionSetupError;
   }
diff --git a/lldb/source/Host/common/NativeRegisterContext.cpp b/lldb/source/Host/common/NativeRegisterContext.cpp
index 8a1cfbc286627..7767b9f2e75c6 100644
--- a/lldb/source/Host/common/NativeRegisterContext.cpp
+++ b/lldb/source/Host/common/NativeRegisterContext.cpp
@@ -205,7 +205,8 @@ NativeRegisterContext::ReadRegisterAsUnsigned(const RegisterInfo *reg_info,
                 value.GetAsUInt64());
       return value.GetAsUInt64();
     } else {
-      LLDB_LOGF(log, "Read register failed: error %s", error.AsCString());
+      LLDB_LOGF(log, "Read register failed: error %s",
+                error.AsCString(nullptr));
     }
   } else {
     LLDB_LOGF(log, "Read register failed: null reg_info");
diff --git a/lldb/source/Host/common/Socket.cpp b/lldb/source/Host/common/Socket.cpp
index 48191b4d1ca81..092c91cd30393 100644
--- a/lldb/source/Host/common/Socket.cpp
+++ b/lldb/source/Host/common/Socket.cpp
@@ -335,7 +335,7 @@ Status Socket::Read(void *buf, size_t &num_bytes) {
             " (error = %s)",
             static_cast<void *>(this), static_cast<uint64_t>(m_socket), buf,
             static_cast<uint64_t>(num_bytes),
-            static_cast<int64_t>(bytes_received), error.AsCString());
+            static_cast<int64_t>(bytes_received), error.AsCString(nullptr));
 
   return error;
 }
@@ -360,7 +360,7 @@ Status Socket::Write(const void *buf, size_t &num_bytes) {
             " (error = %s)",
             static_cast<void *>(this), static_cast<uint64_t>(m_socket), buf,
             static_cast<uint64_t>(src_len), static_cast<int64_t>(bytes_sent),
-            error.AsCString());
+            error.AsCString(nullptr));
 
   return error;
 }
diff --git a/lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp b/lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp
index e65a67fe1bd15..50fc5b7465ecf 100644
--- a/lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp
+++ b/lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp
@@ -97,7 +97,7 @@ void ConnectionFileDescriptor::OpenCommandPipe() {
     LLDB_LOGF(log,
               "%p ConnectionFileDescriptor::OpenCommandPipe () - could not "
               "make pipe: %s",
-              static_cast<void *>(this), result.AsCString());
+              static_cast<void *>(this), result.AsCString(nullptr));
   } else {
     LLDB_LOGF(log,
               "%p ConnectionFileDescriptor::OpenCommandPipe() - success "
@@ -275,7 +275,7 @@ size_t ConnectionFileDescriptor::Read(void *dst, size_t dst_len,
            "{0} ConnectionFileDescriptor::Read()  fd = {1}"
            ", dst = {2}, dst_len = {3}) => {4}, error = {5}",
            this, m_io_sp->GetWaitableHandle(), dst, dst_len, bytes_read,
-           error.AsCString());
+           error.AsCString(nullptr));
 
   if (bytes_read == 0) {
     error.Clear(); // End-of-file.  Do not automatically close; pass along for
@@ -375,7 +375,7 @@ size_t ConnectionFileDescriptor::Write(const void *src, size_t src_len,
            "{0} ConnectionFileDescriptor::Write(fd = {1}"
            ", src = {2}, src_len = {3}) => {4} (error = {5})",
            this, m_io_sp->GetWaitableHandle(), src, src_len, bytes_sent,
-           error.AsCString());
+           error.AsCString(nullptr));
 
   if (error_ptr)
     *error_ptr = error.Clone();
diff --git a/lldb/source/Host/windows/ConnectionGenericFileWindows.cpp b/lldb/source/Host/windows/ConnectionGenericFileWindows.cpp
index 697c592644cd5..b39bff96e72c0 100644
--- a/lldb/source/Host/windows/ConnectionGenericFileWindows.cpp
+++ b/lldb/source/Host/windows/ConnectionGenericFileWindows.cpp
@@ -152,8 +152,9 @@ size_t ConnectionGenericFile::Read(void *dst, size_t dst_len,
               "%p ConnectionGenericFile::Read()  handle = %p, dst = %p, "
               "dst_len = %zu) => %zu, error = %s",
               static_cast<void *>(this), m_file, dst, dst_len, bytes,
-              error_code ? Status(error_code, eErrorTypeWin32).AsCString()
-                         : "");
+              error_code
+                  ? Status(error_code, eErrorTypeWin32).AsCString(nullptr)
+                  : "");
     return bytes;
   };
 
@@ -236,7 +237,7 @@ size_t ConnectionGenericFile::Write(const void *src, size_t src_len,
               "%p ConnectionGenericFile::Write()  handle = %p, src = %p, "
               "src_len = %zu) => %zu, error = %s",
               static_cast<void *>(this), m_file, src, src_len, bytes,
-              Status(error_code, eErrorTypeWin32).AsCString());
+              Status(error_code, eErrorTypeWin32).AsCString(nullptr));
     return bytes;
   };
 
diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp b/lldb/source/Interpreter/CommandInterpreter.cpp
index eeb1ae0ff3eb8..1711b6f3a2bda 100644
--- a/lldb/source/Interpreter/CommandInterpreter.cpp
+++ b/lldb/source/Interpreter/CommandInterpreter.cpp
@@ -2217,7 +2217,7 @@ bool CommandInterpreter::HandleCommand(const char *command_line,
     Status error(PreprocessCommand(command_string));
 
     if (error.Fail()) {
-      result.AppendError(error.AsCString());
+      result.AppendError(error.AsCString(nullptr));
       return false;
     }
   }
diff --git a/lldb/source/Interpreter/CommandObject.cpp b/lldb/source/Interpreter/CommandObject.cpp
index 38a34496e73ff..035abfb025183 100644
--- a/lldb/source/Interpreter/CommandObject.cpp
+++ b/lldb/source/Interpreter/CommandObject.cpp
@@ -380,7 +380,7 @@ bool CommandObject::ParseOptionsAndNotify(Args &args,
 
   Status error(group_options.NotifyOptionParsingFinished(&exe_ctx));
   if (error.Fail()) {
-    result.AppendError(error.AsCString());
+    result.AppendError(error.AsCString(nullptr));
     return false;
   }
   return true;
diff --git a/lldb/source/Interpreter/OptionValueDictionary.cpp b/lldb/source/Interpreter/OptionValueDictionary.cpp
index 0efc76bb7cd94..affac243df1ec 100644
--- a/lldb/source/Interpreter/OptionValueDictionary.cpp
+++ b/lldb/source/Interpreter/OptionValueDictionary.cpp
@@ -302,7 +302,7 @@ Status OptionValueDictionary::SetSubValue(const ExecutionContext *exe_ctx,
   if (value_sp)
     error = value_sp->SetValueFromString(value, op);
   else {
-    if (error.AsCString() == nullptr)
+    if (error.AsCString(nullptr) == nullptr)
       error = Status::FromErrorStringWithFormat("invalid value path '%s'",
                                                 name.str().c_str());
   }
diff --git a/lldb/source/Interpreter/OptionValuePathMappings.cpp b/lldb/source/Interpreter/OptionValuePathMappings.cpp
index abf4d429602e4..733d92f1e1e7b 100644
--- a/lldb/source/Interpreter/OptionValuePathMappings.cpp
+++ b/lldb/source/Interpreter/OptionValuePathMappings.cpp
@@ -82,7 +82,8 @@ Status OptionValuePathMappings::SetValueFromString(llvm::StringRef value,
             changed = true;
           } else {
             std::string previousError =
-                error.Fail() ? std::string(error.AsCString()) + "\n" : "";
+                error.Fail() ? std::string(error.AsCString(nullptr)) + "\n"
+                             : "";
             error = Status::FromErrorStringWithFormat(
                 "%sthe replacement path doesn't exist: \"%s\"",
                 previousError.c_str(), replace_path);
@@ -123,7 +124,7 @@ Status OptionValuePathMappings::SetValueFromString(llvm::StringRef value,
           changed = true;
         } else {
           std::string previousError =
-              error.Fail() ? std::string(error.AsCString()) + "\n" : "";
+              error.Fail() ? std::string(error.AsCString(nullptr)) + "\n" : "";
           error = Status::FromErrorStringWithFormat(
               "%sthe replacement path doesn't exist: \"%s\"",
               previousError.c_str(), replace_path);
@@ -159,7 +160,8 @@ Status OptionValuePathMappings::SetValueFromString(llvm::StringRef value,
             idx++;
           } else {
             std::string previousError =
-                error.Fail() ? std::string(error.AsCString()) + "\n" : "";
+                error.Fail() ? std::string(error.AsCString(nullptr)) + "\n"
+                             : "";
             error = Status::FromErrorStringWithFormat(
                 "%sthe replacement path doesn't exist: \"%s\"",
                 previousError.c_str(), replace_path);
diff --git a/lldb/source/Interpreter/OptionValueProperties.cpp b/lldb/source/Interpreter/OptionValueProperties.cpp
index def6cc462f76a..51b97b9b8dd03 100644
--- a/lldb/source/Interpreter/OptionValueProperties.cpp
+++ b/lldb/source/Interpreter/OptionValueProperties.cpp
@@ -146,7 +146,7 @@ Status OptionValueProperties::SetSubValue(const ExecutionContext *exe_ctx,
   else {
     // Don't set an error if the path contained .experimental. - those are
     // allowed to be missing and should silently fail.
-    if (!name_contains_experimental && error.AsCString() == nullptr) {
+    if (!name_contains_experimental && error.AsCString(nullptr) == nullptr) {
       error = Status::FromErrorStringWithFormat("invalid value path '%s'",
                                                 name.str().c_str());
     }
diff --git a/lldb/source/Plugins/ABI/AArch64/ABIMacOSX_arm64.cpp b/lldb/source/Plugins/ABI/AArch64/ABIMacOSX_arm64.cpp
index c595564f6fb8e..67dadcc03a73f 100644
--- a/lldb/source/Plugins/ABI/AArch64/ABIMacOSX_arm64.cpp
+++ b/lldb/source/Plugins/ABI/AArch64/ABIMacOSX_arm64.cpp
@@ -259,7 +259,7 @@ ABIMacOSX_arm64::SetReturnValueObject(lldb::StackFrameSP &frame_sp,
     if (data_error.Fail()) {
       error = Status::FromErrorStringWithFormat(
           "Couldn't convert return value to raw data: %s",
-          data_error.AsCString());
+          data_error.AsCString(nullptr));
       return error;
     }
 
diff --git a/lldb/source/Plugins/ABI/AArch64/ABISysV_arm64.cpp b/lldb/source/Plugins/ABI/AArch64/ABISysV_arm64.cpp
index aa9c20b6bb2cf..de3ba49be7999 100644
--- a/lldb/source/Plugins/ABI/AArch64/ABISysV_arm64.cpp
+++ b/lldb/source/Plugins/ABI/AArch64/ABISysV_arm64.cpp
@@ -148,7 +148,8 @@ bool ABISysV_arm64::PrepareTrivialCall(Thread &thread, addr_t sp,
     // If we could not manage the GCS, the expression will certainly fail,
     // and if we just carried on, that failure would be a lot more cryptic.
     if (err.Fail()) {
-      LLDB_LOGF(log, "Failed to setup Guarded Call Stack: %s", err.AsCString());
+      LLDB_LOGF(log, "Failed to setup Guarded Call Stack: %s",
+                err.AsCString(nullptr));
       return false;
     }
   }
@@ -300,7 +301,7 @@ Status ABISysV_arm64::SetReturnValueObject(lldb::StackFrameSP &frame_sp,
     if (data_error.Fail()) {
       error = Status::FromErrorStringWithFormat(
           "Couldn't convert return value to raw data: %s",
-          data_error.AsCString());
+          data_error.AsCString(nullptr));
       return error;
     }
 
diff --git a/lldb/source/Plugins/ABI/ARC/ABISysV_arc.cpp b/lldb/source/Plugins/ABI/ARC/ABISysV_arc.cpp
index 95f4057b1d3e8..19c7de4df2a93 100644
--- a/lldb/source/Plugins/ABI/ARC/ABISysV_arc.cpp
+++ b/lldb/source/Plugins/ABI/ARC/ABISysV_arc.cpp
@@ -337,7 +337,8 @@ Status ABISysV_arc::SetReturnValueObject(StackFrameSP &frame_sp,
 
   if (result.Fail()) {
     result = Status::FromErrorStringWithFormat(
-        "Couldn't convert return value to raw data: %s", result.AsCString());
+        "Couldn't convert return value to raw data: %s",
+        result.AsCString(nullptr));
     return result;
   }
 
diff --git a/lldb/source/Plugins/ABI/ARM/ABIMacOSX_arm.cpp b/lldb/source/Plugins/ABI/ARM/ABIMacOSX_arm.cpp
index 84791a90a450d..0b6575a7b1c6b 100644
--- a/lldb/source/Plugins/ABI/ARM/ABIMacOSX_arm.cpp
+++ b/lldb/source/Plugins/ABI/ARM/ABIMacOSX_arm.cpp
@@ -1707,7 +1707,7 @@ Status ABIMacOSX_arm::SetReturnValueObject(lldb::StackFrameSP &frame_sp,
     if (data_error.Fail()) {
       error = Status::FromErrorStringWithFormat(
           "Couldn't convert return value to raw data: %s",
-          data_error.AsCString());
+          data_error.AsCString(nullptr));
       return error;
     }
     lldb::offset_t offset = 0;
diff --git a/lldb/source/Plugins/ABI/ARM/ABISysV_arm.cpp b/lldb/source/Plugins/ABI/ARM/ABISysV_arm.cpp
index 5b6cdbf74504c..5c75d6f93505a 100644
--- a/lldb/source/Plugins/ABI/ARM/ABISysV_arm.cpp
+++ b/lldb/source/Plugins/ABI/ARM/ABISysV_arm.cpp
@@ -1850,7 +1850,7 @@ Status ABISysV_arm::SetReturnValueObject(lldb::StackFrameSP &frame_sp,
     if (data_error.Fail()) {
       error = Status::FromErrorStringWithFormat(
           "Couldn't convert return value to raw data: %s",
-          data_error.AsCString());
+          data_error.AsCString(nullptr));
       return error;
     }
     lldb::offset_t offset = 0;
diff --git a/lldb/source/Plugins/ABI/LoongArch/ABISysV_loongarch.cpp b/lldb/source/Plugins/ABI/LoongArch/ABISysV_loongarch.cpp
index d2a2cbe0643ac..42786687de916 100644
--- a/lldb/source/Plugins/ABI/LoongArch/ABISysV_loongarch.cpp
+++ b/lldb/source/Plugins/ABI/LoongArch/ABISysV_loongarch.cpp
@@ -272,7 +272,8 @@ Status ABISysV_loongarch::SetReturnValueObject(StackFrameSP &frame_sp,
 
   if (result.Fail()) {
     result = Status::FromErrorStringWithFormat(
-        "Couldn't convert return value to raw data: %s", result.AsCString());
+        "Couldn't convert return value to raw data: %s",
+        result.AsCString(nullptr));
     return result;
   }
 
diff --git a/lldb/source/Plugins/ABI/Mips/ABISysV_mips.cpp b/lldb/source/Plugins/ABI/Mips/ABISysV_mips.cpp
index dd99d47bb28ce..9afaa7f52b32e 100644
--- a/lldb/source/Plugins/ABI/Mips/ABISysV_mips.cpp
+++ b/lldb/source/Plugins/ABI/Mips/ABISysV_mips.cpp
@@ -720,7 +720,7 @@ Status ABISysV_mips::SetReturnValueObject(lldb::StackFrameSP &frame_sp,
     if (data_error.Fail()) {
       error = Status::FromErrorStringWithFormat(
           "Couldn't convert return value to raw data: %s",
-          data_error.AsCString());
+          data_error.AsCString(nullptr));
       return error;
     }
 
diff --git a/lldb/source/Plugins/ABI/Mips/ABISysV_mips64.cpp b/lldb/source/Plugins/ABI/Mips/ABISysV_mips64.cpp
index 328ddad975248..9ac345e41d965 100644
--- a/lldb/source/Plugins/ABI/Mips/ABISysV_mips64.cpp
+++ b/lldb/source/Plugins/ABI/Mips/ABISysV_mips64.cpp
@@ -680,7 +680,7 @@ Status ABISysV_mips64::SetReturnValueObject(lldb::StackFrameSP &frame_sp,
   if (data_error.Fail()) {
     error = Status::FromErrorStringWithFormat(
         "Couldn't convert return value to raw data: %s",
-        data_error.AsCString());
+        data_error.AsCString(nullptr));
     return error;
   }
 
diff --git a/lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc.cpp b/lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc.cpp
index bdfc9c7e08061..9a0ab3be044d2 100644
--- a/lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc.cpp
+++ b/lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc.cpp
@@ -440,7 +440,7 @@ Status ABISysV_ppc::SetReturnValueObject(lldb::StackFrameSP &frame_sp,
     if (data_error.Fail())
       return Status::FromErrorStringWithFormat(
           "Couldn't convert return value to raw data: %s",
-          data_error.AsCString());
+          data_error.AsCString(nullptr));
     lldb::offset_t offset = 0;
     if (num_bytes <= 8) {
       uint64_t raw_value = data.GetMaxU64(&offset, num_bytes);
@@ -466,7 +466,7 @@ Status ABISysV_ppc::SetReturnValueObject(lldb::StackFrameSP &frame_sp,
       if (data_error.Fail()) {
         error = Status::FromErrorStringWithFormat(
             "Couldn't convert return value to raw data: %s",
-            data_error.AsCString());
+            data_error.AsCString(nullptr));
         return error;
       }
 
diff --git a/lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc64.cpp b/lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc64.cpp
index 0895cd3d75df6..9ce33037cfcc4 100644
--- a/lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc64.cpp
+++ b/lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc64.cpp
@@ -323,7 +323,7 @@ Status ABISysV_ppc64::SetReturnValueObject(lldb::StackFrameSP &frame_sp,
     if (data_error.Fail()) {
       error = Status::FromErrorStringWithFormat(
           "Couldn't convert return value to raw data: %s",
-          data_error.AsCString());
+          data_error.AsCString(nullptr));
       return error;
     }
     lldb::offset_t offset = 0;
@@ -351,7 +351,7 @@ Status ABISysV_ppc64::SetReturnValueObject(lldb::StackFrameSP &frame_sp,
       if (data_error.Fail()) {
         error = Status::FromErrorStringWithFormat(
             "Couldn't convert return value to raw data: %s",
-            data_error.AsCString());
+            data_error.AsCString(nullptr));
         return error;
       }
 
diff --git a/lldb/source/Plugins/ABI/RISCV/ABISysV_riscv.cpp b/lldb/source/Plugins/ABI/RISCV/ABISysV_riscv.cpp
index dce905f08aa5f..93c83e8b048fe 100644
--- a/lldb/source/Plugins/ABI/RISCV/ABISysV_riscv.cpp
+++ b/lldb/source/Plugins/ABI/RISCV/ABISysV_riscv.cpp
@@ -393,7 +393,8 @@ Status ABISysV_riscv::SetReturnValueObject(StackFrameSP &frame_sp,
 
   if (result.Fail()) {
     result = Status::FromErrorStringWithFormat(
-        "Couldn't convert return value to raw data: %s", result.AsCString());
+        "Couldn't convert return value to raw data: %s",
+        result.AsCString(nullptr));
     return result;
   }
 
diff --git a/lldb/source/Plugins/ABI/SystemZ/ABISysV_s390x.cpp b/lldb/source/Plugins/ABI/SystemZ/ABISysV_s390x.cpp
index f1abe94345371..44613fa54362d 100644
--- a/lldb/source/Plugins/ABI/SystemZ/ABISysV_s390x.cpp
+++ b/lldb/source/Plugins/ABI/SystemZ/ABISysV_s390x.cpp
@@ -407,7 +407,7 @@ Status ABISysV_s390x::SetReturnValueObject(lldb::StackFrameSP &frame_sp,
     if (data_error.Fail()) {
       error = Status::FromErrorStringWithFormat(
           "Couldn't convert return value to raw data: %s",
-          data_error.AsCString());
+          data_error.AsCString(nullptr));
       return error;
     }
     lldb::offset_t offset = 0;
@@ -437,7 +437,7 @@ Status ABISysV_s390x::SetReturnValueObject(lldb::StackFrameSP &frame_sp,
       if (data_error.Fail()) {
         error = Status::FromErrorStringWithFormat(
             "Couldn't convert return value to raw data: %s",
-            data_error.AsCString());
+            data_error.AsCString(nullptr));
         return error;
       }
 
diff --git a/lldb/source/Plugins/ABI/X86/ABIMacOSX_i386.cpp b/lldb/source/Plugins/ABI/X86/ABIMacOSX_i386.cpp
index 8fd1752429535..9e9ed3ba4d33c 100644
--- a/lldb/source/Plugins/ABI/X86/ABIMacOSX_i386.cpp
+++ b/lldb/source/Plugins/ABI/X86/ABIMacOSX_i386.cpp
@@ -210,7 +210,7 @@ Status ABIMacOSX_i386::SetReturnValueObject(lldb::StackFrameSP &frame_sp,
     if (data_error.Fail()) {
       error = Status::FromErrorStringWithFormat(
           "Couldn't convert return value to raw data: %s",
-          data_error.AsCString());
+          data_error.AsCString(nullptr));
       return error;
     }
     lldb::offset_t offset = 0;
diff --git a/lldb/source/Plugins/ABI/X86/ABISysV_i386.cpp b/lldb/source/Plugins/ABI/X86/ABISysV_i386.cpp
index b7304e8267464..db5f3433dd903 100644
--- a/lldb/source/Plugins/ABI/X86/ABISysV_i386.cpp
+++ b/lldb/source/Plugins/ABI/X86/ABISysV_i386.cpp
@@ -223,7 +223,7 @@ Status ABISysV_i386::SetReturnValueObject(lldb::StackFrameSP &frame_sp,
   if (data_error.Fail()) {
     error = Status::FromErrorStringWithFormat(
         "Couldn't convert return value to raw data: %s",
-        data_error.AsCString());
+        data_error.AsCString(nullptr));
     return error;
   }
 
diff --git a/lldb/source/Plugins/ABI/X86/ABISysV_x86_64.cpp b/lldb/source/Plugins/ABI/X86/ABISysV_x86_64.cpp
index c033c0edadc82..8ffc038d42a5f 100644
--- a/lldb/source/Plugins/ABI/X86/ABISysV_x86_64.cpp
+++ b/lldb/source/Plugins/ABI/X86/ABISysV_x86_64.cpp
@@ -321,7 +321,7 @@ Status ABISysV_x86_64::SetReturnValueObject(lldb::StackFrameSP &frame_sp,
     if (data_error.Fail()) {
       error = Status::FromErrorStringWithFormat(
           "Couldn't convert return value to raw data: %s",
-          data_error.AsCString());
+          data_error.AsCString(nullptr));
       return error;
     }
     lldb::offset_t offset = 0;
@@ -351,7 +351,7 @@ Status ABISysV_x86_64::SetReturnValueObject(lldb::StackFrameSP &frame_sp,
       if (data_error.Fail()) {
         error = Status::FromErrorStringWithFormat(
             "Couldn't convert return value to raw data: %s",
-            data_error.AsCString());
+            data_error.AsCString(nullptr));
         return error;
       }
 
diff --git a/lldb/source/Plugins/ABI/X86/ABIWindows_x86_64.cpp b/lldb/source/Plugins/ABI/X86/ABIWindows_x86_64.cpp
index 079b22a307602..880052040db78 100644
--- a/lldb/source/Plugins/ABI/X86/ABIWindows_x86_64.cpp
+++ b/lldb/source/Plugins/ABI/X86/ABIWindows_x86_64.cpp
@@ -326,7 +326,7 @@ Status ABIWindows_x86_64::SetReturnValueObject(lldb::StackFrameSP &frame_sp,
     if (data_error.Fail()) {
       error = Status::FromErrorStringWithFormat(
           "Couldn't convert return value to raw data: %s",
-          data_error.AsCString());
+          data_error.AsCString(nullptr));
       return error;
     }
     lldb::offset_t offset = 0;
@@ -356,7 +356,7 @@ Status ABIWindows_x86_64::SetReturnValueObject(lldb::StackFrameSP &frame_sp,
       if (data_error.Fail()) {
         error = Status::FromErrorStringWithFormat(
             "Couldn't convert return value to raw data: %s",
-            data_error.AsCString());
+            data_error.AsCString(nullptr));
         return error;
       }
 
diff --git a/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp b/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
index 5d8c430e69225..b58cf6e2b60bd 100644
--- a/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
+++ b/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
@@ -846,7 +846,7 @@ bool DynamicLoaderDarwinKernel::KextImageInfo::LoadImageUsingMemoryModule(
                   "system.\n");
         if (kernel_search_error.Fail() && kernel_search_error.AsCString("") &&
             kernel_search_error.AsCString("")[0] != '\0') {
-          *s << kernel_search_error.AsCString();
+          *s << kernel_search_error.AsCString(nullptr);
         }
       }
     }
@@ -1058,7 +1058,7 @@ void DynamicLoaderDarwinKernel::LoadKernelModuleIfNeeded() {
       kernel_name =
           m_kernel.GetModule()->GetObjectFile()->GetFileSpec().GetFilename();
     }
-    m_kernel.SetName(kernel_name.AsCString());
+    m_kernel.SetName(kernel_name.AsCString(nullptr));
 
     if (m_kernel.GetLoadAddress() == LLDB_INVALID_ADDRESS) {
       m_kernel.SetLoadAddress(m_kernel_load_address);
diff --git a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp
index f3a7e29dcf972..da26d2c042b91 100644
--- a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp
+++ b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp
@@ -123,7 +123,7 @@ addr_t DYLDRendezvous::ResolveRendezvousAddress() {
   info_addr = m_process->ReadPointerFromMemory(info_location, error);
   if (error.Fail()) {
     LLDB_LOGF(log, "%s FAILED - could not read from the info location: %s",
-              __FUNCTION__, error.AsCString());
+              __FUNCTION__, error.AsCString(nullptr));
     return LLDB_INVALID_ADDRESS;
   }
 
@@ -656,7 +656,7 @@ void DYLDRendezvous::UpdateFileSpecIfNecessary(SOEntry &entry) {
     Status region_status =
         m_process->GetMemoryRegionInfo(entry.dyn_addr, region);
     if (!region.GetName().IsEmpty())
-      entry.file_spec.SetFile(region.GetName().AsCString(),
+      entry.file_spec.SetFile(region.GetName().AsCString(nullptr),
                               FileSpec::Style::native);
   }
 }
diff --git a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
index 5e7c44d796bb9..dce94873a04d2 100644
--- a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
+++ b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
@@ -823,7 +823,7 @@ DynamicLoaderPOSIXDYLD::GetThreadLocalData(const lldb::ModuleSP module_sp,
   if (!link_map_addr_opt.has_value()) {
     LLDB_LOGF(
         log, "GetThreadLocalData error: module(%s) not found in loaded modules",
-        module_sp->GetObjectName().AsCString());
+        module_sp->GetObjectName().AsCString(nullptr));
     return LLDB_INVALID_ADDRESS;
   }
 
@@ -957,7 +957,7 @@ void DynamicLoaderPOSIXDYLD::ResolveExecutableModule(
     LLDB_LOGF(log,
               "DynamicLoaderPOSIXDYLD::%s - failed to resolve executable "
               "with module spec \"%s\": %s",
-              __FUNCTION__, stream.GetData(), error.AsCString());
+              __FUNCTION__, stream.GetData(), error.AsCString(nullptr));
     return;
   }
 
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
index 78a9e9e35a4ec..4536aa8504696 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
@@ -931,7 +931,8 @@ void ClangASTSource::FindObjCMethodDecls(NameSearchContext &context) {
 
   do {
     StreamString ms;
-    ms.Printf("-[%s %s]", interface_name.c_str(), selector_name.AsCString());
+    ms.Printf("-[%s %s]", interface_name.c_str(),
+              selector_name.AsCString(nullptr));
     ms.Flush();
     ConstString instance_method_name(ms.GetString());
 
@@ -944,7 +945,8 @@ void ClangASTSource::FindObjCMethodDecls(NameSearchContext &context) {
       break;
 
     ms.Clear();
-    ms.Printf("+[%s %s]", interface_name.c_str(), selector_name.AsCString());
+    ms.Printf("+[%s %s]", interface_name.c_str(),
+              selector_name.AsCString(nullptr));
     ms.Flush();
     ConstString class_method_name(ms.GetString());
 
@@ -970,7 +972,8 @@ void ClangASTSource::FindObjCMethodDecls(NameSearchContext &context) {
       if (!candidate_sc.function)
         continue;
 
-      const char *candidate_name = candidate_sc.function->GetName().AsCString();
+      const char *candidate_name =
+          candidate_sc.function->GetName().AsCString(nullptr);
 
       const char *cursor = candidate_name;
 
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
index d04981191e6ce..ad9d41a7b8852 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
@@ -1467,12 +1467,13 @@ void ClangExpressionDeclMap::FindExternalVisibleDecls(
       const unsigned diag_id =
           m_ast_context->getDiagnostics().getCustomDiagID(
               clang::DiagnosticsEngine::Level::Error, "%0");
-      m_ast_context->getDiagnostics().Report(diag_id) << error.AsCString();
+      m_ast_context->getDiagnostics().Report(diag_id)
+          << error.AsCString(nullptr);
     }
 
     if (data_symbol) {
       std::string warning("got name from symbols: ");
-      warning.append(name.AsCString());
+      warning.append(name.AsCString(nullptr));
       const unsigned diag_id =
           m_ast_context->getDiagnostics().getCustomDiagID(
               clang::DiagnosticsEngine::Level::Warning, "%0");
@@ -1523,7 +1524,8 @@ bool ClangExpressionDeclMap::GetVariableValue(VariableSP &var,
                            const_value_extractor.GetByteSize());
       var_location.SetValueType(Value::ValueType::HostAddress);
     } else {
-      LLDB_LOG(log, "Error evaluating constant variable: {0}", err.AsCString());
+      LLDB_LOG(log, "Error evaluating constant variable: {0}",
+               err.AsCString(nullptr));
       return false;
     }
   }
@@ -1825,7 +1827,8 @@ void ClangExpressionDeclMap::AddOneFunction(NameSearchContext &context,
     Type *function_type = function->GetType();
 
     const auto lang = function->GetCompileUnit()->GetLanguage();
-    const auto name = function->GetMangled().GetMangledName().AsCString();
+    const auto name =
+        function->GetMangled().GetMangledName().AsCString(nullptr);
     const bool extern_c =
         (Language::LanguageIsC(lang) && !Mangled::IsMangledName(name)) ||
         (Language::LanguageIsObjC(lang) &&
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
index a69a4ec3d5294..6142e13d61935 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
@@ -1512,8 +1512,8 @@ lldb_private::Status ClangExpressionParser::DoPrepareForExecution(
           "Couldn't find %s() in the module", m_expr.FunctionName());
       return err;
     } else {
-      LLDB_LOGF(log, "Found function %s for %s", function_name.AsCString(),
-                m_expr.FunctionName());
+      LLDB_LOGF(log, "Found function %s for %s",
+                function_name.AsCString(nullptr), m_expr.FunctionName());
     }
   }
 
@@ -1564,9 +1564,9 @@ lldb_private::Status ClangExpressionParser::DoPrepareForExecution(
 
   if (decl_map) {
     StreamString error_stream;
-    IRForTarget ir_for_target(decl_map, m_expr.NeedsVariableResolution(),
-                              *execution_unit_sp, error_stream,
-                              execution_policy, function_name.AsCString());
+    IRForTarget ir_for_target(
+        decl_map, m_expr.NeedsVariableResolution(), *execution_unit_sp,
+        error_stream, execution_policy, function_name.AsCString(nullptr));
 
     if (!ir_for_target.runOnModule(*execution_unit_sp->GetModule())) {
       err = Status(error_stream.GetString().str());
@@ -1588,7 +1588,7 @@ lldb_private::Status ClangExpressionParser::DoPrepareForExecution(
       if (!can_interpret && execution_policy == eExecutionPolicyNever) {
         err = Status::FromErrorStringWithFormat(
             "Can't evaluate the expression without a running target due to: %s",
-            interpret_error.AsCString());
+            interpret_error.AsCString(nullptr));
         return err;
       }
     }
@@ -1628,7 +1628,7 @@ lldb_private::Status ClangExpressionParser::DoPrepareForExecution(
         if (auto *checker_funcs = llvm::dyn_cast<ClangDynamicCheckerFunctions>(
                 process->GetDynamicCheckers())) {
           IRDynamicChecks ir_dynamic_checks(*checker_funcs,
-                                            function_name.AsCString());
+                                            function_name.AsCString(nullptr));
 
           llvm::Module *module = execution_unit_sp->GetModule();
           if (!module || !ir_dynamic_checks.runOnModule(*module)) {
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionSourceCode.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionSourceCode.cpp
index 6389443b24a71..f4019bd90591c 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionSourceCode.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionSourceCode.cpp
@@ -160,13 +160,14 @@ static void AddMacros(const DebugMacros *dm, CompileUnit *comp_unit,
     switch (entry.GetType()) {
     case DebugMacroEntry::DEFINE:
       if (state.IsValidEntry(entry.GetLineNumber()))
-        stream.Printf("#define %s\n", entry.GetMacroString().AsCString());
+        stream.Printf("#define %s\n",
+                      entry.GetMacroString().AsCString(nullptr));
       else
         return;
       break;
     case DebugMacroEntry::UNDEF:
       if (state.IsValidEntry(entry.GetLineNumber()))
-        stream.Printf("#undef %s\n", entry.GetMacroString().AsCString());
+        stream.Printf("#undef %s\n", entry.GetMacroString().AsCString(nullptr));
       else
         return;
       break;
@@ -359,7 +360,8 @@ void ClangExpressionSourceCode::AddLocalVariableDecls(StreamString &stream,
     if ((var_name == "self" || var_name == "_cmd") && is_objc)
       continue;
 
-    stream.Printf("using $__lldb_local_vars::%s;\n", var_name.AsCString());
+    stream.Printf("using $__lldb_local_vars::%s;\n",
+                  var_name.AsCString(nullptr));
   }
 }
 
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
index 2c520f75f84b8..3cf2b1d5d0fa7 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
@@ -339,7 +339,7 @@ ClangModulesDeclVendorImpl::AddModule(const SourceModule &module,
 
   if (!HS.lookupModule(module.path.front().GetStringRef()))
     return llvm::createStringError("header search couldn't locate module '%s'",
-                                   module.path.front().AsCString());
+                                   module.path.front().AsCString(nullptr));
 
   llvm::SmallVector<clang::IdentifierLoc, 4> clang_path;
 
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
index f830aad45ec98..fdd5e484258b8 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
@@ -528,7 +528,8 @@ bool ClangUserExpression::PrepareForParsing(
   ScanContext(exe_ctx, err);
 
   if (!err.Success()) {
-    diagnostic_manager.PutString(lldb::eSeverityWarning, err.AsCString());
+    diagnostic_manager.PutString(lldb::eSeverityWarning,
+                                 err.AsCString(nullptr));
   }
 
   ////////////////////////////////////
@@ -606,7 +607,7 @@ bool ClangUserExpression::TryParse(
         m_can_interpret, execution_policy);
 
     if (!jit_error.Success()) {
-      const char *error_cstr = jit_error.AsCString();
+      const char *error_cstr = jit_error.AsCString(nullptr);
       if (error_cstr && error_cstr[0])
         diagnostic_manager.PutString(lldb::eSeverityError, error_cstr);
       else
@@ -914,7 +915,7 @@ bool ClangUserExpression::AddArguments(ExecutionContext &exe_ctx,
     if (!object_ptr_error.Success()) {
       exe_ctx.GetTargetRef().GetDebugger().GetAsyncOutputStream()->Format(
           "warning: `{0}' is not accessible (substituting 0). {1}\n",
-          object_name, object_ptr_error.AsCString());
+          object_name, object_ptr_error.AsCString(nullptr));
       object_ptr = 0;
     }
 
@@ -927,7 +928,7 @@ bool ClangUserExpression::AddArguments(ExecutionContext &exe_ctx,
         diagnostic_manager.Printf(
             lldb::eSeverityWarning,
             "couldn't get cmd pointer (substituting NULL): %s",
-            object_ptr_error.AsCString());
+            object_ptr_error.AsCString(nullptr));
         cmd_ptr = 0;
       }
     }
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.cpp
index 112ce9be7bd1a..694885ee1c3b9 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.cpp
@@ -163,7 +163,7 @@ bool ClangUtilityFunction::Install(DiagnosticManager &diagnostic_manager,
   if (jit_error.Success()) {
     return true;
   } else {
-    const char *error_cstr = jit_error.AsCString();
+    const char *error_cstr = jit_error.AsCString(nullptr);
     if (error_cstr && error_cstr[0]) {
       diagnostic_manager.Printf(lldb::eSeverityError, "%s", error_cstr);
     } else {
diff --git a/lldb/source/Plugins/InstrumentationRuntime/TSan/InstrumentationRuntimeTSan.cpp b/lldb/source/Plugins/InstrumentationRuntime/TSan/InstrumentationRuntimeTSan.cpp
index 74bd3ca25bc6f..26e77c470a5ff 100644
--- a/lldb/source/Plugins/InstrumentationRuntime/TSan/InstrumentationRuntimeTSan.cpp
+++ b/lldb/source/Plugins/InstrumentationRuntime/TSan/InstrumentationRuntimeTSan.cpp
@@ -336,7 +336,7 @@ StructuredData::ObjectSP InstrumentationRuntimeTSan::RetrieveReportData(
     StreamString ss;
     ss << "cannot evaluate ThreadSanitizer expression:\n";
     if (main_value)
-      ss << main_value->GetError().AsCString();
+      ss << main_value->GetError().AsCString(nullptr);
     Debugger::ReportWarning(ss.GetString().str(),
                             process_sp->GetTarget().GetDebugger().GetID());
     return StructuredData::ObjectSP();
diff --git a/lldb/source/Plugins/InstrumentationRuntime/UBSan/InstrumentationRuntimeUBSan.cpp b/lldb/source/Plugins/InstrumentationRuntime/UBSan/InstrumentationRuntimeUBSan.cpp
index 1db85e6815636..e41ab4c5188a0 100644
--- a/lldb/source/Plugins/InstrumentationRuntime/UBSan/InstrumentationRuntimeUBSan.cpp
+++ b/lldb/source/Plugins/InstrumentationRuntime/UBSan/InstrumentationRuntimeUBSan.cpp
@@ -136,7 +136,7 @@ StructuredData::ObjectSP InstrumentationRuntimeUBSan::RetrieveReportData(
     StreamString ss;
     ss << "cannot evaluate UndefinedBehaviorSanitizer expression:\n";
     if (main_value)
-      ss << main_value->GetError().AsCString();
+      ss << main_value->GetError().AsCString(nullptr);
     Debugger::ReportWarning(ss.GetString().str(),
                             process_sp->GetTarget().GetDebugger().GetID());
     return StructuredData::ObjectSP();
diff --git a/lldb/source/Plugins/InstrumentationRuntime/Utility/ReportRetriever.cpp b/lldb/source/Plugins/InstrumentationRuntime/Utility/ReportRetriever.cpp
index 85852ba40c61c..9d4d97164d694 100644
--- a/lldb/source/Plugins/InstrumentationRuntime/Utility/ReportRetriever.cpp
+++ b/lldb/source/Plugins/InstrumentationRuntime/Utility/ReportRetriever.cpp
@@ -99,7 +99,7 @@ ReportRetriever::RetrieveReportData(const ProcessSP process_sp) {
     StreamString ss;
     ss << "cannot evaluate AddressSanitizer expression:\n";
     if (return_value_sp)
-      ss << return_value_sp->GetError().AsCString();
+      ss << return_value_sp->GetError().AsCString(nullptr);
     Debugger::ReportWarning(ss.GetString().str(),
                             process_sp->GetTarget().GetDebugger().GetID());
     return StructuredData::ObjectSP();
diff --git a/lldb/source/Plugins/Language/CPlusPlus/BlockPointer.cpp b/lldb/source/Plugins/Language/CPlusPlus/BlockPointer.cpp
index 9ab1bf03250b1..0616293b23500 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/BlockPointer.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/BlockPointer.cpp
@@ -147,10 +147,10 @@ class BlockPointerSyntheticFrontEnd : public SyntheticChildrenFrontEnd {
   llvm::Expected<size_t> GetIndexOfChildWithName(ConstString name) override {
     if (!m_block_struct_type.IsValid())
       return llvm::createStringError("Type has no child named '%s'",
-                                     name.AsCString());
+                                     name.AsCString(nullptr));
 
     const bool omit_empty_base_classes = false;
-    return m_block_struct_type.GetIndexOfChildWithName(name.AsCString(),
+    return m_block_struct_type.GetIndexOfChildWithName(name.AsCString(nullptr),
                                                        omit_empty_base_classes);
   }
 
diff --git a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
index 7a0f556b3aed4..fd55e96ae2912 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
@@ -2270,7 +2270,7 @@ static bool PrintFunctionNameWithArgs(Stream &s,
 
   const char *cstr = sc.GetPossiblyInlinedFunctionName()
                          .GetName(Mangled::NamePreference::ePreferDemangled)
-                         .AsCString();
+                         .AsCString(nullptr);
   if (!cstr)
     return false;
 
diff --git a/lldb/source/Plugins/Language/CPlusPlus/Coroutines.cpp b/lldb/source/Plugins/Language/CPlusPlus/Coroutines.cpp
index e8c2db1886333..21d9fcc40d392 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/Coroutines.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/Coroutines.cpp
@@ -202,7 +202,7 @@ StdlibCoroutineHandleSyntheticFrontEnd::GetIndexOfChildWithName(
   }
 
   return llvm::createStringError("Type has no child named '%s'",
-                                 name.AsCString());
+                                 name.AsCString(nullptr));
 }
 
 SyntheticChildrenFrontEnd *
diff --git a/lldb/source/Plugins/Language/CPlusPlus/GenericInitializerList.cpp b/lldb/source/Plugins/Language/CPlusPlus/GenericInitializerList.cpp
index 7f012b7fc8aa6..f97b8bd40e333 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/GenericInitializerList.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/GenericInitializerList.cpp
@@ -115,12 +115,12 @@ class GenericInitializerListSyntheticFrontEnd
   llvm::Expected<size_t> GetIndexOfChildWithName(ConstString name) override {
     if (!m_start) {
       return llvm::createStringError("Type has no child named '%s'",
-                                     name.AsCString());
+                                     name.AsCString(nullptr));
     }
     auto optional_idx = formatters::ExtractIndexFromString(name.GetCString());
     if (!optional_idx) {
       return llvm::createStringError("Type has no child named '%s'",
-                                     name.AsCString());
+                                     name.AsCString(nullptr));
     }
     return *optional_idx;
   }
diff --git a/lldb/source/Plugins/Language/CPlusPlus/GenericOptional.cpp b/lldb/source/Plugins/Language/CPlusPlus/GenericOptional.cpp
index e4c261a5411f7..6895238164e96 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/GenericOptional.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/GenericOptional.cpp
@@ -42,7 +42,7 @@ class GenericOptionalFrontend : public SyntheticChildrenFrontEnd {
     if (name == "$$dereference$$")
       return 0;
     return llvm::createStringError("Type has no child named '%s'",
-                                   name.AsCString());
+                                   name.AsCString(nullptr));
   }
 
   llvm::Expected<uint32_t> CalculateNumChildren() override {
diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp b/lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp
index 57717fac1d00f..cce4d57074958 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp
@@ -417,7 +417,7 @@ lldb_private::formatters::LibcxxSharedPtrSyntheticFrontEnd::
     return 1;
 
   return llvm::createStringError("Type has no child named '%s'",
-                                 name.AsCString());
+                                 name.AsCString(nullptr));
 }
 
 lldb_private::formatters::LibcxxSharedPtrSyntheticFrontEnd::
@@ -520,7 +520,7 @@ lldb_private::formatters::LibcxxUniquePtrSyntheticFrontEnd::
   if (name == "obj" || name == "object" || name == "$$dereference$$")
     return 2;
   return llvm::createStringError("Type has no child named '%s'",
-                                 name.AsCString());
+                                 name.AsCString(nullptr));
 }
 
 /// The field layout in a libc++ string (cap, side, data or data, size, cap).
diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxxAtomic.cpp b/lldb/source/Plugins/Language/CPlusPlus/LibCxxAtomic.cpp
index e20dd31ef70ad..24d538d5c571b 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/LibCxxAtomic.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxxAtomic.cpp
@@ -136,7 +136,7 @@ lldb_private::formatters::LibcxxStdAtomicSyntheticFrontEnd::
   if (name == "Value")
     return 0;
   return llvm::createStringError("Type has no child named '%s'",
-                                 name.AsCString());
+                                 name.AsCString(nullptr));
 }
 
 SyntheticChildrenFrontEnd *
diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp b/lldb/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp
index c40223f5845a5..aec08911db80d 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp
@@ -483,7 +483,7 @@ lldb_private::formatters::LibCxxMapIteratorSyntheticFrontEnd::
     GetIndexOfChildWithName(ConstString name) {
   if (!m_pair_sp)
     return llvm::createStringError("Type has no child named '%s'",
-                                   name.AsCString());
+                                   name.AsCString(nullptr));
 
   return m_pair_sp->GetIndexOfChildWithName(name);
 }
diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxxProxyArray.cpp b/lldb/source/Plugins/Language/CPlusPlus/LibCxxProxyArray.cpp
index a3d34c6e76d1e..0d4d06443bc76 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/LibCxxProxyArray.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxxProxyArray.cpp
@@ -178,11 +178,11 @@ lldb_private::formatters::LibcxxStdProxyArraySyntheticFrontEnd::
     GetIndexOfChildWithName(ConstString name) {
   if (!m_base)
     return llvm::createStringError("Type has no child named '%s'",
-                                   name.AsCString());
+                                   name.AsCString(nullptr));
   auto optional_idx = formatters::ExtractIndexFromString(name.GetCString());
   if (!optional_idx) {
     return llvm::createStringError("Type has no child named '%s'",
-                                   name.AsCString());
+                                   name.AsCString(nullptr));
   }
   return *optional_idx;
 }
diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxxQueue.cpp b/lldb/source/Plugins/Language/CPlusPlus/LibCxxQueue.cpp
index 9d55feedd400f..42ac6a81f46d3 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/LibCxxQueue.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxxQueue.cpp
@@ -24,7 +24,7 @@ class QueueFrontEnd : public SyntheticChildrenFrontEnd {
     if (m_container_sp)
       return m_container_sp->GetIndexOfChildWithName(name);
     return llvm::createStringError("Type has no child named '%s'",
-                                   name.AsCString());
+                                   name.AsCString(nullptr));
   }
 
   lldb::ChildCacheState Update() override;
diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxxSliceArray.cpp b/lldb/source/Plugins/Language/CPlusPlus/LibCxxSliceArray.cpp
index 3bdb099d21012..535bb81e954d8 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/LibCxxSliceArray.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxxSliceArray.cpp
@@ -149,11 +149,11 @@ lldb_private::formatters::LibcxxStdSliceArraySyntheticFrontEnd::
     GetIndexOfChildWithName(ConstString name) {
   if (!m_start)
     return llvm::createStringError("Type has no child named '%s'",
-                                   name.AsCString());
+                                   name.AsCString(nullptr));
   auto optional_idx = formatters::ExtractIndexFromString(name.GetCString());
   if (!optional_idx) {
     return llvm::createStringError("Type has no child named '%s'",
-                                   name.AsCString());
+                                   name.AsCString(nullptr));
   }
   return *optional_idx;
 }
diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxxSpan.cpp b/lldb/source/Plugins/Language/CPlusPlus/LibCxxSpan.cpp
index 496bbd07304d6..ee9dd8affbfb0 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/LibCxxSpan.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxxSpan.cpp
@@ -132,11 +132,11 @@ llvm::Expected<size_t> lldb_private::formatters::
     LibcxxStdSpanSyntheticFrontEnd::GetIndexOfChildWithName(ConstString name) {
   if (!m_start)
     return llvm::createStringError("Type has no child named '%s'",
-                                   name.AsCString());
+                                   name.AsCString(nullptr));
   auto optional_idx = formatters::ExtractIndexFromString(name.GetCString());
   if (!optional_idx) {
     return llvm::createStringError("Type has no child named '%s'",
-                                   name.AsCString());
+                                   name.AsCString(nullptr));
   }
   return *optional_idx;
 }
diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxxUnorderedMap.cpp b/lldb/source/Plugins/Language/CPlusPlus/LibCxxUnorderedMap.cpp
index 34eed108d8501..85f00e6904a33 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/LibCxxUnorderedMap.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxxUnorderedMap.cpp
@@ -393,7 +393,7 @@ lldb_private::formatters::LibCxxUnorderedMapIteratorSyntheticFrontEnd::
   if (name == "second")
     return 1;
   return llvm::createStringError("Type has no child named '%s'",
-                                 name.AsCString());
+                                 name.AsCString(nullptr));
 }
 
 SyntheticChildrenFrontEnd *
diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxxValarray.cpp b/lldb/source/Plugins/Language/CPlusPlus/LibCxxValarray.cpp
index 3a8bf3a45ce54..e0402b138a53b 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/LibCxxValarray.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxxValarray.cpp
@@ -128,11 +128,11 @@ lldb_private::formatters::LibcxxStdValarraySyntheticFrontEnd::
     GetIndexOfChildWithName(ConstString name) {
   if (!m_start || !m_finish)
     return llvm::createStringError("Type has no child named '%s'",
-                                   name.AsCString());
+                                   name.AsCString(nullptr));
   auto optional_idx = formatters::ExtractIndexFromString(name.GetCString());
   if (!optional_idx) {
     return llvm::createStringError("Type has no child named '%s'",
-                                   name.AsCString());
+                                   name.AsCString(nullptr));
   }
   return *optional_idx;
 }
diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxxVector.cpp b/lldb/source/Plugins/Language/CPlusPlus/LibCxxVector.cpp
index ce2b24fd438d6..89931e191d480 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/LibCxxVector.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxxVector.cpp
@@ -167,11 +167,11 @@ lldb_private::formatters::LibcxxStdVectorSyntheticFrontEnd::
     GetIndexOfChildWithName(ConstString name) {
   if (!m_start || !m_finish)
     return llvm::createStringError("Type has no child named '%s'",
-                                   name.AsCString());
+                                   name.AsCString(nullptr));
   auto optional_idx = formatters::ExtractIndexFromString(name.GetCString());
   if (!optional_idx) {
     return llvm::createStringError("Type has no child named '%s'",
-                                   name.AsCString());
+                                   name.AsCString(nullptr));
   }
   return *optional_idx;
 }
@@ -270,16 +270,16 @@ lldb_private::formatters::LibcxxVectorBoolSyntheticFrontEnd::
     GetIndexOfChildWithName(ConstString name) {
   if (!m_count || !m_base_data_address)
     return llvm::createStringError("Type has no child named '%s'",
-                                   name.AsCString());
-  auto optional_idx = ExtractIndexFromString(name.AsCString());
+                                   name.AsCString(nullptr));
+  auto optional_idx = ExtractIndexFromString(name.AsCString(nullptr));
   if (!optional_idx) {
     return llvm::createStringError("Type has no child named '%s'",
-                                   name.AsCString());
+                                   name.AsCString(nullptr));
   }
   uint32_t idx = *optional_idx;
   if (idx >= CalculateNumChildrenIgnoringErrors())
     return llvm::createStringError("Type has no child named '%s'",
-                                   name.AsCString());
+                                   name.AsCString(nullptr));
   return idx;
 }
 
diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibStdcpp.cpp b/lldb/source/Plugins/Language/CPlusPlus/LibStdcpp.cpp
index c06f50c1ca65d..638c32f3826d2 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/LibStdcpp.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/LibStdcpp.cpp
@@ -157,7 +157,7 @@ LibstdcppMapIteratorSyntheticFrontEnd::GetIndexOfChildWithName(
   if (name == "second")
     return 1;
   return llvm::createStringError("Type has no child named '%s'",
-                                 name.AsCString());
+                                 name.AsCString(nullptr));
 }
 
 SyntheticChildrenFrontEnd *
@@ -234,7 +234,7 @@ VectorIteratorSyntheticFrontEnd::GetIndexOfChildWithName(ConstString name) {
   if (name == "item")
     return 0;
   return llvm::createStringError("Type has no child named '%s'",
-                                 name.AsCString());
+                                 name.AsCString(nullptr));
 }
 
 bool lldb_private::formatters::LibStdcppStringSummaryProvider(
@@ -394,7 +394,7 @@ LibStdcppSharedPtrSyntheticFrontEnd::GetIndexOfChildWithName(ConstString name) {
     return 1;
 
   return llvm::createStringError("Type has no child named '%s'",
-                                 name.AsCString());
+                                 name.AsCString(nullptr));
 }
 
 SyntheticChildrenFrontEnd *
diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp b/lldb/source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp
index 36401a0480c02..4f59171e74a22 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp
@@ -146,7 +146,7 @@ LibStdcppUniquePtrSyntheticFrontEnd::GetIndexOfChildWithName(ConstString name) {
   if (name == "obj" || name == "object" || name == "$$dereference$$")
     return 2;
   return llvm::createStringError("Type has no child named '%s'",
-                                 name.AsCString());
+                                 name.AsCString(nullptr));
 }
 
 bool LibStdcppUniquePtrSyntheticFrontEnd::GetSummary(
diff --git a/lldb/source/Plugins/Language/CPlusPlus/MsvcStlAtomic.cpp b/lldb/source/Plugins/Language/CPlusPlus/MsvcStlAtomic.cpp
index 7973e4f01bf3e..27438440a90af 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/MsvcStlAtomic.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/MsvcStlAtomic.cpp
@@ -86,7 +86,7 @@ llvm::Expected<size_t> lldb_private::formatters::
   if (name == "Value")
     return 0;
   return llvm::createStringError("Type has no child named '%s'",
-                                 name.AsCString());
+                                 name.AsCString(nullptr));
 }
 
 lldb_private::SyntheticChildrenFrontEnd *
diff --git a/lldb/source/Plugins/Language/CPlusPlus/MsvcStlDeque.cpp b/lldb/source/Plugins/Language/CPlusPlus/MsvcStlDeque.cpp
index de103e9e4a460..e9b244f3ff544 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/MsvcStlDeque.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/MsvcStlDeque.cpp
@@ -159,12 +159,12 @@ llvm::Expected<size_t> lldb_private::formatters::MsvcStlDequeSyntheticFrontEnd::
     GetIndexOfChildWithName(ConstString name) {
   if (!m_map)
     return llvm::createStringError("Type has no child named '%s'",
-                                   name.AsCString());
+                                   name.AsCString(nullptr));
   if (auto optional_idx = ExtractIndexFromString(name.GetCString()))
     return *optional_idx;
 
   return llvm::createStringError("Type has no child named '%s'",
-                                 name.AsCString());
+                                 name.AsCString(nullptr));
 }
 
 bool lldb_private::formatters::IsMsvcStlDeque(ValueObject &valobj) {
diff --git a/lldb/source/Plugins/Language/CPlusPlus/MsvcStlSmartPointer.cpp b/lldb/source/Plugins/Language/CPlusPlus/MsvcStlSmartPointer.cpp
index d72300171400a..4a1781be8c2b3 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/MsvcStlSmartPointer.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/MsvcStlSmartPointer.cpp
@@ -170,7 +170,7 @@ lldb_private::formatters::MsvcStlSmartPointerSyntheticFrontEnd::
     return 1;
 
   return llvm::createStringError("Type has no child named '%s'",
-                                 name.AsCString());
+                                 name.AsCString(nullptr));
 }
 
 lldb_private::formatters::MsvcStlSmartPointerSyntheticFrontEnd::
@@ -271,7 +271,7 @@ lldb_private::formatters::MsvcStlUniquePtrSyntheticFrontEnd::
   if (name == "obj" || name == "object" || name == "$$dereference$$")
     return 2;
   return llvm::createStringError("Type has no child named '%s'",
-                                 name.AsCString());
+                                 name.AsCString(nullptr));
 }
 
 lldb_private::SyntheticChildrenFrontEnd *
diff --git a/lldb/source/Plugins/Language/CPlusPlus/MsvcStlSpan.cpp b/lldb/source/Plugins/Language/CPlusPlus/MsvcStlSpan.cpp
index 6d99aeb42a407..bb1cc69de48ac 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/MsvcStlSpan.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/MsvcStlSpan.cpp
@@ -108,12 +108,12 @@ lldb_private::formatters::MsvcStlSpanSyntheticFrontEnd::GetIndexOfChildWithName(
     ConstString name) {
   if (!m_start)
     return llvm::createStringError("Type has no child named '%s'",
-                                   name.AsCString());
+                                   name.AsCString(nullptr));
 
   auto optional_idx = formatters::ExtractIndexFromString(name.GetCString());
   if (!optional_idx)
     return llvm::createStringError("Type has no child named '%s'",
-                                   name.AsCString());
+                                   name.AsCString(nullptr));
   return *optional_idx;
 }
 
diff --git a/lldb/source/Plugins/Language/CPlusPlus/MsvcStlVector.cpp b/lldb/source/Plugins/Language/CPlusPlus/MsvcStlVector.cpp
index 99e73ca46fa20..1a30e006de325 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/MsvcStlVector.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/MsvcStlVector.cpp
@@ -139,11 +139,11 @@ llvm::Expected<size_t> lldb_private::formatters::
     MsvcStlVectorSyntheticFrontEnd::GetIndexOfChildWithName(ConstString name) {
   if (!m_start || !m_finish)
     return llvm::createStringError("Type has no child named '%s'",
-                                   name.AsCString());
+                                   name.AsCString(nullptr));
   auto optional_idx = ExtractIndexFromString(name.GetCString());
   if (!optional_idx) {
     return llvm::createStringError("Type has no child named '%s'",
-                                   name.AsCString());
+                                   name.AsCString(nullptr));
   }
   return *optional_idx;
 }
@@ -268,16 +268,16 @@ lldb_private::formatters::MsvcStlVectorBoolSyntheticFrontEnd::
     GetIndexOfChildWithName(ConstString name) {
   if (!m_count || !m_base_data_address)
     return llvm::createStringError("Type has no child named '%s'",
-                                   name.AsCString());
-  auto optional_idx = ExtractIndexFromString(name.AsCString());
+                                   name.AsCString(nullptr));
+  auto optional_idx = ExtractIndexFromString(name.AsCString(nullptr));
   if (!optional_idx) {
     return llvm::createStringError("Type has no child named '%s'",
-                                   name.AsCString());
+                                   name.AsCString(nullptr));
   }
   uint32_t idx = *optional_idx;
   if (idx >= CalculateNumChildrenIgnoringErrors())
     return llvm::createStringError("Type has no child named '%s'",
-                                   name.AsCString());
+                                   name.AsCString(nullptr));
   return idx;
 }
 
diff --git a/lldb/source/Plugins/Language/ObjC/Cocoa.cpp b/lldb/source/Plugins/Language/ObjC/Cocoa.cpp
index 72e4d0fe2aa21..455f28b5c9b42 100644
--- a/lldb/source/Plugins/Language/ObjC/Cocoa.cpp
+++ b/lldb/source/Plugins/Language/ObjC/Cocoa.cpp
@@ -1051,7 +1051,7 @@ class ObjCClassSyntheticChildrenFrontEnd : public SyntheticChildrenFrontEnd {
 
   llvm::Expected<size_t> GetIndexOfChildWithName(ConstString name) override {
     return llvm::createStringError("Type has no child named '%s'",
-                                   name.AsCString());
+                                   name.AsCString(nullptr));
   }
 };
 
diff --git a/lldb/source/Plugins/Language/ObjC/NSDictionary.cpp b/lldb/source/Plugins/Language/ObjC/NSDictionary.cpp
index 2d72e913192ab..22d528d04f403 100644
--- a/lldb/source/Plugins/Language/ObjC/NSDictionary.cpp
+++ b/lldb/source/Plugins/Language/ObjC/NSDictionary.cpp
@@ -930,7 +930,7 @@ llvm::Expected<size_t> lldb_private::formatters::
   if (name == g_zero)
     return 0;
   return llvm::createStringError("Type has no child named '%s'",
-                                 name.AsCString());
+                                 name.AsCString(nullptr));
 }
 
 llvm::Expected<uint32_t> lldb_private::formatters::
diff --git a/lldb/source/Plugins/Language/ObjC/NSError.cpp b/lldb/source/Plugins/Language/ObjC/NSError.cpp
index 0152c3125f1e1..c3d0e1ea058b2 100644
--- a/lldb/source/Plugins/Language/ObjC/NSError.cpp
+++ b/lldb/source/Plugins/Language/ObjC/NSError.cpp
@@ -170,7 +170,7 @@ class NSErrorSyntheticFrontEnd : public SyntheticChildrenFrontEnd {
     if (name == g_userInfo)
       return 0;
     return llvm::createStringError("Type has no child named '%s'",
-                                   name.AsCString());
+                                   name.AsCString(nullptr));
   }
 
 private:
diff --git a/lldb/source/Plugins/Language/ObjC/NSException.cpp b/lldb/source/Plugins/Language/ObjC/NSException.cpp
index e27c7e0e97bef..4e8f9196322e1 100644
--- a/lldb/source/Plugins/Language/ObjC/NSException.cpp
+++ b/lldb/source/Plugins/Language/ObjC/NSException.cpp
@@ -163,7 +163,7 @@ class NSExceptionSyntheticFrontEnd : public SyntheticChildrenFrontEnd {
     if (name == g_userInfo) return 2;
     if (name == g_reserved) return 3;
     return llvm::createStringError("Type has no child named '%s'",
-                                   name.AsCString());
+                                   name.AsCString(nullptr));
   }
 
 private:
diff --git a/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABIRuntime.cpp b/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABIRuntime.cpp
index 9a76d94b4e7c2..66f6341f99c69 100644
--- a/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABIRuntime.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABIRuntime.cpp
@@ -91,8 +91,8 @@ ItaniumABIRuntime::GetTypeInfo(ValueObject &in_value,
                       ": static-type = '%s' has dynamic type: uid={0x%" PRIx64
                       "}, type-name='%s'\n",
                       in_value.GetPointerValue().address,
-                      in_value.GetTypeName().AsCString(), type_sp->GetID(),
-                      type_sp->GetName().GetCString());
+                      in_value.GetTypeName().AsCString(nullptr),
+                      type_sp->GetID(), type_sp->GetName().GetCString());
             type_info.SetTypeSP(type_sp);
           }
         }
@@ -107,8 +107,8 @@ ItaniumABIRuntime::GetTypeInfo(ValueObject &in_value,
                         ": static-type = '%s' has multiple matching dynamic "
                         "types: uid={0x%" PRIx64 "}, type-name='%s'\n",
                         in_value.GetPointerValue().address,
-                        in_value.GetTypeName().AsCString(), type_sp->GetID(),
-                        type_sp->GetName().GetCString());
+                        in_value.GetTypeName().AsCString(nullptr),
+                        type_sp->GetID(), type_sp->GetName().GetCString());
             }
           }
         }
@@ -123,8 +123,8 @@ ItaniumABIRuntime::GetTypeInfo(ValueObject &in_value,
                         "matching dynamic types, picking "
                         "this one: uid={0x%" PRIx64 "}, type-name='%s'\n",
                         in_value.GetPointerValue().address,
-                        in_value.GetTypeName().AsCString(), type_sp->GetID(),
-                        type_sp->GetName().GetCString());
+                        in_value.GetTypeName().AsCString(nullptr),
+                        type_sp->GetID(), type_sp->GetName().GetCString());
               type_info.SetTypeSP(type_sp);
             }
           }
@@ -135,7 +135,7 @@ ItaniumABIRuntime::GetTypeInfo(ValueObject &in_value,
                   ": static-type = '%s' has multiple matching dynamic "
                   "types, didn't find a C++ match\n",
                   in_value.GetPointerValue().address,
-                  in_value.GetTypeName().AsCString());
+                  in_value.GetTypeName().AsCString(nullptr));
       }
       if (type_info)
         SetDynamicTypeInfo(vtable_info.addr, type_info);
diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp
index 5302a17d8bf50..0fe0db6b2db6c 100644
--- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp
@@ -500,7 +500,7 @@ bool AppleObjCDeclVendor::FinishDecl(clang::ObjCInterfaceDecl *interface_decl) {
   LLDB_LOGF(log,
             "[AppleObjCDeclVendor::FinishDecl] Finishing Objective-C "
             "interface for %s",
-            descriptor->GetClassName().AsCString());
+            descriptor->GetClassName().AsCString(nullptr));
 
   if (!descriptor->Describe(superclass_func, instance_method_func,
                             class_method_func, ivar_func))
@@ -522,7 +522,7 @@ uint32_t AppleObjCDeclVendor::FindDecls(ConstString name, bool append,
       GetLog(LLDBLog::Expressions)); // FIXME - a more appropriate log channel?
 
   LLDB_LOGF(log, "AppleObjCDeclVendor::FindDecls ('%s', %s, %u, )",
-            (const char *)name.AsCString(), append ? "true" : "false",
+            (const char *)name.AsCString(nullptr), append ? "true" : "false",
             max_matches);
 
   if (!append)
@@ -567,7 +567,7 @@ uint32_t AppleObjCDeclVendor::FindDecls(ConstString name, bool append,
   }
 
   LLDB_LOGF(log, "AOCTV::FT Couldn't find %s in the ASTContext",
-            name.AsCString());
+            name.AsCString(nullptr));
 
   // It's not.  If it exists, we have to put it into our ASTContext.
 
diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
index ad60290382c02..bde0c0c35517c 100644
--- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
@@ -181,7 +181,7 @@ AppleObjCRuntime::GetObjectDescription(Stream &strm, Value &value,
           llvm::Twine(
               "could not get function runner to call print for debugger "
               "function: ") +
-          error.AsCString());
+          error.AsCString(nullptr));
     }
     m_print_object_caller_up->InsertFunction(exe_ctx, wrapper_struct_addr,
                                              diagnostics);
diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp
index 2eac7bd8a4a58..ad5d17361e2af 100644
--- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp
@@ -100,7 +100,7 @@ AppleObjCRuntimeV1::CreateExceptionResolver(const BreakpointSP &bkpt,
 
   if (throw_bp)
     resolver_sp = std::make_shared<BreakpointResolverName>(
-        bkpt, std::get<1>(GetExceptionThrowLocation()).AsCString(),
+        bkpt, std::get<1>(GetExceptionThrowLocation()).AsCString(nullptr),
         eFunctionNameTypeBase, eLanguageTypeUnknown, Breakpoint::Exact, 0,
         /*offset_is_insn_count = */ false, eLazyBoolNo);
   // FIXME: don't do catch yet.
diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
index be313866a1015..c9f31b24139d4 100644
--- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
@@ -1189,7 +1189,7 @@ AppleObjCRuntimeV2::CreateExceptionResolver(const BreakpointSP &bkpt,
 
   if (throw_bp)
     resolver_sp = std::make_shared<BreakpointResolverName>(
-        bkpt, std::get<1>(GetExceptionThrowLocation()).AsCString(),
+        bkpt, std::get<1>(GetExceptionThrowLocation()).AsCString(nullptr),
         eFunctionNameTypeBase, eLanguageTypeUnknown, Breakpoint::Exact, 0,
         /*offset_is_insn_count = */ false, eLazyBoolNo);
   // FIXME: We don't do catch breakpoints for ObjC yet.
@@ -1262,7 +1262,7 @@ size_t AppleObjCRuntimeV2::GetByteOffsetForIvar(CompilerType &parent_ast_type,
     // Make the objective C V2 mangled name for the ivar offset from the class
     // name and ivar name
     std::string buffer("OBJC_IVAR_$_");
-    buffer.append(class_name.AsCString());
+    buffer.append(class_name.AsCString(nullptr));
     buffer.push_back('.');
     buffer.append(ivar_name);
     ConstString ivar_const_str(buffer.c_str());
@@ -1849,7 +1849,7 @@ AppleObjCRuntimeV2::DynamicClassInfoExtractor::GetClassInfoUtilityFunctionImpl(
   if (error.Fail()) {
     LLDB_LOG(log,
              "Failed to make function caller for implementation lookup: {0}.",
-             error.AsCString());
+             error.AsCString(nullptr));
     return {};
   }
 
@@ -1962,8 +1962,8 @@ AppleObjCRuntimeV2::SharedCacheClassInfoExtractor::
   std::string shared_class_expression;
   llvm::raw_string_ostream(shared_class_expression)
       << llvm::format(g_shared_cache_class_name_funcptr,
-                      class_name_getter_function_name.AsCString(),
-                      class_name_getter_function_name.AsCString());
+                      class_name_getter_function_name.AsCString(nullptr),
+                      class_name_getter_function_name.AsCString(nullptr));
 
   shared_class_expression += g_get_shared_cache_class_info_definitions;
   shared_class_expression += g_get_shared_cache_class_info_body;
@@ -2025,7 +2025,7 @@ AppleObjCRuntimeV2::SharedCacheClassInfoExtractor::
   if (error.Fail()) {
     LLDB_LOG(log,
              "Failed to make function caller for implementation lookup: {0}.",
-             error.AsCString());
+             error.AsCString(nullptr));
     return {};
   }
 
@@ -2775,7 +2775,7 @@ DeclVendor *AppleObjCRuntimeV2::GetDeclVendor() {
 lldb::addr_t AppleObjCRuntimeV2::LookupRuntimeSymbol(ConstString name) {
   lldb::addr_t ret = LLDB_INVALID_ADDRESS;
 
-  const char *name_cstr = name.AsCString();
+  const char *name_cstr = name.AsCString(nullptr);
 
   if (name_cstr) {
     llvm::StringRef name_strref(name_cstr);
@@ -2796,7 +2796,7 @@ lldb::addr_t AppleObjCRuntimeV2::LookupRuntimeSymbol(ConstString name) {
 
         if (descriptor) {
           const ConstString ivar_name_cs(class_and_ivar.second);
-          const char *ivar_name_cstr = ivar_name_cs.AsCString();
+          const char *ivar_name_cstr = ivar_name_cs.AsCString(nullptr);
 
           auto ivar_func = [&ret,
                             ivar_name_cstr](const char *name, const char *type,
diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp
index 1bde72f2ad05d..1c06eb268753b 100644
--- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp
@@ -625,7 +625,7 @@ AppleObjCTrampolineHandler::AppleObjCTrampolineHandler(
       process_sp->GetTarget().GetDebugger().GetAsyncErrorStream()->Printf(
           "Could not find implementation lookup function \"%s\""
           " step in through ObjC method dispatch will not work.\n",
-          get_impl_name.AsCString());
+          get_impl_name.AsCString(nullptr));
     }
     return;
   }
@@ -743,7 +743,7 @@ AppleObjCTrampolineHandler::SetupDispatchFunction(Thread &thread,
       if (error.Fail()) {
         LLDB_LOGF(log,
                   "Error getting function caller for dispatch lookup: \"%s\".",
-                  error.AsCString());
+                  error.AsCString(nullptr));
         return args_addr;
       }
     } else {
diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.h b/lldb/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.h
index cc8281e9d1a02..4ac49a82b82d5 100644
--- a/lldb/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.h
+++ b/lldb/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.h
@@ -67,7 +67,7 @@ class ObjCLanguageRuntime : public LanguageRuntime {
     // for the known v1/v2 this is all that needs to be done
     virtual bool IsKVO() {
       if (m_is_kvo == eLazyBoolCalculate) {
-        const char *class_name = GetClassName().AsCString();
+        const char *class_name = GetClassName().AsCString(nullptr);
         if (class_name && *class_name)
           m_is_kvo =
               (LazyBool)(strstr(class_name, "NSKVONotifying_") == class_name);
@@ -79,7 +79,7 @@ class ObjCLanguageRuntime : public LanguageRuntime {
     // for the known v1/v2 this is all that needs to be done
     virtual bool IsCFType() {
       if (m_is_cf == eLazyBoolCalculate) {
-        const char *class_name = GetClassName().AsCString();
+        const char *class_name = GetClassName().AsCString(nullptr);
         if (class_name && *class_name)
           m_is_cf = (LazyBool)(strcmp(class_name, "__NSCFType") == 0 ||
                                strcmp(class_name, "NSCFType") == 0);
diff --git a/lldb/source/Plugins/MemoryHistory/asan/MemoryHistoryASan.cpp b/lldb/source/Plugins/MemoryHistory/asan/MemoryHistoryASan.cpp
index 206a47165f762..b9a7a35bc1345 100644
--- a/lldb/source/Plugins/MemoryHistory/asan/MemoryHistoryASan.cpp
+++ b/lldb/source/Plugins/MemoryHistory/asan/MemoryHistoryASan.cpp
@@ -183,7 +183,7 @@ HistoryThreads MemoryHistoryASan::GetHistoryThreads(lldb::addr_t address) {
     StreamString ss;
     ss << "cannot evaluate AddressSanitizer expression:\n";
     if (return_value_sp)
-      ss << return_value_sp->GetError().AsCString();
+      ss << return_value_sp->GetError().AsCString(nullptr);
     Debugger::ReportWarning(ss.GetString().str(),
                             process_sp->GetTarget().GetDebugger().GetID());
     return result;
diff --git a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
index 7cc782cf2823e..2ed576fcfa68d 100644
--- a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
+++ b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
@@ -682,9 +682,10 @@ ModuleSpecList ObjectFileELF::GetModuleSpecifications(
           uint32_t core_notes_crc = 0;
 
           if (!gnu_debuglink_crc) {
-            LLDB_SCOPED_TIMERF(
-                "Calculating module crc32 %s with size %" PRIu64 " KiB",
-                file.GetFilename().AsCString(), (length - file_offset) / 1024);
+            LLDB_SCOPED_TIMERF("Calculating module crc32 %s with size %" PRIu64
+                               " KiB",
+                               file.GetFilename().AsCString(nullptr),
+                               (length - file_offset) / 1024);
 
             // For core files - which usually don't happen to have a
             // gnu_debuglink, and are pretty bulky - calculating whole
@@ -1834,7 +1835,7 @@ size_t ObjectFileELF::GetSectionHeaderInfo(SectionHeaderColl &section_headers,
             Status error = RefineModuleDetailsFromNote(data, arch_spec, uuid);
             if (error.Fail()) {
               LLDB_LOGF(log, "ObjectFileELF::%s ELF note processing failed: %s",
-                        __FUNCTION__, error.AsCString());
+                        __FUNCTION__, error.AsCString(nullptr));
             }
           }
         }
@@ -2216,7 +2217,8 @@ std::shared_ptr<ObjectFileELF> ObjectFileELF::GetGnuDebugDataObjectFile() {
   if (err) {
     GetModule()->ReportWarning(
         "An error occurred while decompression the section {0}: {1}",
-        section->GetName().AsCString(), llvm::toString(std::move(err)).c_str());
+        section->GetName().AsCString(nullptr),
+        llvm::toString(std::move(err)).c_str());
     return nullptr;
   }
 
@@ -3043,7 +3045,7 @@ unsigned ObjectFileELF::ApplyRelocations(
   for (unsigned i = 0; i < num_relocations; ++i) {
     if (!rel.Parse(rel_data, &offset)) {
       GetModule()->ReportError(".rel{0}[{1:d}] failed to parse relocation",
-                               rel_section->GetName().AsCString(), i);
+                               rel_section->GetName().AsCString(nullptr), i);
       break;
     }
     const Symbol *symbol = nullptr;
@@ -3058,7 +3060,7 @@ unsigned ObjectFileELF::ApplyRelocations(
         case R_ARM_REL32:
           GetModule()->ReportError("unsupported AArch32 relocation:"
                                    " .rel{0}[{1}], type {2}",
-                                   rel_section->GetName().AsCString(), i,
+                                   rel_section->GetName().AsCString(nullptr), i,
                                    reloc_type(rel));
           break;
         default:
@@ -3088,15 +3090,15 @@ unsigned ObjectFileELF::ApplyRelocations(
             *dst = value;
           } else {
             GetModule()->ReportError(".rel{0}[{1}] unknown symbol id: {2:d}",
-                                    rel_section->GetName().AsCString(), i,
-                                    reloc_symbol(rel));
+                                     rel_section->GetName().AsCString(nullptr),
+                                     i, reloc_symbol(rel));
           }
           break;
         case R_386_NONE:
         case R_386_PC32:
           GetModule()->ReportError("unsupported i386 relocation:"
                                    " .rel{0}[{1}], type {2}",
-                                   rel_section->GetName().AsCString(), i,
+                                   rel_section->GetName().AsCString(nullptr), i,
                                    reloc_type(rel));
           break;
         default:
diff --git a/lldb/source/Plugins/ObjectFile/JSON/ObjectFileJSON.cpp b/lldb/source/Plugins/ObjectFile/JSON/ObjectFileJSON.cpp
index e1912d02ea0e1..d361561aea374 100644
--- a/lldb/source/Plugins/ObjectFile/JSON/ObjectFileJSON.cpp
+++ b/lldb/source/Plugins/ObjectFile/JSON/ObjectFileJSON.cpp
@@ -267,7 +267,7 @@ bool ObjectFileJSON::SetLoadAddress(Target &target, lldb::addr_t value,
       LLDB_LOGF(
           log,
           "ObjectFileJSON::SetLoadAddress section %s to load addr 0x%" PRIx64,
-          section_sp->GetName().AsCString(), section_load_addr + slide);
+          section_sp->GetName().AsCString(nullptr), section_load_addr + slide);
       target.SetSectionLoadAddress(section_sp, section_load_addr + slide,
                                    /*warn_multiple=*/true);
     }
diff --git a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
index d8b017b492b1b..d385fc552a8cc 100644
--- a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
+++ b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
@@ -1652,8 +1652,8 @@ void ObjectFileMachO::ProcessSegmentCommand(
         log->Printf(
             "Installing dSYM's %s segment file address over ObjectFile's "
             "so symbol table/debug info resolves correctly for %s",
-            const_segname.AsCString(),
-            module_sp->GetFileSpec().GetFilename().AsCString());
+            const_segname.AsCString(nullptr),
+            module_sp->GetFileSpec().GetFilename().AsCString(nullptr));
       }
 
       // Make sure we've parsed the symbol table from the ObjectFile before
@@ -2135,7 +2135,7 @@ static SymbolType GetSymbolType(const char *&symbol_name,
                                 const SectionSP &symbol_section) {
   SymbolType type = eSymbolTypeInvalid;
 
-  const char *symbol_sect_name = symbol_section->GetName().AsCString();
+  const char *symbol_sect_name = symbol_section->GetName().AsCString(nullptr);
   if (symbol_section->IsDescendant(text_section_sp.get())) {
     if (symbol_section->IsClear(S_ATTR_PURE_INSTRUCTIONS |
                                 S_ATTR_SELF_MODIFYING_CODE |
@@ -3022,7 +3022,7 @@ void ObjectFileMachO::ParseSymtab(Symtab &symtab) {
                             const char *so_path = sym[sym_idx - 1]
                                                       .GetMangled()
                                                       .GetDemangledName()
-                                                      .AsCString();
+                                                      .AsCString(nullptr);
                             if (so_path && so_path[0]) {
                               std::string full_so_path(so_path);
                               const size_t double_slash_pos =
@@ -3336,7 +3336,7 @@ void ObjectFileMachO::ParseSymtab(Symtab &symtab) {
 
                           if (type == eSymbolTypeInvalid) {
                             const char *symbol_sect_name =
-                                symbol_section->GetName().AsCString();
+                                symbol_section->GetName().AsCString(nullptr);
                             if (symbol_section->IsDescendant(
                                     text_section_sp.get())) {
                               if (symbol_section->IsClear(
@@ -3809,7 +3809,8 @@ void ObjectFileMachO::ParseSymtab(Symtab &symtab) {
               // filename, so here we combine it with the first one if we are
               // minimizing the symbol table
               const char *so_path =
-                  sym[sym_idx - 1].GetMangled().GetDemangledName().AsCString();
+                  sym[sym_idx - 1].GetMangled().GetDemangledName().AsCString(
+                      nullptr);
               if (so_path && so_path[0]) {
                 std::string full_so_path(so_path);
                 const size_t double_slash_pos = full_so_path.find("//");
@@ -4094,7 +4095,7 @@ void ObjectFileMachO::ParseSymtab(Symtab &symtab) {
 
             if (type == eSymbolTypeInvalid) {
               const char *symbol_sect_name =
-                  symbol_section->GetName().AsCString();
+                  symbol_section->GetName().AsCString(nullptr);
               if (symbol_section->IsDescendant(text_section_sp.get())) {
                 if (symbol_section->IsClear(S_ATTR_PURE_INSTRUCTIONS |
                                             S_ATTR_SELF_MODIFYING_CODE |
@@ -6039,7 +6040,7 @@ bool ObjectFileMachO::SetLoadAddress(Target &target, lldb::addr_t value,
         LLDB_LOGF(log,
                   "ObjectFileMachO::SetLoadAddress segment '%s' load addr is "
                   "0x%" PRIx64,
-                  section_sp->GetName().AsCString(),
+                  section_sp->GetName().AsCString(nullptr),
                   section_sp->GetFileAddress() + value);
         if (target.SetSectionLoadAddress(section_sp,
                                          section_sp->GetFileAddress() + value,
@@ -6063,7 +6064,8 @@ bool ObjectFileMachO::SetLoadAddress(Target &target, lldb::addr_t value,
           LLDB_LOGF(log,
                     "ObjectFileMachO::SetLoadAddress segment '%s' load addr is "
                     "0x%" PRIx64,
-                    section_sp->GetName().AsCString(), section_load_addr);
+                    section_sp->GetName().AsCString(nullptr),
+                    section_load_addr);
           if (target.SetSectionLoadAddress(section_sp, section_load_addr,
                                            warn_multiple))
             ++num_loaded_sections;
@@ -6222,7 +6224,7 @@ CreateAllImageInfosPayload(const lldb::ProcessSP &process_sp,
         // is not guaranteed to be nul-terminated if all 16 characters are
         // used.
         // coverity[buffer_size_warning]
-        strncpy(seg_vmaddr.segname, name.AsCString(),
+        strncpy(seg_vmaddr.segname, name.AsCString(nullptr),
                 sizeof(seg_vmaddr.segname));
         seg_vmaddr.vmaddr = vmaddr;
         seg_vmaddr.unused = 0;
diff --git a/lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.cpp b/lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.cpp
index 8fca95512ace3..cea15a05dc005 100644
--- a/lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.cpp
+++ b/lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.cpp
@@ -977,7 +977,7 @@ Status MinidumpFileBuilder::ReadWriteMemoryInChunks(
       LLDB_LOGF(log,
                 "Failed to read memory region at: 0x%" PRIx64
                 ". Bytes read: 0x%" PRIx64 ", error: %s",
-                current_addr, bytes_read, error.AsCString());
+                current_addr, bytes_read, error.AsCString(nullptr));
 
       // If we failed in a memory read, we would normally want to skip
       // this entire region. If we had already written to the minidump
@@ -1282,7 +1282,8 @@ void MinidumpFileBuilder::DeleteFile() noexcept {
   if (m_core_file) {
     Status error = m_core_file->Close();
     if (error.Fail())
-      LLDB_LOGF(log, "Failed to close minidump file: %s", error.AsCString());
+      LLDB_LOGF(log, "Failed to close minidump file: %s",
+                error.AsCString(nullptr));
 
     m_core_file.reset();
   }
diff --git a/lldb/source/Plugins/ObjectFile/Minidump/ObjectFileMinidump.cpp b/lldb/source/Plugins/ObjectFile/Minidump/ObjectFileMinidump.cpp
index 20817aac28540..926b3f0de4d6a 100644
--- a/lldb/source/Plugins/ObjectFile/Minidump/ObjectFileMinidump.cpp
+++ b/lldb/source/Plugins/ObjectFile/Minidump/ObjectFileMinidump.cpp
@@ -94,42 +94,42 @@ bool ObjectFileMinidump::SaveCore(const lldb::ProcessSP &process_sp,
   error = builder.AddHeaderAndCalculateDirectories();
   if (error.Fail()) {
     LLDB_LOGF(log, "AddHeaderAndCalculateDirectories failed: %s",
-              error.AsCString());
+              error.AsCString(nullptr));
     return false;
   };
   error = builder.AddSystemInfo();
   if (error.Fail()) {
-    LLDB_LOGF(log, "AddSystemInfo failed: %s", error.AsCString());
+    LLDB_LOGF(log, "AddSystemInfo failed: %s", error.AsCString(nullptr));
     return false;
   }
 
   error = builder.AddModuleList();
   if (error.Fail()) {
-    LLDB_LOGF(log, "AddModuleList failed: %s", error.AsCString());
+    LLDB_LOGF(log, "AddModuleList failed: %s", error.AsCString(nullptr));
     return false;
   }
   error = builder.AddMiscInfo();
   if (error.Fail()) {
-    LLDB_LOGF(log, "AddMiscInfo failed: %s", error.AsCString());
+    LLDB_LOGF(log, "AddMiscInfo failed: %s", error.AsCString(nullptr));
     return false;
   }
 
   error = builder.AddThreadList();
   if (error.Fail()) {
-    LLDB_LOGF(log, "AddThreadList failed: %s", error.AsCString());
+    LLDB_LOGF(log, "AddThreadList failed: %s", error.AsCString(nullptr));
     return false;
   }
 
   error = builder.AddLinuxFileStreams();
   if (error.Fail()) {
-    LLDB_LOGF(log, "AddLinuxFileStreams failed: %s", error.AsCString());
+    LLDB_LOGF(log, "AddLinuxFileStreams failed: %s", error.AsCString(nullptr));
     return false;
   }
 
   // Add any exceptions but only if there are any in any threads.
   error = builder.AddExceptions();
   if (error.Fail()) {
-    LLDB_LOGF(log, "AddExceptions failed: %s", error.AsCString());
+    LLDB_LOGF(log, "AddExceptions failed: %s", error.AsCString(nullptr));
     return false;
   }
 
@@ -137,13 +137,13 @@ bool ObjectFileMinidump::SaveCore(const lldb::ProcessSP &process_sp,
   // land and many RVA's only support 32b
   error = builder.AddMemoryList();
   if (error.Fail()) {
-    LLDB_LOGF(log, "AddMemoryList failed: %s", error.AsCString());
+    LLDB_LOGF(log, "AddMemoryList failed: %s", error.AsCString(nullptr));
     return false;
   }
 
   error = builder.DumpFile();
   if (error.Fail()) {
-    LLDB_LOGF(log, "DumpFile failed: %s", error.AsCString());
+    LLDB_LOGF(log, "DumpFile failed: %s", error.AsCString(nullptr));
     return false;
   }
 
diff --git a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
index b8c4144af5ab0..aaa38b18cbf0e 100644
--- a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
+++ b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
@@ -165,7 +165,7 @@ static UUID GetCoffUUID(llvm::object::COFFObjectFile &coff_obj) {
     auto raw_data = coff_obj.getData();
     LLDB_SCOPED_TIMERF(
         "Calculating module crc32 %s with size %" PRIu64 " KiB",
-        FileSpec(coff_obj.getFileName()).GetFilename().AsCString(),
+        FileSpec(coff_obj.getFileName()).GetFilename().AsCString(nullptr),
         static_cast<lldb::offset_t>(raw_data.size()) / 1024);
     gnu_debuglink_crc = llvm::crc32(0, llvm::arrayRefFromStringRef(raw_data));
   }
diff --git a/lldb/source/Plugins/Platform/Android/AdbClient.cpp b/lldb/source/Plugins/Platform/Android/AdbClient.cpp
index 0fbb48a2e16a0..1fd24fa9fea07 100644
--- a/lldb/source/Plugins/Platform/Android/AdbClient.cpp
+++ b/lldb/source/Plugins/Platform/Android/AdbClient.cpp
@@ -365,7 +365,7 @@ Status AdbClient::internalShell(const char *command, milliseconds timeout,
   auto error = SelectTargetDevice(*m_conn, m_device_id);
   if (error.Fail())
     return Status::FromErrorStringWithFormat(
-        "Failed to select target device: %s", error.AsCString());
+        "Failed to select target device: %s", error.AsCString(nullptr));
 
   StreamString adb_command;
   adb_command.Printf("shell:%s", command);
@@ -485,7 +485,7 @@ Status AdbSyncService::PushFileImpl(const FileSpec &local_file,
     error = SendSyncRequest(kDATA, chunk_size, chunk);
     if (error.Fail())
       return Status::FromErrorStringWithFormat("Failed to send file chunk: %s",
-                                               error.AsCString());
+                                               error.AsCString(nullptr));
   }
   error = SendSyncRequest(
       kDONE,
@@ -500,13 +500,13 @@ Status AdbSyncService::PushFileImpl(const FileSpec &local_file,
   error = ReadSyncHeader(response_id, data_len);
   if (error.Fail())
     return Status::FromErrorStringWithFormat("Failed to read DONE response: %s",
-                                             error.AsCString());
+                                             error.AsCString(nullptr));
   if (response_id == kFAIL) {
     std::string error_message(data_len, 0);
     error = ReadAllBytes(*m_conn, &error_message[0], data_len);
     if (error.Fail())
       return Status::FromErrorStringWithFormat(
-          "Failed to read DONE error message: %s", error.AsCString());
+          "Failed to read DONE error message: %s", error.AsCString(nullptr));
     return Status::FromErrorStringWithFormat("Failed to push file: %s",
                                              error_message.c_str());
   } else if (response_id != kOKAY)
@@ -528,7 +528,7 @@ Status AdbSyncService::StatImpl(const FileSpec &remote_file, uint32_t &mode,
                                remote_file_path.c_str());
   if (error.Fail())
     return Status::FromErrorStringWithFormat("Failed to send request: %s",
-                                             error.AsCString());
+                                             error.AsCString(nullptr));
 
   static const size_t stat_len = strlen(kSTAT);
   static const size_t response_len = stat_len + (sizeof(uint32_t) * 3);
@@ -537,7 +537,7 @@ Status AdbSyncService::StatImpl(const FileSpec &remote_file, uint32_t &mode,
   error = ReadAllBytes(*m_conn, &buffer[0], buffer.size());
   if (error.Fail())
     return Status::FromErrorStringWithFormat("Failed to read response: %s",
-                                             error.AsCString());
+                                             error.AsCString(nullptr));
 
   DataExtractor extractor(&buffer[0], buffer.size(), eByteOrderLittle,
                           sizeof(void *));
@@ -659,7 +659,7 @@ Status AdbSyncService::PullFileChunk(std::vector<char> &buffer, bool &eof) {
     error = ReadAllBytes(*m_conn, &error_message[0], data_len);
     if (error.Fail())
       return Status::FromErrorStringWithFormat(
-          "Failed to read pull error message: %s", error.AsCString());
+          "Failed to read pull error message: %s", error.AsCString(nullptr));
     return Status::FromErrorStringWithFormat("Failed to pull file: %s",
                                              error_message.c_str());
   } else
diff --git a/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp b/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp
index ce7dad8b02797..b64dac61bb701 100644
--- a/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp
+++ b/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp
@@ -349,7 +349,7 @@ uint32_t PlatformAndroid::GetSdkVersion() {
   if (error.Fail() || version_string.empty()) {
     Log *log = GetLog(LLDBLog::Platform);
     LLDB_LOGF(log, "Get SDK version failed. (error: %s, output: %s)",
-              error.AsCString(), version_string.c_str());
+              error.AsCString(nullptr), version_string.c_str());
     return 0;
   }
 
@@ -390,7 +390,7 @@ Status PlatformAndroid::DownloadSymbolFile(const lldb::ModuleSP &module_sp,
   if (error.Fail() || tmpdir.empty())
     return Status::FromErrorStringWithFormat(
         "Failed to generate temporary directory on the device (%s)",
-        error.AsCString());
+        error.AsCString(nullptr));
   tmpdir = llvm::StringRef(tmpdir).trim().str();
 
   // Create file remover for the temporary directory created on the device
@@ -403,7 +403,7 @@ Status PlatformAndroid::DownloadSymbolFile(const lldb::ModuleSP &module_sp,
         Log *log = GetLog(LLDBLog::Platform);
         if (log && error.Fail())
           LLDB_LOGF(log, "Failed to remove temp directory: %s",
-                    error.AsCString());
+                    error.AsCString(nullptr));
       });
 
   FileSpec symfile_platform_filespec(tmpdir);
@@ -417,7 +417,7 @@ Status PlatformAndroid::DownloadSymbolFile(const lldb::ModuleSP &module_sp,
   error = adb->Shell(command.GetData(), minutes(1), nullptr);
   if (error.Fail())
     return Status::FromErrorStringWithFormat("Oatdump failed: %s",
-                                             error.AsCString());
+                                             error.AsCString(nullptr));
 
   // Download the symbolfile from the remote device
   return GetFile(symfile_platform_filespec, dst_file_spec);
diff --git a/lldb/source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp b/lldb/source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp
index 461ee8e3b1826..764686841332f 100644
--- a/lldb/source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp
+++ b/lldb/source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp
@@ -176,7 +176,7 @@ void PlatformAndroidRemoteGDBServer::DeleteForwardPort(lldb::pid_t pid) {
     LLDB_LOGF(log,
               "Failed to delete port forwarding (pid=%" PRIu64
               ", port=%d, device=%s): %s",
-              pid, port, m_device_id.c_str(), error.AsCString());
+              pid, port, m_device_id.c_str(), error.AsCString(nullptr));
   }
   m_port_forwards.erase(it);
 }
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinDevice.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinDevice.cpp
index a9a60d8070f08..23107ae89eef9 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinDevice.cpp
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinDevice.cpp
@@ -281,12 +281,12 @@ lldb_private::Status PlatformDarwinDevice::GetSharedModuleWithLocalCache(
             "[%s] Trying to find module %s/%s - platform path %s/%s symbol "
             "path %s/%s",
             (IsHost() ? "host" : "remote"),
-            module_spec.GetFileSpec().GetDirectory().AsCString(),
-            module_spec.GetFileSpec().GetFilename().AsCString(),
-            module_spec.GetPlatformFileSpec().GetDirectory().AsCString(),
-            module_spec.GetPlatformFileSpec().GetFilename().AsCString(),
-            module_spec.GetSymbolFileSpec().GetDirectory().AsCString(),
-            module_spec.GetSymbolFileSpec().GetFilename().AsCString());
+            module_spec.GetFileSpec().GetDirectory().AsCString(nullptr),
+            module_spec.GetFileSpec().GetFilename().AsCString(nullptr),
+            module_spec.GetPlatformFileSpec().GetDirectory().AsCString(nullptr),
+            module_spec.GetPlatformFileSpec().GetFilename().AsCString(nullptr),
+            module_spec.GetSymbolFileSpec().GetDirectory().AsCString(nullptr),
+            module_spec.GetSymbolFileSpec().GetFilename().AsCString(nullptr));
 
   Status err;
 
@@ -343,8 +343,8 @@ lldb_private::Status PlatformDarwinDevice::GetSharedModuleWithLocalCache(
           Log *log = GetLog(LLDBLog::Platform);
           LLDB_LOGF(log, "[%s] module %s/%s was rsynced and is now there",
                     (IsHost() ? "host" : "remote"),
-                    module_spec.GetFileSpec().GetDirectory().AsCString(),
-                    module_spec.GetFileSpec().GetFilename().AsCString());
+                    module_spec.GetFileSpec().GetDirectory().AsCString(nullptr),
+                    module_spec.GetFileSpec().GetFilename().AsCString(nullptr));
           ModuleSpec local_spec(module_cache_spec,
                                 module_spec.GetArchitecture());
           module_sp = std::make_shared<Module>(local_spec);
@@ -375,11 +375,11 @@ lldb_private::Status PlatformDarwinDevice::GetSharedModuleWithLocalCache(
             requires_transfer = *MD5 != *remote_md5;
           if (requires_transfer) {
             // bring in the remote file
-            LLDB_LOGF(log,
-                      "[%s] module %s/%s needs to be replaced from remote copy",
-                      (IsHost() ? "host" : "remote"),
-                      module_spec.GetFileSpec().GetDirectory().AsCString(),
-                      module_spec.GetFileSpec().GetFilename().AsCString());
+            LLDB_LOGF(
+                log, "[%s] module %s/%s needs to be replaced from remote copy",
+                (IsHost() ? "host" : "remote"),
+                module_spec.GetFileSpec().GetDirectory().AsCString(nullptr),
+                module_spec.GetFileSpec().GetFilename().AsCString(nullptr));
             Status err =
                 BringInRemoteFile(this, module_spec, module_cache_spec);
             if (err.Fail())
@@ -393,16 +393,16 @@ lldb_private::Status PlatformDarwinDevice::GetSharedModuleWithLocalCache(
         Log *log = GetLog(LLDBLog::Platform);
         LLDB_LOGF(log, "[%s] module %s/%s was found in the cache",
                   (IsHost() ? "host" : "remote"),
-                  module_spec.GetFileSpec().GetDirectory().AsCString(),
-                  module_spec.GetFileSpec().GetFilename().AsCString());
+                  module_spec.GetFileSpec().GetDirectory().AsCString(nullptr),
+                  module_spec.GetFileSpec().GetFilename().AsCString(nullptr));
         return Status();
       }
 
       // bring in the remote module file
       LLDB_LOGF(log, "[%s] module %s/%s needs to come in remotely",
                 (IsHost() ? "host" : "remote"),
-                module_spec.GetFileSpec().GetDirectory().AsCString(),
-                module_spec.GetFileSpec().GetFilename().AsCString());
+                module_spec.GetFileSpec().GetDirectory().AsCString(nullptr),
+                module_spec.GetFileSpec().GetFilename().AsCString(nullptr));
       Status err = BringInRemoteFile(this, module_spec, module_cache_spec);
       if (err.Fail())
         return err;
@@ -410,8 +410,8 @@ lldb_private::Status PlatformDarwinDevice::GetSharedModuleWithLocalCache(
         Log *log = GetLog(LLDBLog::Platform);
         LLDB_LOGF(log, "[%s] module %s/%s is now cached and fine",
                   (IsHost() ? "host" : "remote"),
-                  module_spec.GetFileSpec().GetDirectory().AsCString(),
-                  module_spec.GetFileSpec().GetFilename().AsCString());
+                  module_spec.GetFileSpec().GetDirectory().AsCString(nullptr),
+                  module_spec.GetFileSpec().GetFilename().AsCString(nullptr));
         ModuleSpec local_spec(module_cache_spec, module_spec.GetArchitecture());
         module_sp = std::make_shared<Module>(local_spec);
         module_sp->SetPlatformFileSpec(module_spec.GetFileSpec());
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp
index 70c6380942efd..a097ffa9079f7 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp
@@ -611,7 +611,7 @@ void PlatformDarwinKernel::AddKextToMap(PlatformDarwinKernel *thisp,
 bool PlatformDarwinKernel::KextHasdSYMSibling(
     const FileSpec &kext_bundle_filepath) {
   FileSpec dsym_fspec = kext_bundle_filepath;
-  std::string filename = dsym_fspec.GetFilename().AsCString();
+  std::string filename = dsym_fspec.GetFilename().AsCString(nullptr);
   filename += ".dSYM";
   dsym_fspec.SetFilename(filename);
   if (FileSystem::Instance().IsDirectory(dsym_fspec)) {
@@ -625,7 +625,7 @@ bool PlatformDarwinKernel::KextHasdSYMSibling(
       kext_bundle_filepath.GetFileNameStrippingExtension();
   std::string deep_bundle_str =
       kext_bundle_filepath.GetPath() + "/Contents/MacOS/";
-  deep_bundle_str += executable_name.AsCString();
+  deep_bundle_str += executable_name.AsCString(nullptr);
   deep_bundle_str += ".dSYM";
   dsym_fspec.SetFile(deep_bundle_str, FileSpec::Style::native);
   FileSystem::Instance().Resolve(dsym_fspec);
@@ -636,7 +636,7 @@ bool PlatformDarwinKernel::KextHasdSYMSibling(
   // look for a shallow bundle format
   //
   std::string shallow_bundle_str = kext_bundle_filepath.GetPath() + "/";
-  shallow_bundle_str += executable_name.AsCString();
+  shallow_bundle_str += executable_name.AsCString(nullptr);
   shallow_bundle_str += ".dSYM";
   dsym_fspec.SetFile(shallow_bundle_str, FileSpec::Style::native);
   FileSystem::Instance().Resolve(dsym_fspec);
@@ -648,7 +648,7 @@ bool PlatformDarwinKernel::KextHasdSYMSibling(
 //    /dir/dir/mach.development.t7004.dSYM
 bool PlatformDarwinKernel::KernelHasdSYMSibling(const FileSpec &kernel_binary) {
   FileSpec kernel_dsym = kernel_binary;
-  std::string filename = kernel_binary.GetFilename().AsCString();
+  std::string filename = kernel_binary.GetFilename().AsCString(nullptr);
   filename += ".dSYM";
   kernel_dsym.SetFilename(filename);
   return FileSystem::Instance().IsDirectory(kernel_dsym);
diff --git a/lldb/source/Plugins/Platform/MacOSX/objcxx/PlatformiOSSimulatorCoreSimulatorSupport.mm b/lldb/source/Plugins/Platform/MacOSX/objcxx/PlatformiOSSimulatorCoreSimulatorSupport.mm
index f3e79d3d56154..2474ee8f46297 100644
--- a/lldb/source/Plugins/Platform/MacOSX/objcxx/PlatformiOSSimulatorCoreSimulatorSupport.mm
+++ b/lldb/source/Plugins/Platform/MacOSX/objcxx/PlatformiOSSimulatorCoreSimulatorSupport.mm
@@ -435,7 +435,7 @@ static Status HandleFileAction(ProcessLaunchInfo &launch_info,
           Status posix_error = Status::FromErrno();
           return Status::FromErrorStringWithFormatv(
               "unable to open file '{0}': {1}", file_spec.GetPath(),
-              posix_error.AsCString());
+              posix_error.AsCString(nullptr));
         }
       }
     } break;
diff --git a/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp b/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
index fdc52d29d2a33..e0b35b46c711f 100644
--- a/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
+++ b/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
@@ -665,7 +665,7 @@ PlatformPOSIX::MakeLoadImageUtilityFunction(ExecutionContext &exe_ctx,
   if (utility_error.Fail()) {
     error = Status::FromErrorStringWithFormat(
         "dlopen error: could not make function caller: %s",
-        utility_error.AsCString());
+        utility_error.AsCString(nullptr));
     return nullptr;
   }
   
@@ -736,7 +736,7 @@ uint32_t PlatformPOSIX::DoLoadImage(lldb_private::Process *process,
   if (path_addr == LLDB_INVALID_ADDRESS) {
     error = Status::FromErrorStringWithFormat(
         "dlopen error: could not allocate memory for path: %s",
-        utility_error.AsCString());
+        utility_error.AsCString(nullptr));
     return LLDB_INVALID_IMAGE_TOKEN;
   }
 
@@ -750,7 +750,7 @@ uint32_t PlatformPOSIX::DoLoadImage(lldb_private::Process *process,
   if (utility_error.Fail()) {
     error = Status::FromErrorStringWithFormat(
         "dlopen error: could not write path string: %s",
-        utility_error.AsCString());
+        utility_error.AsCString(nullptr));
     return LLDB_INVALID_IMAGE_TOKEN;
   }
   
@@ -763,7 +763,7 @@ uint32_t PlatformPOSIX::DoLoadImage(lldb_private::Process *process,
   if (utility_error.Fail()) {
     error = Status::FromErrorStringWithFormat(
         "dlopen error: could not allocate memory for path: %s",
-        utility_error.AsCString());
+        utility_error.AsCString(nullptr));
     return LLDB_INVALID_IMAGE_TOKEN;
   }
   
@@ -811,7 +811,7 @@ uint32_t PlatformPOSIX::DoLoadImage(lldb_private::Process *process,
     if (path_array_addr == LLDB_INVALID_ADDRESS) {
       error = Status::FromErrorStringWithFormat(
           "dlopen error: could not allocate memory for path array: %s",
-          utility_error.AsCString());
+          utility_error.AsCString(nullptr));
       return LLDB_INVALID_IMAGE_TOKEN;
     }
     
@@ -827,7 +827,7 @@ uint32_t PlatformPOSIX::DoLoadImage(lldb_private::Process *process,
     if (utility_error.Fail()) {
       error = Status::FromErrorStringWithFormat(
           "dlopen error: could not write path array: %s",
-          utility_error.AsCString());
+          utility_error.AsCString(nullptr));
       return LLDB_INVALID_IMAGE_TOKEN;
     }
     // Now make spaces in the target for the buffer.  We need to add one for
@@ -840,7 +840,7 @@ uint32_t PlatformPOSIX::DoLoadImage(lldb_private::Process *process,
     if (buffer_addr == LLDB_INVALID_ADDRESS) {
       error = Status::FromErrorStringWithFormat(
           "dlopen error: could not allocate memory for buffer: %s",
-          utility_error.AsCString());
+          utility_error.AsCString(nullptr));
       return LLDB_INVALID_IMAGE_TOKEN;
     }
   
@@ -917,7 +917,7 @@ uint32_t PlatformPOSIX::DoLoadImage(lldb_private::Process *process,
   if (utility_error.Fail()) {
     error = Status::FromErrorStringWithFormat(
         "dlopen error: could not read the return struct: %s",
-        utility_error.AsCString());
+        utility_error.AsCString(nullptr));
     return LLDB_INVALID_IMAGE_TOKEN;
   }
   
@@ -942,7 +942,7 @@ uint32_t PlatformPOSIX::DoLoadImage(lldb_private::Process *process,
   if (utility_error.Fail()) {
     error = Status::FromErrorStringWithFormat(
         "dlopen error: could not read error string: %s",
-        utility_error.AsCString());
+        utility_error.AsCString(nullptr));
     return LLDB_INVALID_IMAGE_TOKEN;
   }
   
diff --git a/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp b/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp
index 1bc9d3fb9978d..9d07fadaa7a67 100644
--- a/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp
+++ b/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp
@@ -213,7 +213,7 @@ uint32_t PlatformWindows::DoLoadImage(Process *process,
   if (injected_name == LLDB_INVALID_ADDRESS) {
     error = Status::FromErrorStringWithFormat(
         "LoadLibrary error: unable to allocate memory for name: %s",
-        status.AsCString());
+        status.AsCString(nullptr));
     return LLDB_INVALID_IMAGE_TOKEN;
   }
 
@@ -224,7 +224,8 @@ uint32_t PlatformWindows::DoLoadImage(Process *process,
                        name.size() * sizeof(llvm::UTF16), status);
   if (status.Fail()) {
     error = Status::FromErrorStringWithFormat(
-        "LoadLibrary error: unable to write name: %s", status.AsCString());
+        "LoadLibrary error: unable to write name: %s",
+        status.AsCString(nullptr));
     return LLDB_INVALID_IMAGE_TOKEN;
   }
 
@@ -254,7 +255,7 @@ uint32_t PlatformWindows::DoLoadImage(Process *process,
     if (injected_paths == LLDB_INVALID_ADDRESS) {
       error = Status::FromErrorStringWithFormat(
           "LoadLibrary error: unable to allocate memory for paths: %s",
-          status.AsCString());
+          status.AsCString(nullptr));
       return LLDB_INVALID_IMAGE_TOKEN;
     }
 
@@ -266,7 +267,8 @@ uint32_t PlatformWindows::DoLoadImage(Process *process,
                          search_paths.size() * sizeof(llvm::UTF16), status);
     if (status.Fail()) {
       error = Status::FromErrorStringWithFormat(
-          "LoadLibrary error: unable to write paths: %s", status.AsCString());
+          "LoadLibrary error: unable to write paths: %s",
+          status.AsCString(nullptr));
       return LLDB_INVALID_IMAGE_TOKEN;
     }
   }
@@ -284,7 +286,7 @@ uint32_t PlatformWindows::DoLoadImage(Process *process,
   if (injected_module_path == LLDB_INVALID_ADDRESS) {
     error = Status::FromErrorStringWithFormat(
         "LoadLibrary error: unable to allocate memory for module location: %s",
-        status.AsCString());
+        status.AsCString(nullptr));
     return LLDB_INVALID_IMAGE_TOKEN;
   }
 
@@ -302,7 +304,7 @@ uint32_t PlatformWindows::DoLoadImage(Process *process,
   if (status.Fail()) {
     error = Status::FromErrorStringWithFormat(
         "LoadLibrary error: could not allocate memory for result: %s",
-        status.AsCString());
+        status.AsCString(nullptr));
     return LLDB_INVALID_IMAGE_TOKEN;
   }
 
@@ -315,7 +317,7 @@ uint32_t PlatformWindows::DoLoadImage(Process *process,
   if (status.Fail()) {
     error = Status::FromErrorStringWithFormat(
         "LoadLibrary error: could not initialize result: %s",
-        status.AsCString());
+        status.AsCString(nullptr));
     return LLDB_INVALID_IMAGE_TOKEN;
   }
 
@@ -326,7 +328,7 @@ uint32_t PlatformWindows::DoLoadImage(Process *process,
   if (status.Fail()) {
     error = Status::FromErrorStringWithFormat(
         "LoadLibrary error: could not initialize result: %s",
-        status.AsCString());
+        status.AsCString(nullptr));
     return LLDB_INVALID_IMAGE_TOKEN;
   }
 
@@ -393,7 +395,8 @@ uint32_t PlatformWindows::DoLoadImage(Process *process,
   lldb::addr_t token = process->ReadPointerFromMemory(injected_result, status);
   if (status.Fail()) {
     error = Status::FromErrorStringWithFormat(
-        "LoadLibrary error: could not read the result: %s", status.AsCString());
+        "LoadLibrary error: could not read the result: %s",
+        status.AsCString(nullptr));
     return LLDB_INVALID_IMAGE_TOKEN;
   }
 
@@ -405,7 +408,7 @@ uint32_t PlatformWindows::DoLoadImage(Process *process,
     if (status.Fail()) {
       error = Status::FromErrorStringWithFormat(
           "LoadLibrary error: could not read error status: %s",
-          status.AsCString());
+          status.AsCString(nullptr));
       return LLDB_INVALID_IMAGE_TOKEN;
     }
 
@@ -419,7 +422,7 @@ uint32_t PlatformWindows::DoLoadImage(Process *process,
   if (status.Fail()) {
     error = Status::FromErrorStringWithFormat(
         "LoadLibrary error: could not read module path: %s",
-        status.AsCString());
+        status.AsCString(nullptr));
     return LLDB_INVALID_IMAGE_TOKEN;
   }
 
@@ -527,7 +530,7 @@ ProcessSP PlatformWindows::DebugProcess(ProcessLaunchInfo &launch_info,
   } else {
     Log *log = GetLog(LLDBLog::Platform);
     LLDB_LOGF(log, "Platform::%s LaunchProcess() failed: %s", __FUNCTION__,
-              error.AsCString());
+              error.AsCString(nullptr));
   }
 #endif
 
@@ -744,7 +747,7 @@ void * __lldb_LoadLibraryHelper(const wchar_t *name, const wchar_t *paths,
   if (error.Fail()) {
     status = Status::FromErrorStringWithFormat(
         "LoadLibrary error: could not create function caller: %s",
-        error.AsCString());
+        error.AsCString(nullptr));
     return nullptr;
   }
 
diff --git a/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp b/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
index 1f69ef5f3f6ca..a44f93b0501a1 100644
--- a/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
+++ b/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
@@ -439,7 +439,8 @@ PlatformRemoteGDBServer::DebugProcess(ProcessLaunchInfo &launch_info,
           if (error.Success())
             error = process_sp->Launch(launch_info);
           else if (debugserver_pid != LLDB_INVALID_PROCESS_ID) {
-            printf("error: connect remote failed (%s)\n", error.AsCString());
+            printf("error: connect remote failed (%s)\n",
+                   error.AsCString(nullptr));
             KillSpawnedProcess(debugserver_pid);
           }
         }
@@ -557,7 +558,7 @@ Status PlatformRemoteGDBServer::MakeDirectory(const FileSpec &file_spec,
             "PlatformRemoteGDBServer::MakeDirectory(path='%s', mode=%o) "
             "error = %u (%s)",
             file_spec.GetPath().c_str(), mode, error.GetError(),
-            error.AsCString());
+            error.AsCString(nullptr));
   return error;
 }
 
@@ -572,7 +573,7 @@ Status PlatformRemoteGDBServer::GetFilePermissions(const FileSpec &file_spec,
             "PlatformRemoteGDBServer::GetFilePermissions(path='%s', "
             "file_permissions=%o) error = %u (%s)",
             file_spec.GetPath().c_str(), file_permissions, error.GetError(),
-            error.AsCString());
+            error.AsCString(nullptr));
   return error;
 }
 
@@ -587,7 +588,7 @@ Status PlatformRemoteGDBServer::SetFilePermissions(const FileSpec &file_spec,
             "PlatformRemoteGDBServer::SetFilePermissions(path='%s', "
             "file_permissions=%o) error = %u (%s)",
             file_spec.GetPath().c_str(), file_permissions, error.GetError(),
-            error.AsCString());
+            error.AsCString(nullptr));
   return error;
 }
 
@@ -656,7 +657,7 @@ Status PlatformRemoteGDBServer::CreateSymlink(
             "PlatformRemoteGDBServer::CreateSymlink(src='%s', dst='%s') "
             "error = %u (%s)",
             src.GetPath().c_str(), dst.GetPath().c_str(), error.GetError(),
-            error.AsCString());
+            error.AsCString(nullptr));
   return error;
 }
 
@@ -666,7 +667,8 @@ Status PlatformRemoteGDBServer::Unlink(const FileSpec &file_spec) {
   Status error = m_gdb_client_up->Unlink(file_spec);
   Log *log = GetLog(LLDBLog::Platform);
   LLDB_LOGF(log, "PlatformRemoteGDBServer::Unlink(path='%s') error = %u (%s)",
-            file_spec.GetPath().c_str(), error.GetError(), error.AsCString());
+            file_spec.GetPath().c_str(), error.GetError(),
+            error.AsCString(nullptr));
   return error;
 }
 
diff --git a/lldb/source/Plugins/Process/FreeBSD/NativeProcessFreeBSD.cpp b/lldb/source/Plugins/Process/FreeBSD/NativeProcessFreeBSD.cpp
index 293471e4278a8..77b40c68c01e0 100644
--- a/lldb/source/Plugins/Process/FreeBSD/NativeProcessFreeBSD.cpp
+++ b/lldb/source/Plugins/Process/FreeBSD/NativeProcessFreeBSD.cpp
@@ -751,7 +751,7 @@ Status NativeProcessFreeBSD::GetLoadedModuleFileSpec(const char *module_path,
   }
   return Status::FromErrorStringWithFormat(
       "Module file (%s) not found in process' memory map!",
-      module_file_spec.GetFilename().AsCString());
+      module_file_spec.GetFilename().AsCString(nullptr));
 }
 
 Status
diff --git a/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp b/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp
index fe8e56b527a61..98a419de1c9f6 100644
--- a/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp
+++ b/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp
@@ -1036,7 +1036,7 @@ Status NativeProcessLinux::Resume(const ResumeActionList &resume_actions) {
         return Status::FromErrorStringWithFormat(
             "NativeProcessLinux::%s: failed to resume thread "
             "for pid %" PRIu64 ", tid %" PRIu64 ", error = %s",
-            __FUNCTION__, GetID(), thread->GetID(), error.AsCString());
+            __FUNCTION__, GetID(), thread->GetID(), error.AsCString(nullptr));
 
       break;
     }
@@ -1776,7 +1776,7 @@ Status NativeProcessLinux::NotifyTracersOfNewThread(lldb::tid_t tid) {
   Status error = Status::FromError(m_intel_pt_collector.OnThreadCreated(tid));
   if (error.Fail())
     LLDB_LOG(log, "Failed to trace a new thread with intel-pt, tid = {0}. {1}",
-             tid, error.AsCString());
+             tid, error.AsCString(nullptr));
   return error;
 }
 
@@ -1786,7 +1786,7 @@ Status NativeProcessLinux::NotifyTracersOfThreadDestroyed(lldb::tid_t tid) {
   if (error.Fail())
     LLDB_LOG(log,
              "Failed to stop a destroyed thread with intel-pt, tid = {0}. {1}",
-             tid, error.AsCString());
+             tid, error.AsCString(nullptr));
   return error;
 }
 
@@ -1808,7 +1808,7 @@ NativeThreadLinux &NativeProcessLinux::AddThread(lldb::tid_t thread_id,
 
   Status tracing_error = NotifyTracersOfNewThread(thread.GetID());
   if (tracing_error.Fail()) {
-    thread.SetStoppedByProcessorTrace(tracing_error.AsCString());
+    thread.SetStoppedByProcessorTrace(tracing_error.AsCString(nullptr));
     StopRunningThreads(thread.GetID());
   } else if (resume)
     ResumeThread(thread, eStateRunning, LLDB_INVALID_SIGNAL_NUMBER);
@@ -1836,7 +1836,7 @@ Status NativeProcessLinux::GetLoadedModuleFileSpec(const char *module_path,
   }
   return Status::FromErrorStringWithFormat(
       "Module file (%s) not found in /proc/%" PRIu64 "/maps file!",
-      module_file_spec.GetFilename().AsCString(), GetID());
+      module_file_spec.GetFilename().AsCString(nullptr), GetID());
 }
 
 Status NativeProcessLinux::GetFileLoadAddress(const llvm::StringRef &file_name,
diff --git a/lldb/source/Plugins/Process/Linux/NativeThreadLinux.cpp b/lldb/source/Plugins/Process/Linux/NativeThreadLinux.cpp
index 96f54d63bc2a8..edafbaa878700 100644
--- a/lldb/source/Plugins/Process/Linux/NativeThreadLinux.cpp
+++ b/lldb/source/Plugins/Process/Linux/NativeThreadLinux.cpp
@@ -513,7 +513,7 @@ Status NativeThreadLinux::RequestStop() {
     LLDB_LOGF(log,
               "NativeThreadLinux::%s tgkill(%" PRIu64 ", %" PRIu64
               ", SIGSTOP) failed: %s",
-              __FUNCTION__, pid, tid, err.AsCString());
+              __FUNCTION__, pid, tid, err.AsCString(nullptr));
   }
 
   return err;
diff --git a/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp b/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
index e81a5dea193a2..6408d94e09e5c 100644
--- a/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
+++ b/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
@@ -916,7 +916,7 @@ class CommandObjectProcessKDPPacketSend : public CommandObjectParsed {
               result.SetStatus(eReturnStatusSuccessFinishResult);
               return;
             } else {
-              const char *error_cstr = error.AsCString();
+              const char *error_cstr = error.AsCString(nullptr);
               if (error_cstr && error_cstr[0])
                 result.AppendError(error_cstr);
               else
diff --git a/lldb/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp b/lldb/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp
index 8695019c85d46..b607269c53f5e 100644
--- a/lldb/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp
+++ b/lldb/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp
@@ -772,7 +772,7 @@ Status NativeProcessNetBSD::GetLoadedModuleFileSpec(const char *module_path,
   }
   return Status::FromErrorStringWithFormat(
       "Module file (%s) not found in process' memory map!",
-      module_file_spec.GetFilename().AsCString());
+      module_file_spec.GetFilename().AsCString(nullptr));
 }
 
 Status NativeProcessNetBSD::GetFileLoadAddress(const llvm::StringRef &file_name,
diff --git a/lldb/source/Plugins/Process/Utility/NativeRegisterContextDBReg_x86.cpp b/lldb/source/Plugins/Process/Utility/NativeRegisterContextDBReg_x86.cpp
index 3038cbcb72371..dfc0a7ba20ac4 100644
--- a/lldb/source/Plugins/Process/Utility/NativeRegisterContextDBReg_x86.cpp
+++ b/lldb/source/Plugins/Process/Utility/NativeRegisterContextDBReg_x86.cpp
@@ -254,7 +254,7 @@ uint32_t NativeRegisterContextDBReg_x86::SetHardwareWatchpoint(
     }
     if (error.Fail() && log) {
       LLDB_LOGF(log, "NativeRegisterContextDBReg_x86::%s Error: %s",
-                __FUNCTION__, error.AsCString());
+                __FUNCTION__, error.AsCString(nullptr));
     }
   }
   return LLDB_INVALID_INDEX32;
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp
index 5bd29ae40aa9e..eb69a7a4782bd 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp
@@ -107,7 +107,7 @@ GDBRemoteCommunicationServer::SendErrorResponse(const Status &error) {
   if (m_send_error_strings) {
     lldb_private::StreamString packet;
     packet.Printf("E%2.2x;", code);
-    packet.PutStringAsRawHex8(error.AsCString());
+    packet.PutStringAsRawHex8(error.AsCString(nullptr));
     return SendPacketNoLock(packet.GetString());
   }
   return SendErrorResponse(code);
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
index c8b0acfe59096..b85012cd0b95b 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
@@ -736,7 +736,7 @@ GetRegistersAsJSON(NativeThreadProtocol &thread) {
       LLDB_LOGF(log, "%s failed to read register '%s' index %" PRIu32 ": %s",
                 __FUNCTION__,
                 reg_info_p->name ? reg_info_p->name : "<unnamed-register>",
-                reg_num, error.AsCString());
+                reg_num, error.AsCString(nullptr));
       continue;
     }
 
@@ -964,7 +964,7 @@ GDBRemoteCommunicationServerLLGS::PrepareStopReplyPacketForThread(
         LLDB_LOGF(log, "%s failed to read register '%s' index %" PRIu32 ": %s",
                   __FUNCTION__,
                   reg_info_p->name ? reg_info_p->name : "<unnamed-register>",
-                  reg_to_read, error.AsCString());
+                  reg_to_read, error.AsCString(nullptr));
         continue;
       }
 
@@ -1004,7 +1004,7 @@ GDBRemoteCommunicationServerLLGS::PrepareStopReplyPacketForThread(
                   "register '%s' index %" PRIu32 ": %s",
                   __FUNCTION__,
                   reg_info_p->name ? reg_info_p->name : "<unnamed-register>",
-                  reg_num, error.AsCString());
+                  reg_num, error.AsCString(nullptr));
       }
     }
   }
@@ -1221,7 +1221,7 @@ void GDBRemoteCommunicationServerLLGS::DataAvailableCallback() {
       LLDB_LOGF(log,
                 "GDBRemoteCommunicationServerLLGS::%s processing a packet "
                 "failed: %s",
-                __FUNCTION__, error.AsCString());
+                __FUNCTION__, error.AsCString(nullptr));
       m_mainloop.RequestTermination();
       break;
     }
@@ -1337,7 +1337,7 @@ void GDBRemoteCommunicationServerLLGS::SendProcessOutput() {
                   "GDBRemoteCommunicationServerLLGS::%s Stopping stdio "
                   "forwarding as communication returned status %d (error: "
                   "%s)",
-                  __FUNCTION__, status, error.AsCString());
+                  __FUNCTION__, status, error.AsCString(nullptr));
       m_stdio_handle_up.reset();
       return;
 
@@ -2304,7 +2304,8 @@ GDBRemoteCommunicationServerLLGS::Handle_p(StringExtractorGDBRemote &packet) {
     LLDB_LOGF(log,
               "GDBRemoteCommunicationServerLLGS::%s failed, read of "
               "requested register %" PRIu32 " (%s) failed: %s",
-              __FUNCTION__, reg_index, reg_info->name, error.AsCString());
+              __FUNCTION__, reg_index, reg_info->name,
+              error.AsCString(nullptr));
     return SendErrorResponse(0x15);
   }
 
@@ -2397,7 +2398,8 @@ GDBRemoteCommunicationServerLLGS::Handle_P(StringExtractorGDBRemote &packet) {
     LLDB_LOGF(log,
               "GDBRemoteCommunicationServerLLGS::%s failed, write of "
               "requested register %" PRIu32 " (%s) failed: %s",
-              __FUNCTION__, reg_index, reg_info->name, error.AsCString());
+              __FUNCTION__, reg_index, reg_info->name,
+              error.AsCString(nullptr));
     return SendErrorResponse(0x32);
   }
 
@@ -2848,7 +2850,7 @@ GDBRemoteCommunicationServerLLGS::Handle_qMemoryRegionInfo(
     // Return the error message.
 
     response.PutCString("error:");
-    response.PutStringAsRawHex8(error.AsCString());
+    response.PutStringAsRawHex8(error.AsCString(nullptr));
     response.PutChar(';');
   } else {
     // Range start and size.
@@ -3511,7 +3513,7 @@ GDBRemoteCommunicationServerLLGS::Handle_vAttach(
     LLDB_LOGF(log,
               "GDBRemoteCommunicationServerLLGS::%s failed to attach to "
               "pid %" PRIu64 ": %s\n",
-              __FUNCTION__, pid, error.AsCString());
+              __FUNCTION__, pid, error.AsCString(nullptr));
     return SendErrorResponse(error);
   }
 
@@ -4165,7 +4167,7 @@ void GDBRemoteCommunicationServerLLGS::MaybeCloseInferiorTerminalConnection() {
         LLDB_LOGF(log,
                   "GDBRemoteCommunicationServerLLGS::%s disconnect process "
                   "terminal stdio - FAIL: %s",
-                  __FUNCTION__, error.AsCString());
+                  __FUNCTION__, error.AsCString(nullptr));
       }
     }
   }
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
index 5876c3a9434a1..0acff955e2ede 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
@@ -140,7 +140,7 @@ Status GDBRemoteCommunicationServerPlatform::LaunchGDBServer(
     LLDB_LOGF(log,
               "GDBRemoteCommunicationServerPlatform::%s() "
               "debugserver launch failed: %s",
-              __FUNCTION__, error.AsCString());
+              __FUNCTION__, error.AsCString(nullptr));
   }
   return error;
 }
diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
index 631bda1d24537..f618af15b4a85 100644
--- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -840,7 +840,7 @@ Status ProcessGDBRemote::DoLaunch(lldb_private::Module *exe_module,
 
     if (GetID() == LLDB_INVALID_PROCESS_ID) {
       LLDB_LOGF(log, "failed to connect to debugserver: %s",
-                error.AsCString());
+                error.AsCString(nullptr));
       KillDebugserverProcess();
       return error;
     }
@@ -867,7 +867,8 @@ Status ProcessGDBRemote::DoLaunch(lldb_private::Module *exe_module,
       }
     }
   } else {
-    LLDB_LOGF(log, "failed to connect to debugserver: %s", error.AsCString());
+    LLDB_LOGF(log, "failed to connect to debugserver: %s",
+              error.AsCString(nullptr));
   }
   return error;
 }
@@ -1162,7 +1163,7 @@ Status ProcessGDBRemote::DoAttachToProcessWithID(
           std::make_shared<EventDataBytes>(llvm::StringRef(packet, packet_len));
       m_async_broadcaster.BroadcastEvent(eBroadcastBitAsyncContinue, data_sp);
     } else
-      SetExitStatus(-1, error.AsCString());
+      SetExitStatus(-1, error.AsCString(nullptr));
   }
 
   return error;
@@ -1201,7 +1202,7 @@ Status ProcessGDBRemote::DoAttachToProcessWithName(
       m_async_broadcaster.BroadcastEvent(eBroadcastBitAsyncContinue, data_sp);
 
     } else
-      SetExitStatus(-1, error.AsCString());
+      SetExitStatus(-1, error.AsCString(nullptr));
   }
   return error;
 }
@@ -2569,7 +2570,8 @@ Status ProcessGDBRemote::DoDetach(bool keep_stopped) {
     else
       LLDB_LOGF(log,
                 "ProcessGDBRemote::DoDetach() detach packet send failed: %s",
-                error.AsCString() ? error.AsCString() : "<unknown error>");
+                error.AsCString(nullptr) ? error.AsCString(nullptr)
+                                         : "<unknown error>");
   }
 
   if (!error.Success())
@@ -3642,7 +3644,7 @@ ProcessGDBRemote::EstablishConnectionIfNeeded(const ProcessInfo &process_info) {
 
   auto error = LaunchAndConnectToDebugserver(process_info);
   if (error.Fail()) {
-    const char *error_string = error.AsCString();
+    const char *error_string = error.AsCString(nullptr);
     if (error_string == nullptr)
       error_string = "unable to launch " DEBUGSERVER_BASENAME;
   }
@@ -3755,7 +3757,7 @@ Status ProcessGDBRemote::LaunchAndConnectToDebugserver(
     Log *log = GetLog(GDBRLog::Process);
 
     LLDB_LOGF(log, "failed to start debugserver process: %s",
-              error.AsCString());
+              error.AsCString(nullptr));
     return error;
   }
 
@@ -4009,7 +4011,7 @@ thread_result_t ProcessGDBRemote::AsyncThread() {
                                   "System Integrity Protection");
               } else if (::strstr(continue_cstr, "vAttach") != nullptr &&
                          response.GetStatus().Fail()) {
-                SetExitStatus(-1, response.GetStatus().AsCString());
+                SetExitStatus(-1, response.GetStatus().AsCString(nullptr));
               } else {
                 SetExitStatus(-1, "lost connection");
               }
@@ -4986,7 +4988,7 @@ bool ParseRegisters(
                         "register %s does not match the register size (%d "
                         "bytes). Ignoring this set of flags.",
                         flags_type->GetID().c_str(), flags_type->GetSize(),
-                        reg_info.name.AsCString(), reg_info.byte_size);
+                        reg_info.name.AsCString(nullptr), reg_info.byte_size);
           }
 
           // There's a slim chance that the gdb_type name is both a flags type
@@ -5041,7 +5043,7 @@ bool ParseRegisters(
         if (reg_info.byte_size == 0) {
           LLDB_LOGF(log,
                     "ProcessGDBRemote::%s Skipping zero bitsize register %s",
-                    __FUNCTION__, reg_info.name.AsCString());
+                    __FUNCTION__, reg_info.name.AsCString(nullptr));
         } else
           registers.push_back(reg_info);
 
@@ -6137,7 +6139,8 @@ void ProcessGDBRemote::DidFork(lldb::pid_t child_pid, lldb::tid_t child_tid) {
   Status error = m_gdb_comm.Detach(false, detach_pid);
   if (error.Fail()) {
     LLDB_LOG(log, "ProcessGDBRemote::DidFork() detach packet send failed: {0}",
-             error.AsCString() ? error.AsCString() : "<unknown error>");
+             error.AsCString(nullptr) ? error.AsCString(nullptr)
+                                      : "<unknown error>");
     return;
   }
 
@@ -6198,10 +6201,10 @@ void ProcessGDBRemote::DidVFork(lldb::pid_t child_pid, lldb::tid_t child_tid) {
   LLDB_LOG(log, "Detaching process {0}", detach_pid);
   Status error = m_gdb_comm.Detach(false, detach_pid);
   if (error.Fail()) {
-      LLDB_LOG(log,
-               "ProcessGDBRemote::DidFork() detach packet send failed: {0}",
-                error.AsCString() ? error.AsCString() : "<unknown error>");
-      return;
+    LLDB_LOG(log, "ProcessGDBRemote::DidFork() detach packet send failed: {0}",
+             error.AsCString(nullptr) ? error.AsCString(nullptr)
+                                      : "<unknown error>");
+    return;
   }
 
   if (GetFollowForkMode() == eFollowChild) {
diff --git a/lldb/source/Plugins/Process/mach-core/RegisterContextUnifiedCore.cpp b/lldb/source/Plugins/Process/mach-core/RegisterContextUnifiedCore.cpp
index 449f85bc3f52a..7f908d2b265d0 100644
--- a/lldb/source/Plugins/Process/mach-core/RegisterContextUnifiedCore.cpp
+++ b/lldb/source/Plugins/Process/mach-core/RegisterContextUnifiedCore.cpp
@@ -151,9 +151,9 @@ RegisterContextUnifiedCore::RegisterContextUnifiedCore(
   // Put the RegisterSet names in the constant string pool,
   // to sidestep lifetime issues of char*'s.
   auto copy_regset_name = [](RegisterSet &dst, const RegisterSet &src) {
-    dst.name = ConstString(src.name).AsCString();
+    dst.name = ConstString(src.name).AsCString(nullptr);
     if (src.short_name)
-      dst.short_name = ConstString(src.short_name).AsCString();
+      dst.short_name = ConstString(src.short_name).AsCString(nullptr);
     else
       dst.short_name = nullptr;
   };
diff --git a/lldb/source/Plugins/Process/scripted/ScriptedFrame.cpp b/lldb/source/Plugins/Process/scripted/ScriptedFrame.cpp
index 54b65dcaed873..2b1d229487f23 100644
--- a/lldb/source/Plugins/Process/scripted/ScriptedFrame.cpp
+++ b/lldb/source/Plugins/Process/scripted/ScriptedFrame.cpp
@@ -144,7 +144,7 @@ const char *ScriptedFrame::GetFunctionName() {
   std::optional<std::string> function_name = GetInterface()->GetFunctionName();
   if (!function_name)
     return StackFrame::GetFunctionName();
-  return ConstString(function_name->c_str()).AsCString();
+  return ConstString(function_name->c_str()).AsCString(nullptr);
 }
 
 const char *ScriptedFrame::GetDisplayFunctionName() {
@@ -153,7 +153,7 @@ const char *ScriptedFrame::GetDisplayFunctionName() {
       GetInterface()->GetDisplayFunctionName();
   if (!function_name)
     return StackFrame::GetDisplayFunctionName();
-  return ConstString(function_name->c_str()).AsCString();
+  return ConstString(function_name->c_str()).AsCString(nullptr);
 }
 
 bool ScriptedFrame::IsInlined() { return GetInterface()->IsInlined(); }
@@ -311,7 +311,8 @@ lldb::ValueObjectSP ScriptedFrame::GetValueObjectForFrameVariable(
   if (!values)
     return {};
 
-  return values->FindValueObjectByValueName(variable_sp->GetName().AsCString());
+  return values->FindValueObjectByValueName(
+      variable_sp->GetName().AsCString(nullptr));
 }
 
 lldb::ValueObjectSP ScriptedFrame::GetValueForVariableExpressionPath(
diff --git a/lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp b/lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp
index b1327964bb69a..71baefaef4c60 100644
--- a/lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp
+++ b/lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp
@@ -62,7 +62,7 @@ lldb::ProcessSP ScriptedProcess::CreateInstance(lldb::TargetSP target_sp,
       new ScriptedProcess(target_sp, listener_sp, scripted_metadata, error));
 
   if (error.Fail() || !process_sp || !process_sp->m_interface_up) {
-    LLDB_LOGF(GetLog(LLDBLog::Process), "%s", error.AsCString());
+    LLDB_LOGF(GetLog(LLDBLog::Process), "%s", error.AsCString(nullptr));
     return nullptr;
   }
 
diff --git a/lldb/source/Plugins/Process/scripted/ScriptedThread.cpp b/lldb/source/Plugins/Process/scripted/ScriptedThread.cpp
index 1dd9c48f56a59..391137571ab1e 100644
--- a/lldb/source/Plugins/Process/scripted/ScriptedThread.cpp
+++ b/lldb/source/Plugins/Process/scripted/ScriptedThread.cpp
@@ -94,7 +94,7 @@ const char *ScriptedThread::GetName() {
   std::optional<std::string> thread_name = GetInterface()->GetName();
   if (!thread_name)
     return nullptr;
-  return ConstString(thread_name->c_str()).AsCString();
+  return ConstString(thread_name->c_str()).AsCString(nullptr);
 }
 
 const char *ScriptedThread::GetQueueName() {
@@ -102,7 +102,7 @@ const char *ScriptedThread::GetQueueName() {
   std::optional<std::string> queue_name = GetInterface()->GetQueue();
   if (!queue_name)
     return nullptr;
-  return ConstString(queue_name->c_str()).AsCString();
+  return ConstString(queue_name->c_str()).AsCString(nullptr);
 }
 
 void ScriptedThread::WillResume(StateType resume_state) {}
diff --git a/lldb/source/Plugins/ScriptInterpreter/Lua/ScriptInterpreterLua.cpp b/lldb/source/Plugins/ScriptInterpreter/Lua/ScriptInterpreterLua.cpp
index 00b580bb0474f..fee9ad26ee0dc 100644
--- a/lldb/source/Plugins/ScriptInterpreter/Lua/ScriptInterpreterLua.cpp
+++ b/lldb/source/Plugins/ScriptInterpreter/Lua/ScriptInterpreterLua.cpp
@@ -121,7 +121,7 @@ class IOHandlerLuaInterpreter : public IOHandlerDelegate,
         if (error.Fail()) {
           LockedStreamFile locked_stream =
               io_handler.GetErrorStreamFileSP()->Lock();
-          locked_stream << error.AsCString() << '\n';
+          locked_stream << error.AsCString(nullptr) << '\n';
         }
       }
       io_handler.SetIsDone(true);
diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedFramePythonInterface.cpp b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedFramePythonInterface.cpp
index b8613578bdbd1..23429ff0a23f9 100644
--- a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedFramePythonInterface.cpp
+++ b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedFramePythonInterface.cpp
@@ -67,7 +67,7 @@ std::optional<SymbolContext> ScriptedFramePythonInterface::GetSymbolContext() {
 
   if (error.Fail()) {
     return ErrorWithMessage<SymbolContext>(LLVM_PRETTY_FUNCTION,
-                                           error.AsCString(), error);
+                                           error.AsCString(nullptr), error);
   }
 
   return sym_ctx;
@@ -157,8 +157,8 @@ lldb::ValueObjectListSP ScriptedFramePythonInterface::GetVariables() {
   auto vals = Dispatch<lldb::ValueObjectListSP>("get_variables", error);
 
   if (error.Fail()) {
-    return ErrorWithMessage<lldb::ValueObjectListSP>(LLVM_PRETTY_FUNCTION,
-                                                     error.AsCString(), error);
+    return ErrorWithMessage<lldb::ValueObjectListSP>(
+        LLVM_PRETTY_FUNCTION, error.AsCString(nullptr), error);
   }
 
   return vals;
@@ -174,7 +174,8 @@ ScriptedFramePythonInterface::GetValueObjectForVariableExpression(
 
   if (dispatch_error.Fail()) {
     return ErrorWithMessage<lldb::ValueObjectSP>(
-        LLVM_PRETTY_FUNCTION, dispatch_error.AsCString(), dispatch_error);
+        LLVM_PRETTY_FUNCTION, dispatch_error.AsCString(nullptr),
+        dispatch_error);
   }
 
   return val;
diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPlatformPythonInterface.cpp b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPlatformPythonInterface.cpp
index 8b7f84c5af037..dda768834b2fb 100644
--- a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPlatformPythonInterface.cpp
+++ b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPlatformPythonInterface.cpp
@@ -50,7 +50,7 @@ StructuredData::DictionarySP ScriptedPlatformPythonInterface::ListProcesses() {
     return ScriptedInterface::ErrorWithMessage<StructuredData::DictionarySP>(
         LLVM_PRETTY_FUNCTION,
         llvm::Twine("Null or invalid object (" +
-                    llvm::Twine(error.AsCString()) + llvm::Twine(")."))
+                    llvm::Twine(error.AsCString(nullptr)) + llvm::Twine(")."))
             .str(),
         error);
   }
@@ -68,7 +68,7 @@ ScriptedPlatformPythonInterface::GetProcessInfo(lldb::pid_t pid) {
     return ScriptedInterface::ErrorWithMessage<StructuredData::DictionarySP>(
         LLVM_PRETTY_FUNCTION,
         llvm::Twine("Null or invalid object (" +
-                    llvm::Twine(error.AsCString()) + llvm::Twine(")."))
+                    llvm::Twine(error.AsCString(nullptr)) + llvm::Twine(")."))
             .str(),
         error);
   }
diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedProcessPythonInterface.cpp b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedProcessPythonInterface.cpp
index b99bf9f627310..b84b62c007ed5 100644
--- a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedProcessPythonInterface.cpp
+++ b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedProcessPythonInterface.cpp
@@ -82,7 +82,7 @@ ScriptedProcessPythonInterface::GetMemoryRegionContainingAddress(
 
   if (error.Fail()) {
     return ErrorWithMessage<MemoryRegionInfo>(LLVM_PRETTY_FUNCTION,
-                                              error.AsCString(), error);
+                                              error.AsCString(nullptr), error);
   }
 
   return mem_region;
diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPythonInterface.h b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPythonInterface.h
index 10c176a25cbd9..bdee0f105f3ab 100644
--- a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPythonInterface.h
+++ b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPythonInterface.h
@@ -375,7 +375,7 @@ class ScriptedPythonInterface : virtual public ScriptedInterface {
     if (abstract_method_errors) {
       Status error = Status::FromError(std::move(abstract_method_errors));
       LLDB_LOG(log, "Abstract method error in {0}:\n{1}", class_name,
-               error.AsCString());
+               error.AsCString(nullptr));
       return error.ToError();
     }
 
diff --git a/lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp b/lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp
index 9cc43f38dadfc..18786d82db3b8 100644
--- a/lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp
+++ b/lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp
@@ -830,7 +830,7 @@ class EnableCommand : public CommandObjectParsed {
 
     // Report results.
     if (!error.Success()) {
-      result.AppendError(error.AsCString());
+      result.AppendError(error.AsCString(nullptr));
       // Our configuration failed, so we're definitely disabled.
       plugin.SetEnabled(false);
     } else {
@@ -1842,7 +1842,8 @@ void StructuredDataDarwinLog::EnableNow() {
               "StructuredDataDarwinLog::%s() "
               "ConfigureStructuredData() call failed "
               "(process uid %u): %s",
-              __FUNCTION__, process_sp->GetUniqueID(), error.AsCString());
+              __FUNCTION__, process_sp->GetUniqueID(),
+              error.AsCString(nullptr));
     Debugger::ReportError("failed to configure DarwinLog support",
                           debugger_sp->GetID());
     m_is_enabled = false;
diff --git a/lldb/source/Plugins/SymbolFile/CTF/SymbolFileCTF.cpp b/lldb/source/Plugins/SymbolFile/CTF/SymbolFileCTF.cpp
index 09251e2f57e1c..d446c23fc0f97 100644
--- a/lldb/source/Plugins/SymbolFile/CTF/SymbolFileCTF.cpp
+++ b/lldb/source/Plugins/SymbolFile/CTF/SymbolFileCTF.cpp
@@ -902,9 +902,10 @@ size_t SymbolFileCTF::ParseObjects(CompileUnit &comp_unit) {
 
       lldb::user_id_t variable_type_uid = m_variables.size();
       m_variables.emplace_back(std::make_shared<Variable>(
-          variable_type_uid, symbol->GetName().AsCString(),
-          symbol->GetName().AsCString(), type_sp, eValueTypeVariableGlobal,
-          m_comp_unit_sp.get(), ranges, &decl, location, symbol->IsExternal(),
+          variable_type_uid, symbol->GetName().AsCString(nullptr),
+          symbol->GetName().AsCString(nullptr), type_sp,
+          eValueTypeVariableGlobal, m_comp_unit_sp.get(), ranges, &decl,
+          location, symbol->IsExternal(),
           /*artificial=*/false,
           /*location_is_constant_data*/ false));
     }
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
index cb33fc21bfba9..06f9f615ae276 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -495,11 +495,11 @@ ParsedDWARFTypeAttributes::ParsedDWARFTypeAttributes(const DWARFDIE &die) {
 
     case DW_AT_linkage_name:
     case DW_AT_MIPS_linkage_name:
-      mangled_name = form_value.AsCString();
+      mangled_name = form_value.AsCString(nullptr);
       break;
 
     case DW_AT_name:
-      name.SetCString(form_value.AsCString());
+      name.SetCString(form_value.AsCString(nullptr));
       break;
 
     case DW_AT_signature:
@@ -1767,7 +1767,7 @@ TypeSP DWARFASTParserClang::ParseStructureLikeDIE(
       dwarf->GetObjectFile()->GetModule()->LogMessage(
           log, "SymbolFileDWARF({0:p}) - {1:x16}: {2} has unique name: {3} ",
           static_cast<void *>(this), die.GetID(), DW_TAG_value_to_name(tag),
-          unique_typename.AsCString());
+          unique_typename.AsCString(nullptr));
     }
     if (UniqueDWARFASTType *unique_ast_entry_type =
             dwarf->GetUniqueDWARFASTTypeMap().Find(
@@ -2073,12 +2073,12 @@ bool DWARFASTParserClang::ParseTemplateDIE(
       switch (attr) {
       case DW_AT_name:
         if (attributes.ExtractFormValueAtIndex(i, form_value))
-          name = form_value.AsCString();
+          name = form_value.AsCString(nullptr);
         break;
 
       case DW_AT_GNU_template_name:
         if (attributes.ExtractFormValueAtIndex(i, form_value))
-          template_name = form_value.AsCString();
+          template_name = form_value.AsCString(nullptr);
         break;
 
       case DW_AT_type:
@@ -2390,7 +2390,7 @@ size_t DWARFASTParserClang::ParseChildEnumerators(
           break;
 
         case DW_AT_name:
-          name = form_value.AsCString();
+          name = form_value.AsCString(nullptr);
           break;
 
         case DW_AT_description:
@@ -2609,7 +2609,7 @@ VariantMember::VariantMember(DWARFDIE &die, lldb::ModuleSP module_sp) {
         if (attributes.ExtractFormValueAtIndex(i, form_value)) {
           switch (attr) {
           case DW_AT_name:
-            variant_name = ConstString(form_value.AsCString());
+            variant_name = ConstString(form_value.AsCString(nullptr));
             break;
           case DW_AT_type:
             type_ref = form_value;
@@ -2682,7 +2682,7 @@ DWARFASTParserClang::MemberAttributes::MemberAttributes(
     if (attributes.ExtractFormValueAtIndex(i, form_value)) {
       switch (attr) {
       case DW_AT_name:
-        name = form_value.AsCString();
+        name = form_value.AsCString(nullptr);
         break;
       case DW_AT_type:
         encoding_form = form_value;
@@ -2747,13 +2747,13 @@ PropertyAttributes::PropertyAttributes(const DWARFDIE &die) {
     if (attributes.ExtractFormValueAtIndex(i, form_value)) {
       switch (attr) {
       case DW_AT_APPLE_property_name:
-        prop_name = form_value.AsCString();
+        prop_name = form_value.AsCString(nullptr);
         break;
       case DW_AT_APPLE_property_getter:
-        prop_getter_name = form_value.AsCString();
+        prop_getter_name = form_value.AsCString(nullptr);
         break;
       case DW_AT_APPLE_property_setter:
-        prop_setter_name = form_value.AsCString();
+        prop_setter_name = form_value.AsCString(nullptr);
         break;
       case DW_AT_APPLE_property_attribute:
         prop_attributes = form_value.Unsigned();
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
index 849f5738b62d7..33a46473b1605 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
@@ -175,13 +175,13 @@ bool DWARFDebugInfoEntry::GetDIENamesAndRanges(
 
         case DW_AT_name:
           if (name == nullptr)
-            name = form_value.AsCString();
+            name = form_value.AsCString(nullptr);
           break;
 
         case DW_AT_MIPS_linkage_name:
         case DW_AT_linkage_name:
           if (mangled == nullptr)
-            mangled = form_value.AsCString();
+            mangled = form_value.AsCString(nullptr);
           break;
 
         case DW_AT_abstract_origin:
@@ -443,7 +443,7 @@ const char *DWARFDebugInfoEntry::GetAttributeValueAsString(
     bool check_elaborating_dies) const {
   DWARFFormValue form_value;
   if (GetAttributeValue(cu, attr, form_value, nullptr, check_elaborating_dies))
-    return form_value.AsCString();
+    return form_value.AsCString(nullptr);
   return fail_value;
 }
 
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp b/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
index 36dee1470e0a2..2f26c78f7ca3c 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
@@ -256,7 +256,7 @@ void ManualDWARFIndex::IndexUnitImpl(DWARFUnit &unit,
         break;
       case DW_AT_name:
         if (attributes.ExtractFormValueAtIndex(i, form_value))
-          name = form_value.AsCString();
+          name = form_value.AsCString(nullptr);
         break;
 
       case DW_AT_declaration:
@@ -267,7 +267,7 @@ void ManualDWARFIndex::IndexUnitImpl(DWARFUnit &unit,
       case DW_AT_MIPS_linkage_name:
       case DW_AT_linkage_name:
         if (attributes.ExtractFormValueAtIndex(i, form_value))
-          mangled_cstr = form_value.AsCString();
+          mangled_cstr = form_value.AsCString(nullptr);
         break;
 
       case DW_AT_low_pc:
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
index 650f227d52827..607d29fce6d97 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -1619,7 +1619,7 @@ bool SymbolFileDWARF::CompleteType(CompilerType &compiler_type) {
     GetObjectFile()->GetModule()->LogMessageVerboseBacktrace(
         log, "{0:x8}: {1} ({2}) '{3}' resolving forward declaration...",
         def_die.GetID(), DW_TAG_value_to_name(def_die.Tag()), def_die.Tag(),
-        type->GetName().AsCString());
+        type->GetName().AsCString(nullptr));
   assert(compiler_type);
   return dwarf_ast->CompleteTypeFromDWARF(def_die, type, compiler_type);
 }
@@ -3510,7 +3510,7 @@ GetExprListFromAtConstValue(DWARFFormValue form_value, ModuleSP module,
         module, DataExtractor(debug_info_data, block_offset, block_length),
         die.GetCU());
   }
-  if (const char *str = form_value.AsCString())
+  if (const char *str = form_value.AsCString(nullptr))
     return DWARFExpressionList(module,
                                DataExtractor(str, strlen(str) + 1,
                                              die.GetCU()->GetByteOrder(),
@@ -3599,11 +3599,11 @@ VariableSP SymbolFileDWARF::ParseVariableDIE(const SymbolContext &sc,
       decl.SetColumn(form_value.Unsigned());
       break;
     case DW_AT_name:
-      name = form_value.AsCString();
+      name = form_value.AsCString(nullptr);
       break;
     case DW_AT_linkage_name:
     case DW_AT_MIPS_linkage_name:
-      mangled = form_value.AsCString();
+      mangled = form_value.AsCString(nullptr);
       break;
     case DW_AT_type:
       // DW_AT_type on declaration may be less accurate than
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
index fd2da1ea46fec..90ec28db15505 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
@@ -345,8 +345,8 @@ void SymbolFileDWARFDebugMap::InitOSO() {
     if (so_symbol && oso_symbol &&
         so_symbol->GetType() == eSymbolTypeSourceFile &&
         oso_symbol->GetType() == eSymbolTypeObjectFile) {
-      m_compile_unit_infos[i].so_file.SetFile(so_symbol->GetName().AsCString(),
-                                              FileSpec::Style::native);
+      m_compile_unit_infos[i].so_file.SetFile(
+          so_symbol->GetName().AsCString(nullptr), FileSpec::Style::native);
       m_compile_unit_infos[i].oso_path = oso_symbol->GetName();
       m_compile_unit_infos[i].oso_mod_time =
           llvm::sys::toTimePoint(oso_symbol->GetIntegerValue(0));
@@ -437,7 +437,7 @@ Module *SymbolFileDWARFDebugMap::GetModuleByCompUnitInfo(
               (uint32_t)llvm::sys::toTimeT(oso_mod_time),
               (uint32_t)llvm::sys::toTimeT(comp_unit_info->oso_mod_time));
           obj_file->GetModule()->ReportError(
-              "{0}", comp_unit_info->oso_load_error.AsCString());
+              "{0}", comp_unit_info->oso_load_error.AsCString(nullptr));
           return nullptr;
         }
 
@@ -482,7 +482,7 @@ Module *SymbolFileDWARFDebugMap::GetModuleByCompUnitInfo(
             "\"%s\" object from the \"%s\" archive: "
             "either the .o file doesn't exist in the archive or the "
             "modification time (0x%8.8x) of the .o file doesn't match",
-            oso_object.AsCString(), oso_file.GetPath().c_str(),
+            oso_object.AsCString(nullptr), oso_file.GetPath().c_str(),
             (uint32_t)llvm::sys::toTimeT(comp_unit_info->oso_mod_time));
       }
     }
@@ -1312,7 +1312,7 @@ bool SymbolFileDWARFDebugMap::GetSeparateDebugInfo(
       }
     }
     if (!loaded_successfully) {
-      oso_data->AddStringItem("error", info.oso_load_error.AsCString());
+      oso_data->AddStringItem("error", info.oso_load_error.AsCString(nullptr));
     }
     oso_data->AddBooleanItem("loaded", loaded_successfully);
     if (!errors_only || oso_data->HasKey("error"))
diff --git a/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp b/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
index 26b89eaefd37a..e6981fd975118 100644
--- a/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
+++ b/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
@@ -1761,7 +1761,8 @@ SymbolFilePDB::FindNamespace(lldb_private::ConstString name,
       GetTypeSystemForLanguage(lldb::eLanguageTypeC_plus_plus);
   if (auto err = type_system_or_err.takeError()) {
     LLDB_LOG_ERROR(GetLog(LLDBLog::Symbols), std::move(err),
-                   "Unable to find namespace {1}: {0}", name.AsCString());
+                   "Unable to find namespace {1}: {0}",
+                   name.AsCString(nullptr));
     return CompilerDeclContext();
   }
   auto ts = *type_system_or_err;
diff --git a/lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp b/lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp
index 4cd46440b10bd..9c298374101fa 100644
--- a/lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp
+++ b/lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp
@@ -120,9 +120,10 @@ CompUnitSP SymbolFileSymtab::ParseCompileUnitAtIndex(uint32_t idx) {
     const Symbol *cu_symbol =
         m_objfile_sp->GetSymtab()->SymbolAtIndex(m_source_indexes[idx]);
     if (cu_symbol)
-      cu_sp = std::make_shared<CompileUnit>(m_objfile_sp->GetModule(), nullptr,
-                                            cu_symbol->GetName().AsCString(), 0,
-                                            eLanguageTypeUnknown, eLazyBoolNo);
+      cu_sp =
+          std::make_shared<CompileUnit>(m_objfile_sp->GetModule(), nullptr,
+                                        cu_symbol->GetName().AsCString(nullptr),
+                                        0, eLanguageTypeUnknown, eLazyBoolNo);
   }
   return cu_sp;
 }
diff --git a/lldb/source/Plugins/SymbolLocator/DebugSymbols/SymbolLocatorDebugSymbols.cpp b/lldb/source/Plugins/SymbolLocator/DebugSymbols/SymbolLocatorDebugSymbols.cpp
index 3947036538f20..6613f14ba5808 100644
--- a/lldb/source/Plugins/SymbolLocator/DebugSymbols/SymbolLocatorDebugSymbols.cpp
+++ b/lldb/source/Plugins/SymbolLocator/DebugSymbols/SymbolLocatorDebugSymbols.cpp
@@ -401,7 +401,7 @@ static bool LookForDsymNextToExecutablePath(const ModuleSpec &mod_spec,
   FileSpec dsym_directory = exec_fspec;
   dsym_directory.RemoveLastPathComponent();
 
-  std::string dsym_filename = filename.AsCString();
+  std::string dsym_filename = filename.AsCString(nullptr);
   dsym_filename += ".dSYM";
   dsym_directory.AppendPathComponent(dsym_filename);
   dsym_directory.AppendPathComponent("Contents");
@@ -413,7 +413,7 @@ static bool LookForDsymNextToExecutablePath(const ModuleSpec &mod_spec,
     // See if the binary name exists in the dSYM DWARF
     // subdir.
     dsym_fspec = dsym_directory;
-    dsym_fspec.AppendPathComponent(filename.AsCString());
+    dsym_fspec.AppendPathComponent(filename.AsCString(nullptr));
     if (FileSystem::Instance().Exists(dsym_fspec) &&
         FileAtPathContainsArchAndUUID(dsym_fspec, mod_spec.GetArchitecturePtr(),
                                       mod_spec.GetUUIDPtr())) {
@@ -424,7 +424,7 @@ static bool LookForDsymNextToExecutablePath(const ModuleSpec &mod_spec,
     // CF.framework.dSYM/Contents/Resources/DWARF/CF
     // We need to drop the last suffix after '.' to match
     // 'CF' in the DWARF subdir.
-    std::string binary_name(filename.AsCString());
+    std::string binary_name(filename.AsCString(nullptr));
     auto last_dot = binary_name.find_last_of('.');
     if (last_dot != std::string::npos) {
       binary_name.erase(last_dot);
@@ -442,7 +442,7 @@ static bool LookForDsymNextToExecutablePath(const ModuleSpec &mod_spec,
   // See if we have a .dSYM.yaa next to this executable path.
   FileSpec dsym_yaa_fspec = exec_fspec;
   dsym_yaa_fspec.RemoveLastPathComponent();
-  std::string dsym_yaa_filename = filename.AsCString();
+  std::string dsym_yaa_filename = filename.AsCString(nullptr);
   dsym_yaa_filename += ".dSYM.yaa";
   dsym_yaa_fspec.AppendPathComponent(dsym_yaa_filename);
 
@@ -502,7 +502,7 @@ static bool LocateDSYMInVincinityOfExecutable(const ModuleSpec &module_spec,
       for (int i = 0; i < 4; i++) {
         // Does this part of the path have a "." character - could it be a
         // bundle's top level directory?
-        const char *fn = parent_dirs.GetFilename().AsCString();
+        const char *fn = parent_dirs.GetFilename().AsCString(nullptr);
         if (fn == nullptr)
           break;
         if (::strchr(fn, '.') != nullptr) {
@@ -1101,7 +1101,7 @@ bool SymbolLocatorDebugSymbols::DownloadObjectAndSymbolFile(
     LLDB_LOGF(log,
               "'%s' failed (exit status: %d, error: '%s', stdout: '%s', "
               "stderr: '%s')",
-              command.GetData(), exit_status, error.AsCString(),
+              command.GetData(), exit_status, error.AsCString(nullptr),
               command_output.c_str(), error_output.c_str());
     return false;
   }
diff --git a/lldb/source/Plugins/SymbolLocator/Default/SymbolLocatorDefault.cpp b/lldb/source/Plugins/SymbolLocator/Default/SymbolLocatorDefault.cpp
index 096510215cfa2..1dec6061a0e34 100644
--- a/lldb/source/Plugins/SymbolLocator/Default/SymbolLocatorDefault.cpp
+++ b/lldb/source/Plugins/SymbolLocator/Default/SymbolLocatorDefault.cpp
@@ -201,7 +201,7 @@ std::optional<FileSpec> SymbolLocatorDefault::LocateExecutableSymbolFile(
       // Some debug files may stored in the module directory like this:
       //   /usr/lib/debug/usr/lib/library.so.debug
       if (!file_dir.IsEmpty())
-        files.push_back(dirname + file_dir.AsCString() + "/" +
+        files.push_back(dirname + file_dir.AsCString(nullptr) + "/" +
                         symbol_file_spec.GetFilename().GetCString());
     }
 
diff --git a/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetItemInfoHandler.cpp b/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetItemInfoHandler.cpp
index 0ecca0aa697d4..71998c44df231 100644
--- a/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetItemInfoHandler.cpp
+++ b/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetItemInfoHandler.cpp
@@ -179,7 +179,7 @@ lldb::addr_t AppleGetItemInfoHandler::SetupGetItemInfoFunction(
           thread.shared_from_this(), error);
       if (error.Fail() || get_item_info_caller == nullptr) {
         LLDB_LOGF(log, "Error inserting get-item-info function: \"%s\".",
-                  error.AsCString());
+                  error.AsCString(nullptr));
         return args_addr;
       }
     } else {
diff --git a/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.cpp b/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.cpp
index 5db2dbd82d470..55294a99f762b 100644
--- a/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.cpp
+++ b/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.cpp
@@ -176,7 +176,7 @@ lldb::addr_t AppleGetPendingItemsHandler::SetupGetPendingItemsFunction(
         LLDB_LOGF(log,
                   "Failed to install pending-items introspection function "
                   "caller: %s.",
-                  error.AsCString());
+                  error.AsCString(nullptr));
         m_get_pending_items_impl_code.reset();
         return args_addr;
       }
diff --git a/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetQueuesHandler.cpp b/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetQueuesHandler.cpp
index fa6ff429a3530..306edce279070 100644
--- a/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetQueuesHandler.cpp
+++ b/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetQueuesHandler.cpp
@@ -190,7 +190,7 @@ AppleGetQueuesHandler::SetupGetQueuesFunction(Thread &thread,
     if (error.Fail() || get_queues_caller == nullptr) {
       LLDB_LOGF(log,
                 "Could not get function caller for get-queues function: %s.",
-                error.AsCString());
+                error.AsCString(nullptr));
       return args_addr;
     }
   }
diff --git a/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetThreadItemInfoHandler.cpp b/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetThreadItemInfoHandler.cpp
index 5f128a16d811b..3676b0da05a6f 100644
--- a/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetThreadItemInfoHandler.cpp
+++ b/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetThreadItemInfoHandler.cpp
@@ -184,7 +184,7 @@ lldb::addr_t AppleGetThreadItemInfoHandler::SetupGetThreadItemInfoFunction(
         LLDB_LOGF(log,
                   "Failed to install get-thread-item-info introspection "
                   "caller: %s.",
-                  error.AsCString());
+                  error.AsCString(nullptr));
         m_get_thread_item_info_impl_code.reset();
         return args_addr;
       }
diff --git a/lldb/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp b/lldb/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp
index 376af04608265..5dea97cec5b71 100644
--- a/lldb/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp
+++ b/lldb/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp
@@ -542,7 +542,7 @@ ThreadSP SystemRuntimeMacOSX::GetExtendedBacktraceThread(ThreadSP real_thread,
     originating_thread_sp = std::make_shared<HistoryThread>(
         *m_process, real_thread->GetIndexID(), app_specific_backtrace_pcs,
         HistoryPCType::Calls);
-    originating_thread_sp->SetQueueName(type.AsCString());
+    originating_thread_sp->SetQueueName(type.AsCString(nullptr));
   }
   return originating_thread_sp;
 }
diff --git a/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTBundleSaver.cpp b/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTBundleSaver.cpp
index 3b1535a931999..4ae45119baefc 100644
--- a/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTBundleSaver.cpp
+++ b/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTBundleSaver.cpp
@@ -272,7 +272,8 @@ BuildModulesSection(Process &process, FileSpec directory) {
     FileSpec path_to_copy_module = directory;
     path_to_copy_module.AppendPathComponent("modules");
     path_to_copy_module.AppendPathComponent(system_path);
-    sys::fs::create_directories(path_to_copy_module.GetDirectory().AsCString());
+    sys::fs::create_directories(
+        path_to_copy_module.GetDirectory().AsCString(nullptr));
 
     if (std::error_code ec =
             llvm::sys::fs::copy_file(file, path_to_copy_module.GetPath()))
diff --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
index 624cdeada4eb9..69bbb17c07052 100644
--- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -8602,7 +8602,7 @@ void TypeSystemClang::DumpFromSymbolFile(Stream &s,
       if (symbol_name != type->GetName().GetStringRef())
         continue;
 
-    s << type->GetName().AsCString() << "\n";
+    s << type->GetName().AsCString(nullptr) << "\n";
 
     CompilerType full_type = type->GetFullCompilerType();
     if (clang::TagDecl *tag_decl = GetAsTagDecl(full_type)) {
diff --git a/lldb/source/Plugins/UnwindAssembly/x86/x86AssemblyInspectionEngine.cpp b/lldb/source/Plugins/UnwindAssembly/x86/x86AssemblyInspectionEngine.cpp
index 19e8b57e66f07..1bd942cb2c590 100644
--- a/lldb/source/Plugins/UnwindAssembly/x86/x86AssemblyInspectionEngine.cpp
+++ b/lldb/source/Plugins/UnwindAssembly/x86/x86AssemblyInspectionEngine.cpp
@@ -1541,7 +1541,8 @@ bool x86AssemblyInspectionEngine::AugmentUnwindPlanFromCallSite(
 
   unwind_plan.SetPlanValidAddressRanges({func_range});
   if (unwind_plan_updated) {
-    std::string unwind_plan_source(unwind_plan.GetSourceName().AsCString());
+    std::string unwind_plan_source(
+        unwind_plan.GetSourceName().AsCString(nullptr));
     unwind_plan_source += " plus augmentation from assembly parsing";
     unwind_plan.SetSourceName(unwind_plan_source.c_str());
     unwind_plan.SetSourcedFromCompiler(eLazyBoolNo);
diff --git a/lldb/source/Symbol/Function.cpp b/lldb/source/Symbol/Function.cpp
index fdb20bcd83ffd..3d3ab00a7ff9f 100644
--- a/lldb/source/Symbol/Function.cpp
+++ b/lldb/source/Symbol/Function.cpp
@@ -89,9 +89,9 @@ void InlineFunctionInfo::DumpStopContext(Stream *s) const {
   //    s->Indent("[inlined] ");
   s->Indent();
   if (m_mangled)
-    s->PutCString(m_mangled.GetName().AsCString());
+    s->PutCString(m_mangled.GetName().AsCString(nullptr));
   else
-    s->PutCString(m_name.AsCString());
+    s->PutCString(m_name.AsCString(nullptr));
 }
 
 ConstString InlineFunctionInfo::GetName() const {
diff --git a/lldb/source/Symbol/SymbolContext.cpp b/lldb/source/Symbol/SymbolContext.cpp
index 0d66a383075f1..33bc58677b1c3 100644
--- a/lldb/source/Symbol/SymbolContext.cpp
+++ b/lldb/source/Symbol/SymbolContext.cpp
@@ -840,7 +840,8 @@ const Symbol *SymbolContext::FindBestGlobalDataSymbol(ConstString name,
 
     if (external_symbols.size() > 1) {
       StreamString ss;
-      ss.Printf("Multiple external symbols found for '%s'\n", name.AsCString());
+      ss.Printf("Multiple external symbols found for '%s'\n",
+                name.AsCString(nullptr));
       for (const Symbol *symbol : external_symbols) {
         symbol->GetDescription(&ss, eDescriptionLevelFull, &target);
       }
@@ -851,7 +852,8 @@ const Symbol *SymbolContext::FindBestGlobalDataSymbol(ConstString name,
       return external_symbols[0];
     } else if (internal_symbols.size() > 1) {
       StreamString ss;
-      ss.Printf("Multiple internal symbols found for '%s'\n", name.AsCString());
+      ss.Printf("Multiple internal symbols found for '%s'\n",
+                name.AsCString(nullptr));
       for (const Symbol *symbol : internal_symbols) {
         symbol->GetDescription(&ss, eDescriptionLevelVerbose, &target);
         ss.PutChar('\n');
@@ -922,7 +924,7 @@ Mangled SymbolContext::GetPossiblyInlinedFunctionName() const {
 
   // Sometimes an inline frame may not have mangling information,
   // but does have a valid name.
-  return Mangled{inline_info->GetName().AsCString()};
+  return Mangled{inline_info->GetName().AsCString(nullptr)};
 }
 
 //
diff --git a/lldb/source/Symbol/Symtab.cpp b/lldb/source/Symbol/Symtab.cpp
index 8e0b6ad5ce22b..c7cd900f41cbb 100644
--- a/lldb/source/Symbol/Symtab.cpp
+++ b/lldb/source/Symbol/Symtab.cpp
@@ -760,7 +760,7 @@ uint32_t Symtab::AppendSymbolIndexesMatchingRegExAndType(
     if (symbol_type == eSymbolTypeAny ||
         m_symbols[i].GetType() == symbol_type) {
       const char *name =
-          m_symbols[i].GetMangled().GetName(name_preference).AsCString();
+          m_symbols[i].GetMangled().GetName(name_preference).AsCString(nullptr);
       if (name) {
         if (regexp.Execute(name))
           indexes.push_back(i);
@@ -786,7 +786,7 @@ uint32_t Symtab::AppendSymbolIndexesMatchingRegExAndType(
         continue;
 
       const char *name =
-          m_symbols[i].GetMangled().GetName(name_preference).AsCString();
+          m_symbols[i].GetMangled().GetName(name_preference).AsCString(nullptr);
       if (name) {
         if (regexp.Execute(name))
           indexes.push_back(i);
diff --git a/lldb/source/Symbol/Type.cpp b/lldb/source/Symbol/Type.cpp
index 0c3246d238701..8977de56a4cb3 100644
--- a/lldb/source/Symbol/Type.cpp
+++ b/lldb/source/Symbol/Type.cpp
@@ -1239,12 +1239,12 @@ bool TypeMemberFunctionImpl::GetDescription(Stream &stream) {
                   m_type.GetTypeName().AsCString("<unknown>"));
     break;
   case lldb::eMemberFunctionKindInstanceMethod:
-    stream.Printf("instance method %s of type %s", m_name.AsCString(),
-                  m_decl.GetDeclContext().GetName().AsCString());
+    stream.Printf("instance method %s of type %s", m_name.AsCString(nullptr),
+                  m_decl.GetDeclContext().GetName().AsCString(nullptr));
     break;
   case lldb::eMemberFunctionKindStaticMethod:
-    stream.Printf("static method %s of type %s", m_name.AsCString(),
-                  m_decl.GetDeclContext().GetName().AsCString());
+    stream.Printf("static method %s of type %s", m_name.AsCString(nullptr),
+                  m_decl.GetDeclContext().GetName().AsCString(nullptr));
     break;
   }
   return true;
diff --git a/lldb/source/Symbol/Variable.cpp b/lldb/source/Symbol/Variable.cpp
index 55926a0b150ff..bd25f09b8767f 100644
--- a/lldb/source/Symbol/Variable.cpp
+++ b/lldb/source/Symbol/Variable.cpp
@@ -96,7 +96,7 @@ bool Variable::NameMatches(ConstString name) const {
   return m_mangled.NameMatches(name);
 }
 bool Variable::NameMatches(const RegularExpression &regex) const {
-  if (regex.Execute(m_name.AsCString()))
+  if (regex.Execute(m_name.AsCString(nullptr)))
     return true;
   if (m_mangled)
     return m_mangled.NameMatches(regex);
@@ -596,7 +596,7 @@ static void PrivateAutoComplete(
 
         if (variable_list) {
           for (const VariableSP &var_sp : *variable_list)
-            request.AddCompletion(var_sp->GetName().AsCString());
+            request.AddCompletion(var_sp->GetName().AsCString(nullptr));
         }
       }
     }
diff --git a/lldb/source/Target/DynamicRegisterInfo.cpp b/lldb/source/Target/DynamicRegisterInfo.cpp
index e3a055fa1ce32..c0116921e33fc 100644
--- a/lldb/source/Target/DynamicRegisterInfo.cpp
+++ b/lldb/source/Target/DynamicRegisterInfo.cpp
@@ -209,8 +209,8 @@ DynamicRegisterInfo::SetRegisterInfo(const StructuredData::Dictionary &dict,
       std::optional<llvm::StringRef> maybe_set_name =
           sets->GetItemAtIndexAsString(i);
       if (maybe_set_name && !maybe_set_name->empty()) {
-        m_sets.push_back(
-            {ConstString(*maybe_set_name).AsCString(), nullptr, 0, nullptr});
+        m_sets.push_back({ConstString(*maybe_set_name).AsCString(nullptr),
+                          nullptr, 0, nullptr});
       } else {
         Clear();
         printf("error: register sets must have valid names\n");
@@ -412,14 +412,19 @@ size_t DynamicRegisterInfo::SetRegisterInfo(
       m_value_reg_offset_map[local_regnum] = reg.value_reg_offset;
     }
 
-    struct RegisterInfo reg_info {
-      reg.name.AsCString(), reg.alt_name.AsCString(), reg.byte_size,
-          reg.byte_offset, reg.encoding, reg.format,
-          {reg.regnum_ehframe, reg.regnum_dwarf, reg.regnum_generic,
-           reg.regnum_remote, local_regnum},
-          // value_regs and invalidate_regs are filled by Finalize()
-          nullptr, nullptr, reg.flags_type
-    };
+    struct RegisterInfo reg_info{
+        reg.name.AsCString(nullptr),
+        reg.alt_name.AsCString(nullptr),
+        reg.byte_size,
+        reg.byte_offset,
+        reg.encoding,
+        reg.format,
+        {reg.regnum_ehframe, reg.regnum_dwarf, reg.regnum_generic,
+         reg.regnum_remote, local_regnum},
+        // value_regs and invalidate_regs are filled by Finalize()
+        nullptr,
+        nullptr,
+        reg.flags_type};
 
     m_regs.push_back(reg_info);
 
@@ -716,7 +721,7 @@ DynamicRegisterInfo::GetRegisterSetIndexByName(const ConstString &set_name,
 
   m_set_names.push_back(set_name);
   m_set_reg_nums.resize(m_set_reg_nums.size() + 1);
-  RegisterSet new_set = {set_name.AsCString(), nullptr, 0, nullptr};
+  RegisterSet new_set = {set_name.AsCString(nullptr), nullptr, 0, nullptr};
   m_sets.push_back(new_set);
   return m_sets.size() - 1;
 }
diff --git a/lldb/source/Target/ModuleCache.cpp b/lldb/source/Target/ModuleCache.cpp
index 3d2812b0966e4..812d93a9bbe3c 100644
--- a/lldb/source/Target/ModuleCache.cpp
+++ b/lldb/source/Target/ModuleCache.cpp
@@ -96,7 +96,7 @@ void DeleteExistingModule(const FileSpec &root_dir_spec,
   ModuleLock lock(root_dir_spec, module_uuid, error);
   if (error.Fail()) {
     LLDB_LOGF(log, "Failed to lock module %s: %s",
-              module_uuid.GetAsString().c_str(), error.AsCString());
+              module_uuid.GetAsString().c_str(), error.AsCString(nullptr));
   }
 
   namespace fs = llvm::sys::fs;
@@ -140,7 +140,7 @@ Status CreateHostSysRootModuleLink(const FileSpec &root_dir_spec,
   }
 
   Status error = MakeDirectory(
-      FileSpec(sysroot_module_path_spec.GetDirectory().AsCString()));
+      FileSpec(sysroot_module_path_spec.GetDirectory().AsCString(nullptr)));
   if (error.Fail())
     return error;
 
@@ -194,7 +194,7 @@ Status ModuleCache::Put(const FileSpec &root_dir_spec, const char *hostname,
   const auto module_spec_dir =
       GetModuleDirectory(root_dir_spec, module_spec.GetUUID());
   const auto module_file_path =
-      JoinPath(module_spec_dir, target_file.GetFilename().AsCString());
+      JoinPath(module_spec_dir, target_file.GetFilename().AsCString(nullptr));
 
   const auto tmp_file_path = tmp_file.GetPath();
   const auto err_code =
@@ -209,7 +209,7 @@ Status ModuleCache::Put(const FileSpec &root_dir_spec, const char *hostname,
   if (error.Fail())
     return Status::FromErrorStringWithFormat("Failed to create link to %s: %s",
                                              module_file_path.GetPath().c_str(),
-                                             error.AsCString());
+                                             error.AsCString(nullptr));
   return Status();
 }
 
@@ -227,8 +227,9 @@ Status ModuleCache::Get(const FileSpec &root_dir_spec, const char *hostname,
 
   const auto module_spec_dir =
       GetModuleDirectory(root_dir_spec, module_spec.GetUUID());
-  const auto module_file_path = JoinPath(
-      module_spec_dir, module_spec.GetFileSpec().GetFilename().AsCString());
+  const auto module_file_path =
+      JoinPath(module_spec_dir,
+               module_spec.GetFileSpec().GetFilename().AsCString(nullptr));
 
   if (!FileSystem::Instance().Exists(module_file_path))
     return Status::FromErrorStringWithFormat(
@@ -246,7 +247,7 @@ Status ModuleCache::Get(const FileSpec &root_dir_spec, const char *hostname,
   if (error.Fail())
     return Status::FromErrorStringWithFormat("Failed to create link to %s: %s",
                                              module_file_path.GetPath().c_str(),
-                                             error.AsCString());
+                                             error.AsCString(nullptr));
 
   auto cached_module_spec(module_spec);
   cached_module_spec.GetUUID().Clear(); // Clear UUID since it may contain md5
@@ -287,7 +288,7 @@ Status ModuleCache::GetAndPut(const FileSpec &root_dir_spec,
   if (error.Fail())
     return Status::FromErrorStringWithFormat(
         "Failed to lock module %s: %s",
-        module_spec.GetUUID().GetAsString().c_str(), error.AsCString());
+        module_spec.GetUUID().GetAsString().c_str(), error.AsCString(nullptr));
 
   const auto escaped_hostname(GetEscapedHostname(hostname));
   // Check local cache for a module.
@@ -301,14 +302,14 @@ Status ModuleCache::GetAndPut(const FileSpec &root_dir_spec,
   llvm::FileRemover tmp_file_remover(tmp_download_file_spec.GetPath());
   if (error.Fail())
     return Status::FromErrorStringWithFormat("Failed to download module: %s",
-                                             error.AsCString());
+                                             error.AsCString(nullptr));
 
   // Put downloaded file into local module cache.
   error = Put(root_dir_spec, escaped_hostname.c_str(), module_spec,
               tmp_download_file_spec, module_spec.GetFileSpec());
   if (error.Fail())
     return Status::FromErrorStringWithFormat(
-        "Failed to put module into cache: %s", error.AsCString());
+        "Failed to put module into cache: %s", error.AsCString(nullptr));
 
   tmp_file_remover.releaseFile();
   error = Get(root_dir_spec, escaped_hostname.c_str(), module_spec,
@@ -332,7 +333,7 @@ Status ModuleCache::GetAndPut(const FileSpec &root_dir_spec,
               GetSymbolFileSpec(module_spec.GetFileSpec()));
   if (error.Fail())
     return Status::FromErrorStringWithFormat(
-        "Failed to put symbol file into cache: %s", error.AsCString());
+        "Failed to put symbol file into cache: %s", error.AsCString(nullptr));
 
   tmp_symfile_remover.releaseFile();
 
diff --git a/lldb/source/Target/Platform.cpp b/lldb/source/Target/Platform.cpp
index 55eaa88b562d4..98b39f24f844e 100644
--- a/lldb/source/Target/Platform.cpp
+++ b/lldb/source/Target/Platform.cpp
@@ -494,7 +494,8 @@ RecurseCopy_Callback(void *baton, llvm::sys::fs::file_type ft,
     FileSystem::Instance().EnumerateDirectory(src_dir_path, true, true, true,
                                               RecurseCopy_Callback, &rc_baton2);
     if (rc_baton2.error.Fail()) {
-      rc_baton->error = Status::FromErrorString(rc_baton2.error.AsCString());
+      rc_baton->error =
+          Status::FromErrorString(rc_baton2.error.AsCString(nullptr));
       return FileSystem::eEnumerateDirectoryResultQuit; // got an error, bail out
     }
     return FileSystem::eEnumerateDirectoryResultNext;
@@ -529,7 +530,7 @@ RecurseCopy_Callback(void *baton, llvm::sys::fs::file_type ft,
       dst_file.SetFilename(src.GetFilename());
     Status err = rc_baton->platform_ptr->PutFile(src, dst_file);
     if (err.Fail()) {
-      rc_baton->error = Status::FromErrorString(err.AsCString());
+      rc_baton->error = Status::FromErrorString(err.AsCString(nullptr));
       return FileSystem::eEnumerateDirectoryResultQuit; // got an error, bail out
     }
     return FileSystem::eEnumerateDirectoryResultNext;
@@ -1132,7 +1133,7 @@ lldb::ProcessSP Platform::DebugProcess(ProcessLaunchInfo &launch_info,
 #endif
       } else {
         LLDB_LOGF(log, "Platform::%s Attach() failed: %s", __FUNCTION__,
-                  error.AsCString());
+                  error.AsCString(nullptr));
       }
     } else {
       LLDB_LOGF(log,
@@ -1142,7 +1143,7 @@ lldb::ProcessSP Platform::DebugProcess(ProcessLaunchInfo &launch_info,
     }
   } else {
     LLDB_LOGF(log, "Platform::%s LaunchProcess() failed: %s", __FUNCTION__,
-              error.AsCString());
+              error.AsCString(nullptr));
   }
 
   return process_sp;
@@ -1681,7 +1682,7 @@ void Platform::CallLocateModuleCallbackIfSet(const ModuleSpec &module_spec,
   Log *log = GetLog(LLDBLog::Platform);
   if (error.Fail()) {
     LLDB_LOGF(log, "%s: locate module callback failed: %s",
-              LLVM_PRETTY_FUNCTION, error.AsCString());
+              LLVM_PRETTY_FUNCTION, error.AsCString(nullptr));
     return;
   }
 
@@ -1800,7 +1801,7 @@ bool Platform::GetCachedSharedModule(const ModuleSpec &module_spec,
 
   LLDB_LOGF(log, "Platform::%s - module %s not found in local cache: %s",
             __FUNCTION__, module_spec.GetUUID().GetAsString().c_str(),
-            error.AsCString());
+            error.AsCString(nullptr));
   return false;
 }
 
@@ -1823,7 +1824,7 @@ Status Platform::DownloadModuleSlice(const FileSpec &src_file_spec,
 
   if (error.Fail()) {
     error = Status::FromErrorStringWithFormat("unable to open source file: %s",
-                                              error.AsCString());
+                                              error.AsCString(nullptr));
     return error;
   }
 
@@ -1896,7 +1897,8 @@ uint32_t Platform::LoadImage(lldb_private::Process *process,
     // Only local file was specified. Install it to the current working
     // directory.
     FileSpec target_file = GetWorkingDirectory();
-    target_file.AppendPathComponent(local_file.GetFilename().AsCString());
+    target_file.AppendPathComponent(
+        local_file.GetFilename().AsCString(nullptr));
     if (IsRemote() || local_file != target_file) {
       error = Install(local_file, target_file);
       if (error.Fail())
diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp
index 7333365070061..3d8d020141ce9 100644
--- a/lldb/source/Target/Process.cpp
+++ b/lldb/source/Target/Process.cpp
@@ -1623,7 +1623,8 @@ Process::CreateBreakpointSite(const BreakpointLocationSP &constituent,
             " for breakpoint %i.%i: %s\n",
             symbol->GetLoadAddress(&GetTarget()),
             constituent->GetBreakpoint().GetID(), constituent->GetID(),
-            error.AsCString() ? error.AsCString() : "unknown error");
+            error.AsCString(nullptr) ? error.AsCString(nullptr)
+                                     : "unknown error");
         return LLDB_INVALID_BREAK_ID;
       }
       Address resolved_address(load_addr);
@@ -1662,7 +1663,8 @@ Process::CreateBreakpointSite(const BreakpointLocationSP &constituent,
                 " for breakpoint %i.%i: %s\n",
                 load_addr, constituent->GetBreakpoint().GetID(),
                 constituent->GetID(),
-                error.AsCString() ? error.AsCString() : "unknown error");
+                error.AsCString(nullptr) ? error.AsCString(nullptr)
+                                         : "unknown error");
           }
         }
       }
@@ -1798,7 +1800,7 @@ Status Process::EnableSoftwareBreakpoint(BreakpointSite *bp_site) {
         log,
         "Process::EnableSoftwareBreakpoint (site_id = %d) addr = 0x%" PRIx64
         " -- FAILED: %s",
-        bp_site->GetID(), (uint64_t)bp_addr, error.AsCString());
+        bp_site->GetID(), (uint64_t)bp_addr, error.AsCString(nullptr));
   return error;
 }
 
@@ -1891,7 +1893,7 @@ Status Process::DisableSoftwareBreakpoint(BreakpointSite *bp_site) {
       log,
       "Process::DisableSoftwareBreakpoint (site_id = %d) addr = 0x%" PRIx64
       " -- FAILED: %s",
-      bp_site->GetID(), (uint64_t)bp_addr, error.AsCString());
+      bp_site->GetID(), (uint64_t)bp_addr, error.AsCString(nullptr));
   return error;
 }
 
@@ -2545,7 +2547,7 @@ bool Process::CanJIT() {
       LLDB_LOGF(log,
                 "Process::%s pid %" PRIu64
                 " allocation test failed, CanJIT () is false: %s",
-                __FUNCTION__, GetID(), err.AsCString());
+                __FUNCTION__, GetID(), err.AsCString(nullptr));
     }
 
     DeallocateMemory(allocated_memory);
@@ -2782,7 +2784,7 @@ Status Process::LaunchPrivate(ProcessLaunchInfo &launch_info, StateType &state,
   if (error.Fail()) {
     if (GetID() != LLDB_INVALID_PROCESS_ID) {
       SetID(LLDB_INVALID_PROCESS_ID);
-      const char *error_string = error.AsCString();
+      const char *error_string = error.AsCString(nullptr);
       if (error_string == nullptr)
         error_string = "launch failed";
       SetExitStatus(-1, error_string);
@@ -2798,7 +2800,7 @@ Status Process::LaunchPrivate(ProcessLaunchInfo &launch_info, StateType &state,
     // We were able to launch the process, but we failed to catch the
     // initial stop.
     error = Status::FromErrorString("failed to catch stop after launch");
-    SetExitStatus(0, error.AsCString());
+    SetExitStatus(0, error.AsCString(nullptr));
     Destroy(false);
     return error;
   }
@@ -3062,10 +3064,10 @@ Status Process::Attach(ProcessAttachInfo &attach_info) {
           if (error.Fail()) {
             if (GetID() != LLDB_INVALID_PROCESS_ID) {
               SetID(LLDB_INVALID_PROCESS_ID);
-              if (error.AsCString() == nullptr)
+              if (error.AsCString(nullptr) == nullptr)
                 error = Status::FromErrorString("attach failed");
 
-              SetExitStatus(-1, error.AsCString());
+              SetExitStatus(-1, error.AsCString(nullptr));
             }
           } else {
             SetNextEventAction(new Process::AttachCompletionHandler(
@@ -3145,7 +3147,7 @@ Status Process::Attach(ProcessAttachInfo &attach_info) {
         if (GetID() != LLDB_INVALID_PROCESS_ID)
           SetID(LLDB_INVALID_PROCESS_ID);
 
-        const char *error_string = error.AsCString();
+        const char *error_string = error.AsCString(nullptr);
         if (error_string == nullptr)
           error_string = "attach failed";
 
@@ -4211,7 +4213,7 @@ thread_result_t Process::RunPrivateStateThread() {
                     "Process::%s (arg = %p, pid = %" PRIu64
                     ") failed to halt the process: %s",
                     __FUNCTION__, static_cast<void *>(this), GetID(),
-                    error.AsCString());
+                    error.AsCString(nullptr));
         // Halt should generate a stopped event. Make a note of the fact that
         // we were doing the interrupt, so we can set the interrupted flag
         // after we receive the event. We deliberately set this to true even if
@@ -5360,7 +5362,7 @@ Process::RunThreadPlan(ExecutionContext &exe_ctx,
             diagnostic_manager.Printf(
                 lldb::eSeverityError,
                 "couldn't resume inferior the %d time: \"%s\".", num_resumes,
-                resume_error.AsCString());
+                resume_error.AsCString(nullptr));
             return_value = eExpressionSetupError;
             break;
           }
@@ -6154,7 +6156,7 @@ addr_t Process::ResolveIndirectFunction(const Address *address, Status &error) {
       const Symbol *symbol = address->CalculateSymbolContextSymbol();
       error = Status::FromErrorStringWithFormat(
           "Unable to call resolver for indirect function %s",
-          symbol ? symbol->GetName().AsCString() : "<UNKNOWN>");
+          symbol ? symbol->GetName().AsCString(nullptr) : "<UNKNOWN>");
       function_addr = LLDB_INVALID_ADDRESS;
     } else {
       if (ABISP abi_sp = GetABI())
diff --git a/lldb/source/Target/RegisterContextUnwind.cpp b/lldb/source/Target/RegisterContextUnwind.cpp
index 53a9b9a78c90d..eb691d1a0d97d 100644
--- a/lldb/source/Target/RegisterContextUnwind.cpp
+++ b/lldb/source/Target/RegisterContextUnwind.cpp
@@ -646,7 +646,7 @@ void RegisterContextUnwind::InitializeNonZerothFrame() {
       active_row->Dump(active_row_strm, m_fast_unwind_plan_sp.get(), &m_thread,
                        m_start_pc.GetLoadAddress(exe_ctx.GetTargetPtr()));
       UnwindLogMsg("Using fast unwind plan '%s'",
-                   m_fast_unwind_plan_sp->GetSourceName().AsCString());
+                   m_fast_unwind_plan_sp->GetSourceName().AsCString(nullptr));
       UnwindLogMsg("active row: %s", active_row_strm.GetData());
     }
   } else {
@@ -662,7 +662,7 @@ void RegisterContextUnwind::InitializeNonZerothFrame() {
                          &m_thread,
                          m_start_pc.GetLoadAddress(exe_ctx.GetTargetPtr()));
         UnwindLogMsg("Using full unwind plan '%s'",
-                     m_full_unwind_plan_sp->GetSourceName().AsCString());
+                     m_full_unwind_plan_sp->GetSourceName().AsCString(nullptr));
         UnwindLogMsg("active row: %s", active_row_strm.GetData());
       }
     }
@@ -1358,7 +1358,7 @@ RegisterContextUnwind::GetAbstractRegisterLocation(uint32_t lldb_regnum,
       active_row->Dump(active_row_strm, m_full_unwind_plan_sp.get(), &m_thread,
                        m_start_pc.GetLoadAddress(exe_ctx.GetTargetPtr()));
       UnwindLogMsg("Using full unwind plan '%s'",
-                   m_full_unwind_plan_sp->GetSourceName().AsCString());
+                   m_full_unwind_plan_sp->GetSourceName().AsCString(nullptr));
       UnwindLogMsg("active row: %s", active_row_strm.GetData());
     }
 
@@ -1499,7 +1499,8 @@ RegisterContextUnwind::GetAbstractRegisterLocation(uint32_t lldb_regnum,
   std::string unwindplan_name;
   if (m_full_unwind_plan_sp) {
     unwindplan_name += "via '";
-    unwindplan_name += m_full_unwind_plan_sp->GetSourceName().AsCString();
+    unwindplan_name +=
+        m_full_unwind_plan_sp->GetSourceName().AsCString(nullptr);
     unwindplan_name += "'";
   }
   UnwindLogMsg("no save location for %s (%d) %s", regnum.GetName(),
@@ -1747,7 +1748,7 @@ UnwindPlanSP RegisterContextUnwind::TryAdoptArchitectureUnwindPlan() {
     if (GetLog(LLDBLog::Unwind)) {
       UnwindLogMsg(
           "Replacing Full Unwindplan with Architecture UnwindPlan, '%s'",
-          m_full_unwind_plan_sp->GetSourceName().AsCString());
+          m_full_unwind_plan_sp->GetSourceName().AsCString(nullptr));
       const UnwindPlan::Row *active_row =
           m_full_unwind_plan_sp->GetRowForFunctionOffset(m_current_offset);
       if (active_row) {
@@ -2124,7 +2125,7 @@ bool RegisterContextUnwind::ReadFrameAddress(
           process.ReadPointerFromMemory(candidate_addr, st);
       if (st.Fail()) {
         UnwindLogMsg("Cannot read memory at 0x%" PRIx64 ": %s", candidate_addr,
-                     st.AsCString());
+                     st.AsCString(nullptr));
         return false;
       }
       Address addr;
diff --git a/lldb/source/Target/SectionLoadList.cpp b/lldb/source/Target/SectionLoadList.cpp
index d72069d0a71d0..22f8abba5479c 100644
--- a/lldb/source/Target/SectionLoadList.cpp
+++ b/lldb/source/Target/SectionLoadList.cpp
@@ -137,7 +137,7 @@ bool SectionLoadList::SetSectionLoadAddress(const lldb::SectionSP &section,
         "SectionLoadList::%s (section = %p (%s), load_addr = 0x%16.16" PRIx64
         ") error: module has been deleted",
         __FUNCTION__, static_cast<void *>(section.get()),
-        section->GetName().AsCString(), load_addr);
+        section->GetName().AsCString(nullptr), load_addr);
   }
   return false;
 }
@@ -158,7 +158,7 @@ size_t SectionLoadList::SetSectionUnloaded(const lldb::SectionSP &section_sp) {
       }
       LLDB_LOGF(log, "SectionLoadList::%s (section = %p (%s.%s))", __FUNCTION__,
                 static_cast<void *>(section_sp.get()), module_name.c_str(),
-                section_sp->GetName().AsCString());
+                section_sp->GetName().AsCString(nullptr));
     }
 
     std::lock_guard<std::recursive_mutex> guard(m_mutex);
@@ -195,7 +195,8 @@ bool SectionLoadList::SetSectionUnloaded(const lldb::SectionSP &section_sp,
         "SectionLoadList::%s (section = %p (%s.%s), load_addr = 0x%16.16" PRIx64
         ")",
         __FUNCTION__, static_cast<void *>(section_sp.get()),
-        module_name.c_str(), section_sp->GetName().AsCString(), load_addr);
+        module_name.c_str(), section_sp->GetName().AsCString(nullptr),
+        load_addr);
   }
   bool erased = false;
   std::lock_guard<std::recursive_mutex> guard(m_mutex);
diff --git a/lldb/source/Target/StackFrame.cpp b/lldb/source/Target/StackFrame.cpp
index 89435e20cc49b..2b37fd0920511 100644
--- a/lldb/source/Target/StackFrame.cpp
+++ b/lldb/source/Target/StackFrame.cpp
@@ -1301,7 +1301,7 @@ const char *StackFrame::GetFunctionName() {
       const InlineFunctionInfo *inlined_info =
           inlined_block->GetInlinedFunctionInfo();
       if (inlined_info)
-        name = inlined_info->GetName().AsCString();
+        name = inlined_info->GetName().AsCString(nullptr);
     }
   }
 
@@ -1328,7 +1328,7 @@ const char *StackFrame::GetDisplayFunctionName() {
       const InlineFunctionInfo *inlined_info =
           inlined_block->GetInlinedFunctionInfo();
       if (inlined_info)
-        name = inlined_info->GetDisplayName().AsCString();
+        name = inlined_info->GetDisplayName().AsCString(nullptr);
     }
   }
 
@@ -1411,8 +1411,8 @@ GetBaseExplainingValue(const Instruction::Operand &operand,
     return base_and_offset;
   }
   case Instruction::Operand::Type::Register: {
-    const RegisterInfo *info =
-        register_context.GetRegisterInfoByName(operand.m_register.AsCString());
+    const RegisterInfo *info = register_context.GetRegisterInfoByName(
+        operand.m_register.AsCString(nullptr));
     if (!info) {
       return std::make_pair(nullptr, 0);
     }
@@ -1654,7 +1654,7 @@ lldb::ValueObjectSP DoGuessValueAt(StackFrame &frame, ConstString reg,
   using namespace OperandMatchers;
 
   const RegisterInfo *reg_info =
-      frame.GetRegisterContext()->GetRegisterInfoByName(reg.AsCString());
+      frame.GetRegisterContext()->GetRegisterInfoByName(reg.AsCString(nullptr));
   if (!reg_info) {
     return ValueObjectSP();
   }
diff --git a/lldb/source/Target/StopInfo.cpp b/lldb/source/Target/StopInfo.cpp
index 5110ed16edc91..f877e0b3f3d61 100644
--- a/lldb/source/Target/StopInfo.cpp
+++ b/lldb/source/Target/StopInfo.cpp
@@ -933,8 +933,8 @@ class StopInfoWatchpoint : public StopInfo {
       error = thread_sp->QueueThreadPlan(step_over_wp_sp, false);
       // If we couldn't push the thread plan, just stop here:
       if (!error.Success()) {
-        LLDB_LOGF(log, "Could not push our step over watchpoint plan: %s", 
-            error.AsCString());
+        LLDB_LOGF(log, "Could not push our step over watchpoint plan: %s",
+                  error.AsCString(nullptr));
 
         m_should_stop = true;
         m_should_stop_is_valid = true;
@@ -1035,7 +1035,7 @@ class StopInfoWatchpoint : public StopInfo {
           } else {
             const char *err_str = "<unknown error>";
             if (result_value_sp)
-              err_str = result_value_sp->GetError().AsCString();
+              err_str = result_value_sp->GetError().AsCString(nullptr);
 
             LLDB_LOGF(log, "Error evaluating condition: \"%s\"\n", err_str);
 
diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp
index 2a3832225f9b7..060ddc9a14c4c 100644
--- a/lldb/source/Target/Target.cpp
+++ b/lldb/source/Target/Target.cpp
@@ -873,7 +873,7 @@ BreakpointName *Target::FindBreakpointName(ConstString name, bool can_create,
     error = Status::FromErrorStringWithFormat(
         "Breakpoint name \"%s\" doesn't exist and "
         "can_create is false.",
-        name.AsCString());
+        name.AsCString(nullptr));
     return nullptr;
   }
 
@@ -886,7 +886,7 @@ void Target::DeleteBreakpointName(ConstString name) {
   BreakpointNameList::iterator iter = m_breakpoint_names.find(name);
 
   if (iter != m_breakpoint_names.end()) {
-    const char *name_cstr = name.AsCString();
+    const char *name_cstr = name.AsCString(nullptr);
     m_breakpoint_names.erase(iter);
     for (auto bp_sp : m_breakpoint_list.Breakpoints())
       bp_sp->RemoveName(name_cstr);
@@ -895,7 +895,7 @@ void Target::DeleteBreakpointName(ConstString name) {
 
 void Target::RemoveNameFromBreakpoint(lldb::BreakpointSP &bp_sp,
                                       ConstString name) {
-  bp_sp->RemoveName(name.AsCString());
+  bp_sp->RemoveName(name.AsCString(nullptr));
 }
 
 void Target::ConfigureBreakpointName(
@@ -908,7 +908,8 @@ void Target::ConfigureBreakpointName(
 
 void Target::ApplyNameToBreakpoints(BreakpointName &bp_name) {
   llvm::Expected<std::vector<BreakpointSP>> expected_vector =
-      m_breakpoint_list.FindBreakpointsByName(bp_name.GetName().AsCString());
+      m_breakpoint_list.FindBreakpointsByName(
+          bp_name.GetName().AsCString(nullptr));
 
   if (!expected_vector) {
     LLDB_LOG(GetLog(LLDBLog::Breakpoints), "invalid breakpoint name: {}",
@@ -923,7 +924,7 @@ void Target::ApplyNameToBreakpoints(BreakpointName &bp_name) {
 void Target::GetBreakpointNames(std::vector<std::string> &names) {
   names.clear();
   for (const auto& bp_name_entry : m_breakpoint_names) {
-    names.push_back(bp_name_entry.first.AsCString());
+    names.push_back(bp_name_entry.first.AsCString(nullptr));
   }
   llvm::sort(names);
 }
@@ -1311,7 +1312,7 @@ Status Target::CreateBreakpointsFromFile(const FileSpec &file,
     if (!error.Success()) {
       error = Status::FromErrorStringWithFormat(
           "Error restoring breakpoint %zu from %s: %s.", i,
-          file.GetPath().c_str(), error.AsCString());
+          file.GetPath().c_str(), error.AsCString(nullptr));
       return error;
     }
     new_bps.AddBreakpointID(BreakpointID(bkpt_sp->GetID()));
@@ -1546,12 +1547,12 @@ static void LoadScriptingResourceForModule(const ModuleSP &module_sp,
                                            Target *target) {
   Status error;
   if (module_sp && !module_sp->LoadScriptingResourceInTarget(target, error)) {
-    if (error.AsCString())
+    if (error.AsCString(nullptr))
       target->GetDebugger().GetAsyncErrorStream()->Printf(
           "unable to load scripting data for module %s - error reported was "
           "%s\n",
           module_sp->GetFileSpec().GetFileNameStrippingExtension().GetCString(),
-          error.AsCString());
+          error.AsCString(nullptr));
   }
 }
 
@@ -3568,7 +3569,7 @@ Status Target::Launch(ProcessLaunchInfo &launch_info, Stream *stream) {
       error = m_process_sp->Resume();
     if (!error.Success()) {
       error = Status::FromErrorStringWithFormat(
-          "process resume at entry point failed: %s", error.AsCString());
+          "process resume at entry point failed: %s", error.AsCString(nullptr));
     }
   } break;
   case eStateExited: {
diff --git a/lldb/source/Target/Thread.cpp b/lldb/source/Target/Thread.cpp
index c8e50db2316ad..09b364388a3c6 100644
--- a/lldb/source/Target/Thread.cpp
+++ b/lldb/source/Target/Thread.cpp
@@ -1866,18 +1866,18 @@ Status Thread::JumpToLine(const FileSpec &file, uint32_t line,
   if (candidates.empty()) {
     if (outside_function.empty()) {
       return Status::FromErrorStringWithFormat(
-          "Cannot locate an address for %s:%i.", file.GetFilename().AsCString(),
-          line);
+          "Cannot locate an address for %s:%i.",
+          file.GetFilename().AsCString(nullptr), line);
     } else if (outside_function.size() == 1) {
       return Status::FromErrorStringWithFormat(
           "%s:%i is outside the current function.",
-          file.GetFilename().AsCString(), line);
+          file.GetFilename().AsCString(nullptr), line);
     } else {
       StreamString sstr;
       DumpAddressList(sstr, outside_function, target);
       return Status::FromErrorStringWithFormat(
           "%s:%i has multiple candidate locations:\n%s",
-          file.GetFilename().AsCString(), line, sstr.GetData());
+          file.GetFilename().AsCString(nullptr), line, sstr.GetData());
     }
   }
 
@@ -1887,7 +1887,7 @@ Status Thread::JumpToLine(const FileSpec &file, uint32_t line,
     StreamString sstr;
     sstr.Printf("%s:%i appears multiple times in this function, selecting the "
                 "first location:\n",
-                file.GetFilename().AsCString(), line);
+                file.GetFilename().AsCString(nullptr), line);
     DumpAddressList(sstr, candidates, target);
     *warnings = std::string(sstr.GetString());
   }
diff --git a/lldb/source/Target/ThreadPlanStepInRange.cpp b/lldb/source/Target/ThreadPlanStepInRange.cpp
index 88e1b5888345f..a461f65ec7abc 100644
--- a/lldb/source/Target/ThreadPlanStepInRange.cpp
+++ b/lldb/source/Target/ThreadPlanStepInRange.cpp
@@ -95,7 +95,7 @@ void ThreadPlanStepInRange::GetDescription(Stream *s,
   auto PrintFailureIfAny = [&]() {
     if (m_status.Success())
       return;
-    s->Printf(" failed (%s)", m_status.AsCString());
+    s->Printf(" failed (%s)", m_status.AsCString(nullptr));
   };
 
   if (level == lldb::eDescriptionLevelBrief) {
@@ -112,9 +112,9 @@ void ThreadPlanStepInRange::GetDescription(Stream *s,
     printed_line_info = true;
   }
 
-  const char *step_into_target = m_step_into_target.AsCString();
+  const char *step_into_target = m_step_into_target.AsCString(nullptr);
   if (step_into_target && step_into_target[0] != '\0')
-    s->Printf(" targeting %s", m_step_into_target.AsCString());
+    s->Printf(" targeting %s", m_step_into_target.AsCString(nullptr));
 
   if (!printed_line_info || level == eDescriptionLevelVerbose) {
     s->Printf(" using ranges:");
@@ -379,8 +379,8 @@ bool ThreadPlanStepInRange::DefaultShouldStopHereCallback(
           should_stop_here = true;
         } else {
           const char *target_name =
-              step_in_range_plan->m_step_into_target.AsCString();
-          const char *function_name = sc.GetFunctionName().AsCString();
+              step_in_range_plan->m_step_into_target.AsCString(nullptr);
+          const char *function_name = sc.GetFunctionName().AsCString(nullptr);
 
           if (function_name == nullptr)
             should_stop_here = false;
@@ -391,8 +391,8 @@ bool ThreadPlanStepInRange::DefaultShouldStopHereCallback(
           LLDB_LOGF(log,
                     "Stepping out of frame %s which did not match step into "
                     "target %s.",
-                    sc.GetFunctionName().AsCString(),
-                    step_in_range_plan->m_step_into_target.AsCString());
+                    sc.GetFunctionName().AsCString(nullptr),
+                    step_in_range_plan->m_step_into_target.AsCString(nullptr));
       }
     }
 
diff --git a/lldb/source/Target/ThreadPlanStepInstruction.cpp b/lldb/source/Target/ThreadPlanStepInstruction.cpp
index e9db3171a5bef..f3a75a89706cd 100644
--- a/lldb/source/Target/ThreadPlanStepInstruction.cpp
+++ b/lldb/source/Target/ThreadPlanStepInstruction.cpp
@@ -55,7 +55,7 @@ void ThreadPlanStepInstruction::GetDescription(Stream *s,
   auto PrintFailureIfAny = [&]() {
     if (m_status.Success())
       return;
-    s->Printf(" failed (%s)", m_status.AsCString());
+    s->Printf(" failed (%s)", m_status.AsCString(nullptr));
   };
 
   if (level == lldb::eDescriptionLevelBrief) {
diff --git a/lldb/source/Target/ThreadPlanStepOverRange.cpp b/lldb/source/Target/ThreadPlanStepOverRange.cpp
index 643ee827c865c..d09ad7fab227b 100644
--- a/lldb/source/Target/ThreadPlanStepOverRange.cpp
+++ b/lldb/source/Target/ThreadPlanStepOverRange.cpp
@@ -51,7 +51,7 @@ void ThreadPlanStepOverRange::GetDescription(Stream *s,
   auto PrintFailureIfAny = [&]() {
     if (m_status.Success())
       return;
-    s->Printf(" failed (%s)", m_status.AsCString());
+    s->Printf(" failed (%s)", m_status.AsCString(nullptr));
   };
 
   if (level == lldb::eDescriptionLevelBrief) {
@@ -420,7 +420,7 @@ bool ThreadPlanStepOverRange::DoWillResume(lldb::StateType resume_state,
                   frame_block->GetInlinedFunctionInfo();
               const char *name;
               if (inline_info)
-                name = inline_info->GetName().AsCString();
+                name = inline_info->GetName().AsCString(nullptr);
               else
                 name = "<unknown-notinlined>";
 
diff --git a/lldb/source/Target/Trace.cpp b/lldb/source/Target/Trace.cpp
index 1ffd617a80fc7..9e43e3730797c 100644
--- a/lldb/source/Target/Trace.cpp
+++ b/lldb/source/Target/Trace.cpp
@@ -113,7 +113,7 @@ Trace::LoadPostMortemTraceFromFile(Debugger &debugger,
 
   return Trace::FindPluginForPostMortemProcess(
       debugger, *session_file,
-      trace_description_file.GetDirectory().AsCString());
+      trace_description_file.GetDirectory().AsCString(nullptr));
 }
 
 Expected<lldb::TraceSP> Trace::FindPluginForPostMortemProcess(
diff --git a/lldb/source/Target/TraceDumper.cpp b/lldb/source/Target/TraceDumper.cpp
index 5e87deb2ac9c1..7b25881242131 100644
--- a/lldb/source/Target/TraceDumper.cpp
+++ b/lldb/source/Target/TraceDumper.cpp
@@ -30,7 +30,7 @@ static std::optional<const char *> ToOptionalString(const char *s) {
 static const char *GetModuleName(const SymbolContext &sc) {
   if (!sc.module_sp)
     return nullptr;
-  return sc.module_sp->GetFileSpec().GetFilename().AsCString();
+  return sc.module_sp->GetFileSpec().GetFilename().AsCString(nullptr);
 }
 
 /// \return
@@ -245,7 +245,7 @@ class OutputWriterCLI : public TraceDumper::OutputWriter {
     else if (!sc.function && !sc.symbol)
       m_s << module_name << "`(none)";
     else
-      m_s << module_name << "`" << sc.GetFunctionName().AsCString();
+      m_s << module_name << "`" << sc.GetFunctionName().AsCString(nullptr);
   }
 
   void DumpFunctionCallTree(const TraceDumper::FunctionCall &function_call) {
@@ -377,7 +377,8 @@ class OutputWriterJSON : public TraceDumper::OutputWriter {
       m_j.attribute("module", ToOptionalString(GetModuleName(item)));
       m_j.attribute(
           "symbol",
-          ToOptionalString(item.symbol_info->sc.GetFunctionName().AsCString()));
+          ToOptionalString(
+              item.symbol_info->sc.GetFunctionName().AsCString(nullptr)));
 
       if (lldb::InstructionSP instruction = item.symbol_info->instruction) {
         ExecutionContext exe_ctx = item.symbol_info->exe_ctx;
diff --git a/lldb/source/Utility/Status.cpp b/lldb/source/Utility/Status.cpp
index f68b172be07e0..befa679cbdc26 100644
--- a/lldb/source/Utility/Status.cpp
+++ b/lldb/source/Utility/Status.cpp
@@ -305,6 +305,6 @@ bool Status::Success() const { return !Fail(); }
 void llvm::format_provider<lldb_private::Status>::format(
     const lldb_private::Status &error, llvm::raw_ostream &OS,
     llvm::StringRef Options) {
-  llvm::format_provider<llvm::StringRef>::format(error.AsCString(), OS,
+  llvm::format_provider<llvm::StringRef>::format(error.AsCString(nullptr), OS,
                                                  Options);
 }
diff --git a/lldb/source/ValueObject/DILEval.cpp b/lldb/source/ValueObject/DILEval.cpp
index 80b31be8e7c23..56538bc9eecf1 100644
--- a/lldb/source/ValueObject/DILEval.cpp
+++ b/lldb/source/ValueObject/DILEval.cpp
@@ -478,8 +478,8 @@ Interpreter::Visit(const UnaryOpNode &node) {
       }
     }
     if (error.Fail())
-      return llvm::make_error<DILDiagnosticError>(m_expr, error.AsCString(),
-                                                  node.GetLocation());
+      return llvm::make_error<DILDiagnosticError>(
+          m_expr, error.AsCString(nullptr), node.GetLocation());
 
     return child_sp;
   }
@@ -487,8 +487,8 @@ Interpreter::Visit(const UnaryOpNode &node) {
     Status error;
     lldb::ValueObjectSP value = operand->AddressOf(error);
     if (error.Fail())
-      return llvm::make_error<DILDiagnosticError>(m_expr, error.AsCString(),
-                                                  node.GetLocation());
+      return llvm::make_error<DILDiagnosticError>(
+          m_expr, error.AsCString(nullptr), node.GetLocation());
 
     return value;
   }
@@ -565,7 +565,7 @@ Interpreter::PointerOffset(lldb::ValueObjectSP ptr, lldb::ValueObjectSP offset,
   int64_t offset_int = offset->GetValueAsSigned(0, &success);
   if (!success) {
     std::string errMsg = llvm::formatv("could not get the offset: {0}",
-                                       offset->GetError().AsCString());
+                                       offset->GetError().AsCString(nullptr));
     return llvm::make_error<DILDiagnosticError>(m_expr, std::move(errMsg),
                                                 location);
   }
@@ -1064,7 +1064,7 @@ Interpreter::Visit(const BitFieldExtractionNode &node) {
     std::string message = llvm::formatv(
         "bitfield range {0}:{1} is not valid for \"({2}) {3}\"", first_index,
         last_index, base->GetTypeName().AsCString("<invalid type>"),
-        base->GetName().AsCString());
+        base->GetName().AsCString(nullptr));
     return llvm::make_error<DILDiagnosticError>(m_expr, message,
                                                 node.GetLocation());
   }
@@ -1303,8 +1303,8 @@ llvm::Expected<lldb::ValueObjectSP> Interpreter::Visit(const CastNode &node) {
     Status error;
     operand = operand->Dereference(error);
     if (error.Fail())
-      return llvm::make_error<DILDiagnosticError>(m_expr, error.AsCString(),
-                                                  node.GetLocation());
+      return llvm::make_error<DILDiagnosticError>(
+          m_expr, error.AsCString(nullptr), node.GetLocation());
   }
 
   switch (cast_kind) {
diff --git a/lldb/source/ValueObject/ValueObject.cpp b/lldb/source/ValueObject/ValueObject.cpp
index edad5aa4d490d..13011e92e131e 100644
--- a/lldb/source/ValueObject/ValueObject.cpp
+++ b/lldb/source/ValueObject/ValueObject.cpp
@@ -815,7 +815,7 @@ bool ValueObject::SetData(DataExtractor &data, Status &error) {
 
     if (!set_error.Success()) {
       error = Status::FromErrorStringWithFormat(
-          "unable to set scalar value: %s", set_error.AsCString());
+          "unable to set scalar value: %s", set_error.AsCString(nullptr));
       return false;
     }
   } break;
@@ -1347,7 +1347,7 @@ bool ValueObject::DumpPrintableRepresentation(
   // further as that's not meaningful, only the error is.
   if (m_error.Fail() && !GetCompilerType().IsValid()) {
     if (do_dump_error)
-      s.Printf("<%s>", m_error.AsCString());
+      s.Printf("<%s>", m_error.AsCString(nullptr));
     return false;
   }
 
@@ -1557,7 +1557,7 @@ bool ValueObject::DumpPrintableRepresentation(
         str = GetSummaryAsCString();
       else if (val_obj_display == eValueObjectRepresentationStyleSummary) {
         if (!CanProvideValue()) {
-          strm.Printf("%s @ %s", GetTypeName().AsCString(),
+          strm.Printf("%s @ %s", GetTypeName().AsCString(nullptr),
                       GetLocationAsCString());
           str = strm.GetString();
         } else
@@ -1572,7 +1572,7 @@ bool ValueObject::DumpPrintableRepresentation(
       // realizing the value for dumping produced an error.
       if (m_error.Fail()) {
         if (do_dump_error)
-          s.Printf("<%s>", m_error.AsCString());
+          s.Printf("<%s>", m_error.AsCString(nullptr));
         else
           return false;
       } else if (val_obj_display == eValueObjectRepresentationStyleSummary)
diff --git a/lldb/source/ValueObject/ValueObjectChild.cpp b/lldb/source/ValueObject/ValueObjectChild.cpp
index e29634c2f3322..5cb2e31f53018 100644
--- a/lldb/source/ValueObject/ValueObjectChild.cpp
+++ b/lldb/source/ValueObject/ValueObjectChild.cpp
@@ -208,7 +208,8 @@ bool ValueObjectChild::UpdateValue() {
 
     } else {
       m_error = Status::FromErrorStringWithFormat(
-          "parent failed to evaluate: %s", parent->GetError().AsCString());
+          "parent failed to evaluate: %s",
+          parent->GetError().AsCString(nullptr));
     }
   } else {
     m_error = Status::FromErrorString(
diff --git a/lldb/source/ValueObject/ValueObjectSynthetic.cpp b/lldb/source/ValueObject/ValueObjectSynthetic.cpp
index b0e67df5541e9..fa7c2e60d462c 100644
--- a/lldb/source/ValueObject/ValueObjectSynthetic.cpp
+++ b/lldb/source/ValueObject/ValueObjectSynthetic.cpp
@@ -101,7 +101,7 @@ ValueObjectSynthetic::CalculateNumChildren(uint32_t max) {
     LLDB_LOGF(log,
               "[ValueObjectSynthetic::CalculateNumChildren] for VO of name "
               "%s and type %s, the filter returned %u child values",
-              GetName().AsCString(), GetTypeName().AsCString(),
+              GetName().AsCString(nullptr), GetTypeName().AsCString(nullptr),
               num_children ? *num_children : 0);
     return num_children;
   } else {
@@ -114,7 +114,8 @@ ValueObjectSynthetic::CalculateNumChildren(uint32_t max) {
     LLDB_LOGF(log,
               "[ValueObjectSynthetic::CalculateNumChildren] for VO of name "
               "%s and type %s, the filter returned %u child values",
-              GetName().AsCString(), GetTypeName().AsCString(), num_children);
+              GetName().AsCString(nullptr), GetTypeName().AsCString(nullptr),
+              num_children);
     return num_children;
   }
 }
@@ -180,8 +181,9 @@ bool ValueObjectSynthetic::UpdateValue() {
     LLDB_LOGF(log,
               "[ValueObjectSynthetic::UpdateValue] name=%s, type changed "
               "from %s to %s, recomputing synthetic filter",
-              GetName().AsCString(), m_parent_type_name.AsCString(),
-              new_parent_type_name.AsCString());
+              GetName().AsCString(nullptr),
+              m_parent_type_name.AsCString(nullptr),
+              new_parent_type_name.AsCString(nullptr));
     m_parent_type_name = new_parent_type_name;
     CreateSynthFilter();
   }
@@ -191,7 +193,7 @@ bool ValueObjectSynthetic::UpdateValue() {
     LLDB_LOGF(log,
               "[ValueObjectSynthetic::UpdateValue] name=%s, synthetic "
               "filter said caches are stale - clearing",
-              GetName().AsCString());
+              GetName().AsCString(nullptr));
     // filter said that cached values are stale
     {
       std::lock_guard<std::mutex> guard(m_child_mutex);
@@ -213,7 +215,7 @@ bool ValueObjectSynthetic::UpdateValue() {
     LLDB_LOGF(log,
               "[ValueObjectSynthetic::UpdateValue] name=%s, synthetic "
               "filter said caches are still valid",
-              GetName().AsCString());
+              GetName().AsCString(nullptr));
   }
 
   m_provides_value = eLazyBoolCalculate;
@@ -224,7 +226,7 @@ bool ValueObjectSynthetic::UpdateValue() {
     LLDB_LOGF(log,
               "[ValueObjectSynthetic::UpdateValue] name=%s, synthetic "
               "filter said it can provide a value",
-              GetName().AsCString());
+              GetName().AsCString(nullptr));
 
     m_provides_value = eLazyBoolYes;
     CopyValueData(synth_val.get());
@@ -232,7 +234,7 @@ bool ValueObjectSynthetic::UpdateValue() {
     LLDB_LOGF(log,
               "[ValueObjectSynthetic::UpdateValue] name=%s, synthetic "
               "filter said it will not provide a value",
-              GetName().AsCString());
+              GetName().AsCString(nullptr));
 
     m_provides_value = eLazyBoolNo;
     // Copying the data of an incomplete type won't work as it has no byte size.
@@ -251,7 +253,7 @@ lldb::ValueObjectSP ValueObjectSynthetic::GetChildAtIndex(uint32_t idx,
   LLDB_LOGF(log,
             "[ValueObjectSynthetic::GetChildAtIndex] name=%s, retrieving "
             "child at index %u",
-            GetName().AsCString(), idx);
+            GetName().AsCString(nullptr), idx);
 
   UpdateValueIfNeeded();
 
@@ -270,7 +272,7 @@ lldb::ValueObjectSP ValueObjectSynthetic::GetChildAtIndex(uint32_t idx,
       LLDB_LOGF(log,
                 "[ValueObjectSynthetic::GetChildAtIndex] name=%s, child at "
                 "index %u not cached and will be created",
-                GetName().AsCString(), idx);
+                GetName().AsCString(nullptr), idx);
 
       lldb::ValueObjectSP synth_guy = m_synth_filter_up->GetChildAtIndex(idx);
 
@@ -279,7 +281,8 @@ lldb::ValueObjectSP ValueObjectSynthetic::GetChildAtIndex(uint32_t idx,
           "[ValueObjectSynthetic::GetChildAtIndex] name=%s, child at index "
           "%u created as %p (is "
           "synthetic: %s)",
-          GetName().AsCString(), idx, static_cast<void *>(synth_guy.get()),
+          GetName().AsCString(nullptr), idx,
+          static_cast<void *>(synth_guy.get()),
           synth_guy.get()
               ? (synth_guy->IsSyntheticChildrenGenerated() ? "yes" : "no")
               : "no");
@@ -301,7 +304,7 @@ lldb::ValueObjectSP ValueObjectSynthetic::GetChildAtIndex(uint32_t idx,
                 "[ValueObjectSynthetic::GetChildAtIndex] name=%s, child at "
                 "index %u not cached and cannot "
                 "be created (can_create = %s, synth_filter = %p)",
-                GetName().AsCString(), idx, can_create ? "yes" : "no",
+                GetName().AsCString(nullptr), idx, can_create ? "yes" : "no",
                 static_cast<void *>(m_synth_filter_up.get()));
 
       return lldb::ValueObjectSP();
@@ -310,7 +313,7 @@ lldb::ValueObjectSP ValueObjectSynthetic::GetChildAtIndex(uint32_t idx,
     LLDB_LOGF(log,
               "[ValueObjectSynthetic::GetChildAtIndex] name=%s, child at "
               "index %u cached as %p",
-              GetName().AsCString(), idx, static_cast<void *>(valobj));
+              GetName().AsCString(nullptr), idx, static_cast<void *>(valobj));
 
     return valobj->GetSP();
   }
@@ -372,12 +375,12 @@ ValueObjectSynthetic::GetIndexOfChildWithName(llvm::StringRef name_ref) {
     return index;
   } else if (!found_index && m_synth_filter_up == nullptr) {
     return llvm::createStringError("Type has no child named '%s'",
-                                   name.AsCString());
+                                   name.AsCString(nullptr));
   } else if (found_index)
     return *found_index;
 
   return llvm::createStringError("Type has no child named '%s'",
-                                 name.AsCString());
+                                 name.AsCString(nullptr));
 }
 
 bool ValueObjectSynthetic::IsInScope() { return m_parent->IsInScope(); }
diff --git a/lldb/tools/lldb-server/lldb-gdbserver.cpp b/lldb/tools/lldb-server/lldb-gdbserver.cpp
index c5c0d4b97e935..67ebfbf88e69d 100644
--- a/lldb/tools/lldb-server/lldb-gdbserver.cpp
+++ b/lldb/tools/lldb-server/lldb-gdbserver.cpp
@@ -113,7 +113,7 @@ llvm::Error handle_attach_to_pid(GDBRemoteCommunicationServerLLGS &gdb_server,
   Status status = gdb_server.AttachToProcess(pid);
   if (status.Fail())
     return llvm::createStringErrorV("failed to attach to pid {0}: {1}", pid,
-                                    status.AsCString());
+                                    status.AsCString(nullptr));
   return llvm::Error::success();
 }
 
@@ -217,7 +217,7 @@ llvm::Error ConnectToRemote(MainLoop &mainloop,
     status = SharedSocket::GetNativeSocket(connection_fd, sockfd);
     if (status.Fail())
       return llvm::createStringErrorV("GetNativeSocket failed: {0}",
-                                      status.AsCString());
+                                      status.AsCString(nullptr));
     connection_up = std::make_unique<ConnectionFileDescriptor>(
         std::make_unique<TCPSocket>(sockfd, /*should_close=*/true));
 #else
@@ -489,7 +489,7 @@ int main_gdbserver(int argc, char *argv[]) {
   Status ret = mainloop.Run();
   if (ret.Fail()) {
     fprintf(stderr, "lldb-server terminating due to error: %s\n",
-            ret.AsCString());
+            ret.AsCString(nullptr));
     return EXIT_FAILURE;
   }
   fprintf(stderr, "lldb-server exiting...\n");
diff --git a/lldb/tools/lldb-server/lldb-platform.cpp b/lldb/tools/lldb-server/lldb-platform.cpp
index bef0c61532f3c..b217598981d82 100644
--- a/lldb/tools/lldb-server/lldb-platform.cpp
+++ b/lldb/tools/lldb-server/lldb-platform.cpp
@@ -210,7 +210,7 @@ static Status save_socket_id_to_file(const std::string &socket_id,
   if (status.Fail())
     return Status::FromErrorStringWithFormat(
         "Failed to create directory %s: %s", temp_file_spec.GetPath().c_str(),
-        status.AsCString());
+        status.AsCString(nullptr));
 
   if (auto Err = llvm::writeToOutput(file_spec.GetPath(),
                                      [&socket_id](llvm::raw_ostream &OS) {
@@ -255,7 +255,8 @@ AcceptGdbConnectionsIfNeeded(const FileSpec &debugserver_path,
     Status status;
     SharedSocket shared_socket(sock_up.get(), status);
     if (status.Fail()) {
-      LLDB_LOGF(log, "gdbserver SharedSocket failed: %s", status.AsCString());
+      LLDB_LOGF(log, "gdbserver SharedSocket failed: %s",
+                status.AsCString(nullptr));
       return;
     }
     lldb::pid_t child_pid = LLDB_INVALID_PROCESS_ID;
@@ -269,7 +270,7 @@ AcceptGdbConnectionsIfNeeded(const FileSpec &debugserver_path,
       if (status.Fail()) {
         Host::Kill(child_pid, SIGTERM);
         LLDB_LOGF(log, "gdbserver CompleteSending failed: %s",
-                  status.AsCString());
+                  status.AsCString(nullptr));
         return;
       }
     }
@@ -289,7 +290,8 @@ static void client_handle(GDBRemoteCommunicationServerPlatform &platform,
     if (status.Success())
       platform.SetPendingGdbServer(socket_name);
     else
-      fprintf(stderr, "failed to start gdbserver: %s\n", status.AsCString());
+      fprintf(stderr, "failed to start gdbserver: %s\n",
+              status.AsCString(nullptr));
   }
 
   bool interrupt = false;
@@ -531,7 +533,7 @@ int main_platform(int argc, char *argv[]) {
     NativeSocket sockfd;
     status = SharedSocket::GetNativeSocket(fd, sockfd);
     if (status.Fail()) {
-      LLDB_LOGF(log, "lldb-platform child: %s", status.AsCString());
+      LLDB_LOGF(log, "lldb-platform child: %s", status.AsCString(nullptr));
       return socket_error;
     }
 
@@ -578,18 +580,18 @@ int main_platform(int argc, char *argv[]) {
   status = parse_listen_host_port(protocol, listen_host_port, address,
                                   platform_port, gdb_address, gdbserver_port);
   if (status.Fail()) {
-    printf("Failed to parse listen address: %s\n", status.AsCString());
+    printf("Failed to parse listen address: %s\n", status.AsCString(nullptr));
     return socket_error;
   }
 
   std::unique_ptr<Socket> platform_sock = Socket::Create(protocol, status);
   if (status.Fail()) {
-    printf("Failed to create platform socket: %s\n", status.AsCString());
+    printf("Failed to create platform socket: %s\n", status.AsCString(nullptr));
     return socket_error;
   }
   status = platform_sock->Listen(address, backlog);
   if (status.Fail()) {
-    printf("Failed to listen platform: %s\n", status.AsCString());
+    printf("Failed to listen platform: %s\n", status.AsCString(nullptr));
     return socket_error;
   }
   if (protocol == Socket::ProtocolTcp && platform_port == 0)
@@ -604,7 +606,7 @@ int main_platform(int argc, char *argv[]) {
         socket_file);
     if (status.Fail()) {
       fprintf(stderr, "failed to write socket id to %s: %s\n",
-              socket_file.GetPath().c_str(), status.AsCString());
+              socket_file.GetPath().c_str(), status.AsCString(nullptr));
       return EXIT_FAILURE;
     }
   }
@@ -614,7 +616,7 @@ int main_platform(int argc, char *argv[]) {
   status = ListenGdbConnectionsIfNeeded(protocol, gdb_sock, gdb_address,
                                         gdbserver_port);
   if (status.Fail()) {
-    printf("Failed to listen gdb: %s\n", status.AsCString());
+    printf("Failed to listen gdb: %s\n", status.AsCString(nullptr));
     return socket_error;
   }
 
@@ -632,9 +634,11 @@ int main_platform(int argc, char *argv[]) {
                   main_loop, multi_client);
               if (status.Fail()) {
                 Log *log = GetLog(LLDBLog::Platform);
-                LLDB_LOGF(log, "spawn_process failed: %s", status.AsCString());
+                LLDB_LOGF(log, "spawn_process failed: %s",
+                          status.AsCString(nullptr));
                 WithColor::error()
-                    << "spawn_process failed: " << status.AsCString() << "\n";
+                    << "spawn_process failed: " << status.AsCString(nullptr)
+                    << "\n";
                 if (!multi_client)
                   main_loop.RequestTermination();
               }
diff --git a/lldb/tools/lldb-test/lldb-test.cpp b/lldb/tools/lldb-test/lldb-test.cpp
index 6a5130f8492af..2b097c542415a 100644
--- a/lldb/tools/lldb-test/lldb-test.cpp
+++ b/lldb/tools/lldb-test/lldb-test.cpp
@@ -768,7 +768,7 @@ Error opts::symbols::verify(lldb_private::Module &Module) {
       return make_string_error("Cannot parse compile unit {0}.", i);
 
     outs() << "Processing '"
-           << comp_unit->GetPrimaryFile().GetFilename().AsCString()
+           << comp_unit->GetPrimaryFile().GetFilename().AsCString(nullptr)
            << "' compile unit.\n";
 
     LineTable *lt = comp_unit->GetLineTable();
diff --git a/lldb/unittests/Expression/DiagnosticManagerTest.cpp b/lldb/unittests/Expression/DiagnosticManagerTest.cpp
index 7e04d4b023e4c..e86290cda849d 100644
--- a/lldb/unittests/Expression/DiagnosticManagerTest.cpp
+++ b/lldb/unittests/Expression/DiagnosticManagerTest.cpp
@@ -212,5 +212,5 @@ TEST(DiagnosticManagerTest, StatusConversion) {
   Status status =
       Status::FromError(mgr.GetAsError(lldb::eExpressionParseError));
   EXPECT_EQ(std::string("error: abc\nwarning: def\n"),
-            std::string(status.AsCString()));
+            std::string(status.AsCString(nullptr)));
 }
diff --git a/lldb/unittests/Interpreter/TestCommandPaths.cpp b/lldb/unittests/Interpreter/TestCommandPaths.cpp
index 25834ba550b7a..dc8359085f0aa 100644
--- a/lldb/unittests/Interpreter/TestCommandPaths.cpp
+++ b/lldb/unittests/Interpreter/TestCommandPaths.cpp
@@ -95,7 +95,7 @@ void RunTest(CommandInterpreter &interp, const char *args, bool is_leaf,
   } else {
     ASSERT_EQ(multi_word_cmd, nullptr);
     ASSERT_TRUE(error.Fail());
-    ASSERT_STREQ(error.AsCString(), test_str);
+    ASSERT_STREQ(error.AsCString(nullptr), test_str);
   }
 }
 
diff --git a/lldb/unittests/Platform/Android/AdbClientTest.cpp b/lldb/unittests/Platform/Android/AdbClientTest.cpp
index 97aa2173c2333..a8fa069c19e85 100644
--- a/lldb/unittests/Platform/Android/AdbClientTest.cpp
+++ b/lldb/unittests/Platform/Android/AdbClientTest.cpp
@@ -128,8 +128,9 @@ TEST_F(AdbClientTest, RealTcpConnection) {
   auto listen_socket = std::make_unique<TCPSocket>(true);
   std::string listen_address = "localhost:" + port_str;
   Status error = listen_socket->Listen(listen_address.c_str(), 5);
-  ASSERT_TRUE(error.Success()) << "Failed to create listening socket on port "
-                               << unused_port << ": " << error.AsCString();
+  ASSERT_TRUE(error.Success())
+      << "Failed to create listening socket on port " << unused_port << ": "
+      << error.AsCString(nullptr);
 
   // Verify the socket is listening on the expected port
   ASSERT_EQ(listen_socket->GetLocalPortNumber(), unused_port)
diff --git a/lldb/unittests/Platform/Android/PlatformAndroidTest.cpp b/lldb/unittests/Platform/Android/PlatformAndroidTest.cpp
index 514bce1c71576..9b8662510f8aa 100644
--- a/lldb/unittests/Platform/Android/PlatformAndroidTest.cpp
+++ b/lldb/unittests/Platform/Android/PlatformAndroidTest.cpp
@@ -64,7 +64,8 @@ TEST_F(PlatformAndroidTest,
       3600, FileSpec("/tmp/libtest.so"));
 
   EXPECT_TRUE(result.Fail());
-  EXPECT_THAT(result.AsCString(), HasSubstr("Failed to create AdbClient"));
+  EXPECT_THAT(result.AsCString(nullptr),
+              HasSubstr("Failed to create AdbClient"));
 }
 
 TEST_F(PlatformAndroidTest, DownloadModuleSlice_ZipFile_UsesCorrectDdCommand) {
@@ -203,7 +204,7 @@ TEST_F(PlatformAndroidTest, GetFile_FilenameWithSingleQuotes_Rejected) {
       GetFile(FileSpec("/test/file'with'quotes"), FileSpec("/tmp/output"));
 
   EXPECT_TRUE(result.Fail());
-  EXPECT_THAT(result.AsCString(), HasSubstr("single-quotes"));
+  EXPECT_THAT(result.AsCString(nullptr), HasSubstr("single-quotes"));
 }
 
 TEST_F(PlatformAndroidTest,
@@ -212,7 +213,7 @@ TEST_F(PlatformAndroidTest,
                                       200, FileSpec("/tmp/output"));
 
   EXPECT_TRUE(result.Fail());
-  EXPECT_THAT(result.AsCString(), HasSubstr("single-quotes"));
+  EXPECT_THAT(result.AsCString(nullptr), HasSubstr("single-quotes"));
 }
 
 TEST_F(PlatformAndroidTest, GetFile_NetworkTimeout_PropagatesErrorCorrectly) {
@@ -236,7 +237,7 @@ TEST_F(PlatformAndroidTest, GetFile_NetworkTimeout_PropagatesErrorCorrectly) {
   Status result =
       GetFile(FileSpec("/data/large/file.so"), FileSpec("/tmp/large.so"));
   EXPECT_TRUE(result.Fail());
-  EXPECT_THAT(result.AsCString(), HasSubstr("Network timeout"));
+  EXPECT_THAT(result.AsCString(nullptr), HasSubstr("Network timeout"));
 }
 
 TEST_F(PlatformAndroidTest, SyncService_ConnectionFailsGracefully) {
diff --git a/lldb/unittests/Symbol/TestTypeSystemClang.cpp b/lldb/unittests/Symbol/TestTypeSystemClang.cpp
index a6db2059a3517..77e5846bb903d 100644
--- a/lldb/unittests/Symbol/TestTypeSystemClang.cpp
+++ b/lldb/unittests/Symbol/TestTypeSystemClang.cpp
@@ -758,7 +758,7 @@ TEST_F(TestTypeSystemClang, TemplateArguments) {
   CompilerType double_type(m_ast->weak_from_this(),
                            m_ast->getASTContext().DoubleTy.getAsOpaquePtr());
   for (CompilerType t : {type, typedef_type, auto_type}) {
-    SCOPED_TRACE(t.GetTypeName().AsCString());
+    SCOPED_TRACE(t.GetTypeName().AsCString(nullptr));
 
     const bool expand_pack = false;
     EXPECT_EQ(
diff --git a/lldb/unittests/SymbolFile/DWARF/DWARFASTParserClangTests.cpp b/lldb/unittests/SymbolFile/DWARF/DWARFASTParserClangTests.cpp
index 6a753b6b33edf..180375b27e902 100644
--- a/lldb/unittests/SymbolFile/DWARF/DWARFASTParserClangTests.cpp
+++ b/lldb/unittests/SymbolFile/DWARF/DWARFASTParserClangTests.cpp
@@ -307,7 +307,7 @@ TEST_F(DWARFASTParserClangTests, TestCallingConventionParsing) {
     lldb::TypeSP type =
         tester.GetParser().ParseTypeFromDWARF(sc, func, &new_type);
     found_function_types.push_back(
-        type->GetForwardCompilerType().GetTypeName().AsCString());
+        type->GetForwardCompilerType().GetTypeName().AsCString(nullptr));
   }
 
   // Compare the parsed function types against the expected list of types.
diff --git a/lldb/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp b/lldb/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp
index 4e8194fd0f057..7dd0a4a0f1871 100644
--- a/lldb/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp
+++ b/lldb/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp
@@ -633,6 +633,7 @@ TEST_F(SymbolFilePDBTests, TestFindSymbolsWithNameAndType) {
 
   SymbolContext sc;
   EXPECT_TRUE(sc_list.GetContextAtIndex(0, sc));
-  EXPECT_STREQ("int foo(int)",
-               sc.GetFunctionName(Mangled::ePreferDemangled).AsCString());
+  EXPECT_STREQ(
+      "int foo(int)",
+      sc.GetFunctionName(Mangled::ePreferDemangled).AsCString(nullptr));
 }
diff --git a/lldb/unittests/Target/ModuleCacheTest.cpp b/lldb/unittests/Target/ModuleCacheTest.cpp
index 3fc72039527a8..e7debde208c52 100644
--- a/lldb/unittests/Target/ModuleCacheTest.cpp
+++ b/lldb/unittests/Target/ModuleCacheTest.cpp
@@ -110,7 +110,7 @@ void ModuleCacheTest::TryGetAndPut(const FileSpec &cache_dir,
       module_sp, &did_create);
   EXPECT_EQ(expect_download, download_called);
 
-  EXPECT_TRUE(error.Success()) << "Error was: " << error.AsCString();
+  EXPECT_TRUE(error.Success()) << "Error was: " << error.AsCString(nullptr);
   EXPECT_TRUE(did_create);
   ASSERT_TRUE(bool(module_sp));
 
diff --git a/lldb/unittests/Utility/ConstStringTest.cpp b/lldb/unittests/Utility/ConstStringTest.cpp
index 7018248991b6e..9fe74d1343971 100644
--- a/lldb/unittests/Utility/ConstStringTest.cpp
+++ b/lldb/unittests/Utility/ConstStringTest.cpp
@@ -145,7 +145,7 @@ TEST(ConstStringTest, StringConversions) {
   // Member functions.
   EXPECT_EQ(llvm::StringRef("foo"), foo.GetStringRef());
   EXPECT_EQ(std::string("foo"), foo.GetString());
-  EXPECT_STREQ("foo", foo.AsCString());
+  EXPECT_STREQ("foo", foo.AsCString(nullptr));
 
   // Conversion operators.
   EXPECT_EQ(llvm::StringRef("foo"), llvm::StringRef(foo));
diff --git a/lldb/unittests/Utility/StatusTest.cpp b/lldb/unittests/Utility/StatusTest.cpp
index e37c94ac17f2d..7f19de19865f3 100644
--- a/lldb/unittests/Utility/StatusTest.cpp
+++ b/lldb/unittests/Utility/StatusTest.cpp
@@ -38,7 +38,7 @@ TEST(StatusTest, ErrorConstructor) {
   Status foo = Status::FromError(llvm::createStringError("foo"));
   EXPECT_TRUE(foo.Fail());
   EXPECT_EQ(eErrorTypeGeneric, foo.GetType());
-  EXPECT_STREQ("foo", foo.AsCString());
+  EXPECT_STREQ("foo", foo.AsCString(nullptr));
 
   foo = Status::FromError(llvm::Error::success());
   EXPECT_TRUE(foo.Success());
@@ -55,7 +55,7 @@ TEST(StatusTest, ErrorCodeConstructor) {
   llvm::Error list = llvm::joinErrors(llvm::createStringError("foo"),
                                       llvm::createStringError("bar"));
   Status foobar = Status::FromError(std::move(list));
-  EXPECT_EQ(std::string("foo\nbar"), std::string(foobar.AsCString()));
+  EXPECT_EQ(std::string("foo\nbar"), std::string(foobar.AsCString(nullptr)));
 }
 
 TEST(StatusTest, ErrorConversion) {
@@ -83,7 +83,7 @@ TEST(StatusTest, ErrorConversion) {
 #ifdef _WIN32
 TEST(StatusTest, ErrorWin32) {
   auto success = Status(NO_ERROR, ErrorType::eErrorTypeWin32);
-  EXPECT_STREQ(NULL, success.AsCString());
+  EXPECT_STREQ(NULL, success.AsCString(nullptr));
   EXPECT_FALSE(success.ToError());
   EXPECT_TRUE(success.Success());
 
@@ -99,14 +99,14 @@ TEST(StatusTest, ErrorWin32) {
   Status s = Status(ERROR_ACCESS_DENIED, ErrorType::eErrorTypeWin32);
   EXPECT_TRUE(s.Fail());
   if (!skip)
-    EXPECT_STREQ("Access is denied. ", s.AsCString());
+    EXPECT_STREQ("Access is denied. ", s.AsCString(nullptr));
 
   s = Status(ERROR_IPSEC_IKE_TIMED_OUT, ErrorType::eErrorTypeWin32);
   if (!skip)
-    EXPECT_STREQ("Negotiation timed out ", s.AsCString());
+    EXPECT_STREQ("Negotiation timed out ", s.AsCString(nullptr));
 
   s = Status(16000, ErrorType::eErrorTypeWin32);
   if (!skip)
-    EXPECT_STREQ("unknown error", s.AsCString());
+    EXPECT_STREQ("unknown error", s.AsCString(nullptr));
 }
 #endif
diff --git a/lldb/unittests/debugserver/RNBSocketTest.cpp b/lldb/unittests/debugserver/RNBSocketTest.cpp
index 48f747b09587f..25aa29a12f3df 100644
--- a/lldb/unittests/debugserver/RNBSocketTest.cpp
+++ b/lldb/unittests/debugserver/RNBSocketTest.cpp
@@ -118,29 +118,29 @@ void TestSocketConnect(const char *addr) {
     Status err =
         server_socket->Accept(std::chrono::seconds(10), connected_socket);
     if (err.Fail()) {
-      llvm::errs() << err.AsCString();
+      llvm::errs() << err.AsCString(nullptr);
       abort();
     }
     char buffer[32];
     size_t read_size = 32;
     err = connected_socket->Read((void *)&buffer[0], read_size);
     if (err.Fail()) {
-      llvm::errs() << err.AsCString();
+      llvm::errs() << err.AsCString(nullptr);
       abort();
     }
     std::string Recv(&buffer[0], read_size);
     if (Recv != hello) {
-      llvm::errs() << err.AsCString();
+      llvm::errs() << err.AsCString(nullptr);
       abort();
     }
     size_t write_size = goodbye.length();
     err = connected_socket->Write(goodbye.c_str(), write_size);
     if (err.Fail()) {
-      llvm::errs() << err.AsCString();
+      llvm::errs() << err.AsCString(nullptr);
       abort();
     }
     if (write_size != goodbye.length()) {
-      llvm::errs() << err.AsCString();
+      llvm::errs() << err.AsCString(nullptr);
       abort();
     }
     exit(0);



More information about the lldb-commits mailing list