Index: include/lldb/Breakpoint/BreakpointResolver.h =================================================================== --- include/lldb/Breakpoint/BreakpointResolver.h +++ include/lldb/Breakpoint/BreakpointResolver.h @@ -209,7 +209,7 @@ const char *) = delete; lldb::BreakpointLocationSP AddLocation(Address loc_addr, - bool *new_location = NULL); + bool *new_location = nullptr); Breakpoint *m_breakpoint; // This is the breakpoint we add locations to. lldb::addr_t m_offset; // A random offset the user asked us to add to any Index: source/API/SBAddress.cpp =================================================================== --- source/API/SBAddress.cpp +++ source/API/SBAddress.cpp @@ -83,7 +83,7 @@ SBAddress::operator bool() const { LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBAddress, operator bool); - return m_opaque_up != NULL && m_opaque_up->IsValid(); + return m_opaque_up != nullptr && m_opaque_up->IsValid(); } void SBAddress::Clear() { @@ -186,7 +186,7 @@ const Address *SBAddress::operator->() const { return m_opaque_up.get(); } Address &SBAddress::ref() { - if (m_opaque_up == NULL) + if (m_opaque_up == nullptr) m_opaque_up.reset(new Address()); return *m_opaque_up; } @@ -208,7 +208,7 @@ // case there isn't one already... Stream &strm = description.ref(); if (m_opaque_up->IsValid()) { - m_opaque_up->Dump(&strm, NULL, Address::DumpStyleResolvedDescription, + m_opaque_up->Dump(&strm, nullptr, Address::DumpStyleResolvedDescription, Address::DumpStyleModuleWithFileAddress, 4); StreamString sstrm; // m_opaque_up->Dump (&sstrm, NULL, Index: source/API/SBBlock.cpp =================================================================== --- source/API/SBBlock.cpp +++ source/API/SBBlock.cpp @@ -25,7 +25,7 @@ using namespace lldb; using namespace lldb_private; -SBBlock::SBBlock() : m_opaque_ptr(NULL) { +SBBlock::SBBlock() : m_opaque_ptr(nullptr) { LLDB_RECORD_CONSTRUCTOR_NO_ARGS(SBBlock); } @@ -44,7 +44,7 @@ return LLDB_RECORD_RESULT(*this); } -SBBlock::~SBBlock() { m_opaque_ptr = NULL; } +SBBlock::~SBBlock() { m_opaque_ptr = nullptr; } bool SBBlock::IsValid() const { LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBBlock, IsValid); @@ -53,14 +53,14 @@ SBBlock::operator bool() const { LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBBlock, operator bool); - return m_opaque_ptr != NULL; + return m_opaque_ptr != nullptr; } bool SBBlock::IsInlined() const { LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBBlock, IsInlined); if (m_opaque_ptr) - return m_opaque_ptr->GetInlinedFunctionInfo() != NULL; + return m_opaque_ptr->GetInlinedFunctionInfo() != nullptr; return false; } @@ -77,10 +77,10 @@ language = function->GetLanguage(); else language = lldb::eLanguageTypeUnknown; - return inlined_info->GetName(language).AsCString(NULL); + return inlined_info->GetName(language).AsCString(nullptr); } } - return NULL; + return nullptr; } SBFileSpec SBBlock::GetInlinedCallSiteFile() const { Index: source/API/SBBreakpointLocation.cpp =================================================================== --- source/API/SBBreakpointLocation.cpp +++ source/API/SBBreakpointLocation.cpp @@ -179,7 +179,7 @@ loc_sp->GetTarget().GetAPIMutex()); return loc_sp->GetConditionText(); } - return NULL; + return nullptr; } void SBBreakpointLocation::SetAutoContinue(bool auto_continue) { @@ -357,7 +357,7 @@ loc_sp->GetTarget().GetAPIMutex()); return loc_sp->GetThreadName(); } - return NULL; + return nullptr; } void SBBreakpointLocation::SetQueueName(const char *queue_name) { @@ -382,7 +382,7 @@ loc_sp->GetTarget().GetAPIMutex()); loc_sp->GetQueueName(); } - return NULL; + return nullptr; } bool SBBreakpointLocation::IsResolved() { Index: source/API/SBBroadcaster.cpp =================================================================== --- source/API/SBBroadcaster.cpp +++ source/API/SBBroadcaster.cpp @@ -16,20 +16,19 @@ using namespace lldb; using namespace lldb_private; -SBBroadcaster::SBBroadcaster() : m_opaque_sp(), m_opaque_ptr(NULL) { +SBBroadcaster::SBBroadcaster() : m_opaque_sp(), m_opaque_ptr(nullptr) { LLDB_RECORD_CONSTRUCTOR_NO_ARGS(SBBroadcaster); } SBBroadcaster::SBBroadcaster(const char *name) - : m_opaque_sp(new Broadcaster(NULL, name)), m_opaque_ptr(NULL) { + : m_opaque_sp(new Broadcaster(nullptr, name)), m_opaque_ptr(nullptr) { LLDB_RECORD_CONSTRUCTOR(SBBroadcaster, (const char *), name); m_opaque_ptr = m_opaque_sp.get(); } SBBroadcaster::SBBroadcaster(lldb_private::Broadcaster *broadcaster, bool owns) - : m_opaque_sp(owns ? broadcaster : NULL), m_opaque_ptr(broadcaster) { -} + : m_opaque_sp(owns ? broadcaster : nullptr), m_opaque_ptr(broadcaster) {} SBBroadcaster::SBBroadcaster(const SBBroadcaster &rhs) : m_opaque_sp(rhs.m_opaque_sp), m_opaque_ptr(rhs.m_opaque_ptr) { @@ -48,13 +47,13 @@ return LLDB_RECORD_RESULT(*this); } -SBBroadcaster::~SBBroadcaster() { reset(NULL, false); } +SBBroadcaster::~SBBroadcaster() { reset(nullptr, false); } void SBBroadcaster::BroadcastEventByType(uint32_t event_type, bool unique) { LLDB_RECORD_METHOD(void, SBBroadcaster, BroadcastEventByType, (uint32_t, bool), event_type, unique); - if (m_opaque_ptr == NULL) + if (m_opaque_ptr == nullptr) return; if (unique) @@ -67,7 +66,7 @@ LLDB_RECORD_METHOD(void, SBBroadcaster, BroadcastEvent, (const lldb::SBEvent &, bool), event, unique); - if (m_opaque_ptr == NULL) + if (m_opaque_ptr == nullptr) return; EventSP event_sp = event.GetSP(); @@ -104,7 +103,7 @@ if (m_opaque_ptr) return m_opaque_ptr->GetBroadcasterName().GetCString(); - return NULL; + return nullptr; } bool SBBroadcaster::EventTypeHasListeners(uint32_t event_type) { @@ -144,14 +143,14 @@ SBBroadcaster::operator bool() const { LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBBroadcaster, operator bool); - return m_opaque_ptr != NULL; + return m_opaque_ptr != nullptr; } void SBBroadcaster::Clear() { LLDB_RECORD_METHOD_NO_ARGS(void, SBBroadcaster, Clear); m_opaque_sp.reset(); - m_opaque_ptr = NULL; + m_opaque_ptr = nullptr; } bool SBBroadcaster::operator==(const SBBroadcaster &rhs) const { Index: source/API/SBCommunication.cpp =================================================================== --- source/API/SBCommunication.cpp +++ source/API/SBCommunication.cpp @@ -16,7 +16,7 @@ using namespace lldb; using namespace lldb_private; -SBCommunication::SBCommunication() : m_opaque(NULL), m_opaque_owned(false) { +SBCommunication::SBCommunication() : m_opaque(nullptr), m_opaque_owned(false) { LLDB_RECORD_CONSTRUCTOR_NO_ARGS(SBCommunication); } @@ -28,7 +28,7 @@ SBCommunication::~SBCommunication() { if (m_opaque && m_opaque_owned) delete m_opaque; - m_opaque = NULL; + m_opaque = nullptr; m_opaque_owned = false; } @@ -39,7 +39,7 @@ SBCommunication::operator bool() const { LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBCommunication, operator bool); - return m_opaque != NULL; + return m_opaque != nullptr; } bool SBCommunication::GetCloseOnEOF() { @@ -64,7 +64,7 @@ if (m_opaque) { if (!m_opaque->HasConnection()) m_opaque->SetConnection(Host::CreateDefaultConnection(url).release()); - return m_opaque->Connect(url, NULL); + return m_opaque->Connect(url, nullptr); } return eConnectionStatusNoConnection; } @@ -115,7 +115,7 @@ ? Timeout(llvm::None) : std::chrono::microseconds(timeout_usec); if (m_opaque) - bytes_read = m_opaque->Read(dst, dst_len, timeout, status, NULL); + bytes_read = m_opaque->Read(dst, dst_len, timeout, status, nullptr); else status = eConnectionStatusNoConnection; @@ -130,7 +130,7 @@ size_t bytes_written = 0; if (m_opaque) - bytes_written = m_opaque->Write(src, src_len, status, NULL); + bytes_written = m_opaque->Write(src, src_len, status, nullptr); else status = eConnectionStatusNoConnection; Index: source/API/SBCompileUnit.cpp =================================================================== --- source/API/SBCompileUnit.cpp +++ source/API/SBCompileUnit.cpp @@ -20,7 +20,7 @@ using namespace lldb; using namespace lldb_private; -SBCompileUnit::SBCompileUnit() : m_opaque_ptr(NULL) { +SBCompileUnit::SBCompileUnit() : m_opaque_ptr(nullptr) { LLDB_RECORD_CONSTRUCTOR_NO_ARGS(SBCompileUnit); } @@ -41,7 +41,7 @@ return LLDB_RECORD_RESULT(*this); } -SBCompileUnit::~SBCompileUnit() { m_opaque_ptr = NULL; } +SBCompileUnit::~SBCompileUnit() { m_opaque_ptr = nullptr; } SBFileSpec SBCompileUnit::GetFileSpec() const { LLDB_RECORD_METHOD_CONST_NO_ARGS(lldb::SBFileSpec, SBCompileUnit, @@ -108,8 +108,8 @@ file_spec = *m_opaque_ptr; index = m_opaque_ptr->FindLineEntry( - start_idx, line, inline_file_spec ? inline_file_spec->get() : NULL, - exact, NULL); + start_idx, line, inline_file_spec ? inline_file_spec->get() : nullptr, + exact, nullptr); } return index; @@ -193,7 +193,7 @@ SBCompileUnit::operator bool() const { LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBCompileUnit, operator bool); - return m_opaque_ptr != NULL; + return m_opaque_ptr != nullptr; } bool SBCompileUnit::operator==(const SBCompileUnit &rhs) const { Index: source/API/SBData.cpp =================================================================== --- source/API/SBData.cpp +++ source/API/SBData.cpp @@ -64,7 +64,7 @@ SBData::operator bool() const { LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBData, operator bool); - return m_opaque_sp.get() != NULL; + return m_opaque_sp.get() != nullptr; } uint8_t SBData::GetAddressByteSize() { @@ -312,13 +312,13 @@ LLDB_RECORD_METHOD(const char *, SBData, GetString, (lldb::SBError &, lldb::offset_t), error, offset); - const char *value = 0; + const char *value = nullptr; if (!m_opaque_sp.get()) { error.SetErrorString("no value to read from"); } else { uint32_t old_offset = offset; value = m_opaque_sp->GetCStr(&offset); - if (offset == old_offset || (value == NULL)) + if (offset == old_offset || (value == nullptr)) error.SetErrorString("unable to read data"); } return value; @@ -346,13 +346,13 @@ (lldb::SBError &, lldb::offset_t, void *, size_t), error, offset, buf, size); - void *ok = NULL; + void *ok = nullptr; if (!m_opaque_sp.get()) { error.SetErrorString("no value to read from"); } else { uint32_t old_offset = offset; ok = m_opaque_sp->GetU8(&offset, buf, size); - if ((offset == old_offset) || (ok == NULL)) + if ((offset == old_offset) || (ok == nullptr)) error.SetErrorString("unable to read data"); } return ok ? size : 0; Index: source/API/SBDeclaration.cpp =================================================================== --- source/API/SBDeclaration.cpp +++ source/API/SBDeclaration.cpp @@ -147,7 +147,7 @@ } lldb_private::Declaration &SBDeclaration::ref() { - if (m_opaque_up == NULL) + if (m_opaque_up == nullptr) m_opaque_up.reset(new lldb_private::Declaration()); return *m_opaque_up; } Index: source/API/SBError.cpp =================================================================== --- source/API/SBError.cpp +++ source/API/SBError.cpp @@ -41,7 +41,7 @@ if (m_opaque_up) return m_opaque_up->AsCString(); - return NULL; + return nullptr; } void SBError::Clear() { @@ -144,11 +144,11 @@ SBError::operator bool() const { LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBError, operator bool); - return m_opaque_up != NULL; + return m_opaque_up != nullptr; } void SBError::CreateIfNeeded() { - if (m_opaque_up == NULL) + if (m_opaque_up == nullptr) m_opaque_up.reset(new Status()); } @@ -175,7 +175,8 @@ description.Printf("success"); else { const char *err_string = GetCString(); - description.Printf("error: %s", (err_string != NULL ? err_string : "")); + description.Printf("error: %s", + (err_string != nullptr ? err_string : "")); } } else description.Printf("error: "); Index: source/API/SBEvent.cpp =================================================================== --- source/API/SBEvent.cpp +++ source/API/SBEvent.cpp @@ -22,7 +22,7 @@ using namespace lldb; using namespace lldb_private; -SBEvent::SBEvent() : m_event_sp(), m_opaque_ptr(NULL) { +SBEvent::SBEvent() : m_event_sp(), m_opaque_ptr(nullptr) { LLDB_RECORD_CONSTRUCTOR_NO_ARGS(SBEvent); } @@ -69,7 +69,7 @@ if (event_data) return lldb_event->GetData()->GetFlavor().AsCString(); } - return NULL; + return nullptr; } uint32_t SBEvent::GetType() const { @@ -168,7 +168,7 @@ // Do NOT use m_opaque_ptr directly!!! Must use the SBEvent::get() accessor. // See comments in SBEvent::get().... - return SBEvent::get() != NULL; + return SBEvent::get() != nullptr; } const char *SBEvent::GetCStringFromEvent(const SBEvent &event) { Index: source/API/SBFunction.cpp =================================================================== --- source/API/SBFunction.cpp +++ source/API/SBFunction.cpp @@ -22,7 +22,7 @@ using namespace lldb; using namespace lldb_private; -SBFunction::SBFunction() : m_opaque_ptr(NULL) { +SBFunction::SBFunction() : m_opaque_ptr(nullptr) { LLDB_RECORD_CONSTRUCTOR_NO_ARGS(SBFunction); } @@ -42,7 +42,7 @@ return LLDB_RECORD_RESULT(*this); } -SBFunction::~SBFunction() { m_opaque_ptr = NULL; } +SBFunction::~SBFunction() { m_opaque_ptr = nullptr; } bool SBFunction::IsValid() const { LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBFunction, IsValid); @@ -51,13 +51,13 @@ SBFunction::operator bool() const { LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBFunction, operator bool); - return m_opaque_ptr != NULL; + return m_opaque_ptr != nullptr; } const char *SBFunction::GetName() const { LLDB_RECORD_METHOD_CONST_NO_ARGS(const char *, SBFunction, GetName); - const char *cstr = NULL; + const char *cstr = nullptr; if (m_opaque_ptr) cstr = m_opaque_ptr->GetName().AsCString(); @@ -67,7 +67,7 @@ const char *SBFunction::GetDisplayName() const { LLDB_RECORD_METHOD_CONST_NO_ARGS(const char *, SBFunction, GetDisplayName); - const char *cstr = NULL; + const char *cstr = nullptr; if (m_opaque_ptr) cstr = m_opaque_ptr->GetMangled() .GetDisplayDemangledName(m_opaque_ptr->GetLanguage()) @@ -79,7 +79,7 @@ const char *SBFunction::GetMangledName() const { LLDB_RECORD_METHOD_CONST_NO_ARGS(const char *, SBFunction, GetMangledName); - const char *cstr = NULL; + const char *cstr = nullptr; if (m_opaque_ptr) cstr = m_opaque_ptr->GetMangled().GetMangledName().AsCString(); return cstr; @@ -118,7 +118,7 @@ LLDB_RECORD_METHOD(lldb::SBInstructionList, SBFunction, GetInstructions, (lldb::SBTarget), target); - return LLDB_RECORD_RESULT(GetInstructions(target, NULL)); + return LLDB_RECORD_RESULT(GetInstructions(target, nullptr)); } SBInstructionList SBFunction::GetInstructions(SBTarget target, @@ -141,7 +141,7 @@ if (module_sp) { const bool prefer_file_cache = false; sb_instructions.SetDisassembler(Disassembler::DisassembleRange( - module_sp->GetArchitecture(), NULL, flavor, exe_ctx, + module_sp->GetArchitecture(), nullptr, flavor, exe_ctx, m_opaque_ptr->GetAddressRange(), prefer_file_cache)); } } Index: source/API/SBHostOS.cpp =================================================================== --- source/API/SBHostOS.cpp +++ source/API/SBHostOS.cpp @@ -107,8 +107,9 @@ LLDB_RECORD_DUMMY(lldb::thread_t, SBHostOS, ThreadCreate, (lldb::thread_func_t, void *, SBError *), name, thread_function, thread_arg, error_ptr); - HostThread thread(ThreadLauncher::LaunchThread( - name, thread_function, thread_arg, error_ptr ? error_ptr->get() : NULL)); + HostThread thread( + ThreadLauncher::LaunchThread(name, thread_function, thread_arg, + error_ptr ? error_ptr->get() : nullptr)); return thread.Release(); } Index: source/API/SBInstruction.cpp =================================================================== --- source/API/SBInstruction.cpp +++ source/API/SBInstruction.cpp @@ -127,7 +127,7 @@ } return inst_sp->GetMnemonic(&exe_ctx); } - return NULL; + return nullptr; } const char *SBInstruction::GetOperands(SBTarget target) { @@ -147,7 +147,7 @@ } return inst_sp->GetOperands(&exe_ctx); } - return NULL; + return nullptr; } const char *SBInstruction::GetComment(SBTarget target) { @@ -167,7 +167,7 @@ } return inst_sp->GetComment(&exe_ctx); } - return NULL; + return nullptr; } size_t SBInstruction::GetByteSize() { @@ -249,7 +249,7 @@ // didn't have a stream already created, one will get created... FormatEntity::Entry format; FormatEntity::Parse("${addr}: ", format); - inst_sp->Dump(&s.ref(), 0, true, false, NULL, &sc, NULL, &format, 0); + inst_sp->Dump(&s.ref(), 0, true, false, nullptr, &sc, nullptr, &format, 0); return true; } return false; @@ -258,7 +258,7 @@ void SBInstruction::Print(FILE *out) { LLDB_RECORD_METHOD(void, SBInstruction, Print, (FILE *), out); - if (out == NULL) + if (out == nullptr) return; lldb::InstructionSP inst_sp(GetOpaque()); @@ -272,7 +272,8 @@ StreamFile out_stream(out, false); FormatEntity::Entry format; FormatEntity::Parse("${addr}: ", format); - inst_sp->Dump(&out_stream, 0, true, false, NULL, &sc, NULL, &format, 0); + inst_sp->Dump(&out_stream, 0, true, false, nullptr, &sc, nullptr, &format, + 0); } } Index: source/API/SBInstructionList.cpp =================================================================== --- source/API/SBInstructionList.cpp +++ source/API/SBInstructionList.cpp @@ -49,7 +49,7 @@ SBInstructionList::operator bool() const { LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBInstructionList, operator bool); - return m_opaque_sp.get() != NULL; + return m_opaque_sp.get() != nullptr; } size_t SBInstructionList::GetSize() { @@ -119,7 +119,7 @@ void SBInstructionList::Print(FILE *out) { LLDB_RECORD_METHOD(void, SBInstructionList, Print, (FILE *), out); - if (out == NULL) + if (out == nullptr) return; } @@ -142,7 +142,7 @@ for (size_t i = 0; i < num_instructions; ++i) { Instruction *inst = m_opaque_sp->GetInstructionList().GetInstructionAtIndex(i).get(); - if (inst == NULL) + if (inst == nullptr) break; const Address &addr = inst->GetAddress(); @@ -153,7 +153,7 @@ addr, eSymbolContextEverything, sc); } - inst->Dump(&sref, max_opcode_byte_size, true, false, NULL, &sc, + inst->Dump(&sref, max_opcode_byte_size, true, false, nullptr, &sc, &prev_sc, &format, 0); sref.EOL(); } Index: source/API/SBLineEntry.cpp =================================================================== --- source/API/SBLineEntry.cpp +++ source/API/SBLineEntry.cpp @@ -162,7 +162,7 @@ } lldb_private::LineEntry &SBLineEntry::ref() { - if (m_opaque_up == NULL) + if (m_opaque_up == nullptr) m_opaque_up.reset(new lldb_private::LineEntry()); return *m_opaque_up; } Index: source/API/SBListener.cpp =================================================================== --- source/API/SBListener.cpp +++ source/API/SBListener.cpp @@ -20,7 +20,7 @@ using namespace lldb; using namespace lldb_private; -SBListener::SBListener() : m_opaque_sp(), m_unused_ptr(NULL) { +SBListener::SBListener() : m_opaque_sp(), m_unused_ptr(nullptr) { LLDB_RECORD_CONSTRUCTOR_NO_ARGS(SBListener); } @@ -160,7 +160,7 @@ } if (!success) - event.reset(NULL); + event.reset(nullptr); return success; } @@ -182,7 +182,7 @@ return true; } } - event.reset(NULL); + event.reset(nullptr); return false; } @@ -205,7 +205,7 @@ return true; } } - event.reset(NULL); + event.reset(nullptr); return false; } @@ -217,7 +217,7 @@ event.reset(m_opaque_sp->PeekAtNextEvent()); return event.IsValid(); } - event.reset(NULL); + event.reset(nullptr); return false; } @@ -231,7 +231,7 @@ event.reset(m_opaque_sp->PeekAtNextEventForBroadcaster(broadcaster.get())); return event.IsValid(); } - event.reset(NULL); + event.reset(nullptr); return false; } @@ -247,7 +247,7 @@ broadcaster.get(), event_type_mask)); return event.IsValid(); } - event.reset(NULL); + event.reset(nullptr); return false; } @@ -261,7 +261,7 @@ return true; } } - event.reset(NULL); + event.reset(nullptr); return false; } @@ -279,7 +279,7 @@ return true; } } - event.reset(NULL); + event.reset(nullptr); return false; } @@ -299,7 +299,7 @@ return true; } } - event.reset(NULL); + event.reset(nullptr); return false; } Index: source/API/SBModule.cpp =================================================================== --- source/API/SBModule.cpp +++ source/API/SBModule.cpp @@ -40,8 +40,8 @@ LLDB_RECORD_CONSTRUCTOR(SBModule, (const lldb::SBModuleSpec &), module_spec); ModuleSP module_sp; - Status error = ModuleList::GetSharedModule(*module_spec.m_opaque_up, - module_sp, NULL, NULL, NULL); + Status error = ModuleList::GetSharedModule( + *module_spec.m_opaque_up, module_sp, nullptr, nullptr, nullptr); if (module_sp) SetSP(module_sp); } @@ -85,7 +85,7 @@ SBModule::operator bool() const { LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBModule, operator bool); - return m_opaque_sp.get() != NULL; + return m_opaque_sp.get() != nullptr; } void SBModule::Clear() { @@ -159,7 +159,7 @@ const uint8_t *SBModule::GetUUIDBytes() const { LLDB_RECORD_METHOD_CONST_NO_ARGS(const uint8_t *, SBModule, GetUUIDBytes); - const uint8_t *uuid_bytes = NULL; + const uint8_t *uuid_bytes = nullptr; ModuleSP module_sp(GetSP()); if (module_sp) uuid_bytes = module_sp->GetUUID().GetBytes().data(); @@ -170,8 +170,7 @@ const char *SBModule::GetUUIDString() const { LLDB_RECORD_METHOD_CONST_NO_ARGS(const char *, SBModule, GetUUIDString); - - const char *uuid_cstr = NULL; + const char *uuid_cstr = nullptr; ModuleSP module_sp(GetSP()); if (module_sp) { // We are going to return a "const char *" value through the public API, so @@ -185,7 +184,7 @@ return uuid_cstr; } - return NULL; + return nullptr; } bool SBModule::operator==(const SBModule &rhs) const { @@ -296,7 +295,7 @@ if (symbols) return symbols->GetSymtab(); } - return NULL; + return nullptr; } size_t SBModule::GetNumSymbols() { @@ -410,7 +409,7 @@ const bool symbols_ok = true; const bool inlines_ok = true; FunctionNameType type = static_cast(name_type_mask); - module_sp->FindFunctions(ConstString(name), NULL, type, symbols_ok, + module_sp->FindFunctions(ConstString(name), nullptr, type, symbols_ok, inlines_ok, append, *sb_sc_list); } return LLDB_RECORD_RESULT(sb_sc_list); @@ -427,7 +426,7 @@ if (name && module_sp) { VariableList variable_list; const uint32_t match_count = module_sp->FindGlobalVariables( - ConstString(name), NULL, max_matches, variable_list); + ConstString(name), nullptr, max_matches, variable_list); if (match_count > 0) { for (uint32_t i = 0; i < match_count; ++i) { @@ -558,7 +557,7 @@ TypeClass type_class = static_cast(type_mask); TypeList type_list; - vendor->GetTypes(NULL, type_class, type_list); + vendor->GetTypes(nullptr, type_class, type_list); sb_type_list.m_opaque_up->Append(type_list); return LLDB_RECORD_RESULT(sb_type_list); } @@ -606,7 +605,7 @@ ConstString const_triple(triple.c_str()); return const_triple.GetCString(); } - return NULL; + return nullptr; } uint32_t SBModule::GetAddressByteSize() { Index: source/API/SBPlatform.cpp =================================================================== --- source/API/SBPlatform.cpp +++ source/API/SBPlatform.cpp @@ -28,7 +28,7 @@ // PlatformConnectOptions struct PlatformConnectOptions { - PlatformConnectOptions(const char *url = NULL) + PlatformConnectOptions(const char *url = nullptr) : m_url(), m_rsync_options(), m_rsync_remote_path_prefix(), m_rsync_enabled(false), m_rsync_omit_hostname_from_remote_path(false), m_local_cache_directory() { @@ -48,7 +48,7 @@ // PlatformShellCommand struct PlatformShellCommand { - PlatformShellCommand(const char *shell_command = NULL) + PlatformShellCommand(const char *shell_command = nullptr) : m_command(), m_working_dir(), m_status(0), m_signo(0) { if (shell_command && shell_command[0]) m_command = shell_command; @@ -94,7 +94,7 @@ LLDB_RECORD_METHOD_NO_ARGS(const char *, SBPlatformConnectOptions, GetURL); if (m_opaque_ptr->m_url.empty()) - return NULL; + return nullptr; return m_opaque_ptr->m_url.c_str(); } @@ -188,7 +188,7 @@ LLDB_RECORD_METHOD_NO_ARGS(const char *, SBPlatformShellCommand, GetCommand); if (m_opaque_ptr->m_command.empty()) - return NULL; + return nullptr; return m_opaque_ptr->m_command.c_str(); } @@ -207,7 +207,7 @@ GetWorkingDirectory); if (m_opaque_ptr->m_working_dir.empty()) - return NULL; + return nullptr; return m_opaque_ptr->m_working_dir.c_str(); } @@ -256,7 +256,7 @@ LLDB_RECORD_METHOD_NO_ARGS(const char *, SBPlatformShellCommand, GetOutput); if (m_opaque_ptr->m_output.empty()) - return NULL; + return nullptr; return m_opaque_ptr->m_output.c_str(); } @@ -282,7 +282,7 @@ SBPlatform::operator bool() const { LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBPlatform, operator bool); - return m_opaque_sp.get() != NULL; + return m_opaque_sp.get() != nullptr; } void SBPlatform::Clear() { @@ -297,7 +297,7 @@ PlatformSP platform_sp(GetSP()); if (platform_sp) return platform_sp->GetName().GetCString(); - return NULL; + return nullptr; } lldb::PlatformSP SBPlatform::GetSP() const { return m_opaque_sp; } @@ -312,7 +312,7 @@ PlatformSP platform_sp(GetSP()); if (platform_sp) return platform_sp->GetWorkingDirectory().GetCString(); - return NULL; + return nullptr; } bool SBPlatform::SetWorkingDirectory(const char *path) { @@ -376,7 +376,7 @@ return ConstString(arch.GetTriple().getTriple().c_str()).GetCString(); } } - return NULL; + return nullptr; } const char *SBPlatform::GetOSBuild() { @@ -393,7 +393,7 @@ } } } - return NULL; + return nullptr; } const char *SBPlatform::GetOSDescription() { @@ -410,7 +410,7 @@ } } } - return NULL; + return nullptr; } const char *SBPlatform::GetHostname() { @@ -419,7 +419,7 @@ PlatformSP platform_sp(GetSP()); if (platform_sp) return platform_sp->GetHostname(); - return NULL; + return nullptr; } uint32_t SBPlatform::GetOSMajorVersion() { @@ -513,7 +513,7 @@ return Status("invalid shell command (empty)"); const char *working_dir = shell_command.GetWorkingDirectory(); - if (working_dir == NULL) { + if (working_dir == nullptr) { working_dir = platform_sp->GetWorkingDirectory().GetCString(); if (working_dir) shell_command.SetWorkingDirectory(working_dir); Index: source/API/SBProcess.cpp =================================================================== --- source/API/SBProcess.cpp +++ source/API/SBProcess.cpp @@ -335,7 +335,7 @@ LLDB_RECORD_METHOD_CONST(void, SBProcess, ReportEventState, (const lldb::SBEvent &, FILE *), event, out); - if (out == NULL) + if (out == nullptr) return; ProcessSP process_sp(GetSP()); @@ -534,7 +534,7 @@ const char *SBProcess::GetExitDescription() { LLDB_RECORD_METHOD_NO_ARGS(const char *, SBProcess, GetExitDescription); - const char *exit_desc = NULL; + const char *exit_desc = nullptr; ProcessSP process_sp(GetSP()); if (process_sp) { std::lock_guard guard( @@ -602,7 +602,7 @@ if (process_sp->GetTarget().GetDebugger().GetAsyncExecution()) sb_error.ref() = process_sp->Resume(); else - sb_error.ref() = process_sp->ResumeSynchronous(NULL); + sb_error.ref() = process_sp->ResumeSynchronous(nullptr); } else sb_error.SetErrorString("SBProcess is invalid"); @@ -985,7 +985,7 @@ char path[PATH_MAX]; GetTarget().GetExecutable().GetPath(path, sizeof(path)); Module *exe_module = process_sp->GetTarget().GetExecutableModulePointer(); - const char *exe_name = NULL; + const char *exe_name = nullptr; if (exe_module) exe_name = exe_module->GetFileSpec().GetFilename().AsCString(); @@ -1156,7 +1156,7 @@ return names[idx].AsCString(); } } - return NULL; + return nullptr; } SBThreadCollection SBProcess::GetHistoryThreads(addr_t addr) { Index: source/API/SBQueue.cpp =================================================================== --- source/API/SBQueue.cpp +++ source/API/SBQueue.cpp @@ -49,7 +49,7 @@ ~QueueImpl() {} - bool IsValid() { return m_queue_wp.lock() != NULL; } + bool IsValid() { return m_queue_wp.lock() != nullptr; } void Clear() { m_queue_wp.reset(); @@ -83,7 +83,7 @@ } const char *GetName() const { - const char *name = NULL; + const char *name = nullptr; lldb::QueueSP queue_sp = m_queue_wp.lock(); if (queue_sp.get()) { name = queue_sp->GetName(); Index: source/API/SBQueueItem.cpp =================================================================== --- source/API/SBQueueItem.cpp +++ source/API/SBQueueItem.cpp @@ -41,7 +41,7 @@ SBQueueItem::operator bool() const { LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBQueueItem, operator bool); - return m_queue_item_sp.get() != NULL; + return m_queue_item_sp.get() != nullptr; } void SBQueueItem::Clear() { Index: source/API/SBSection.cpp =================================================================== --- source/API/SBSection.cpp +++ source/API/SBSection.cpp @@ -54,7 +54,7 @@ LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBSection, operator bool); SectionSP section_sp(GetSP()); - return section_sp && section_sp->GetModule().get() != NULL; + return section_sp && section_sp->GetModule().get() != nullptr; } const char *SBSection::GetName() { @@ -63,7 +63,7 @@ SectionSP section_sp(GetSP()); if (section_sp) return section_sp->GetName().GetCString(); - return NULL; + return nullptr; } lldb::SBSection SBSection::GetParent() { Index: source/API/SBSourceManager.cpp =================================================================== --- source/API/SBSourceManager.cpp +++ source/API/SBSourceManager.cpp @@ -131,7 +131,7 @@ const char *, lldb::SBStream &), file, line, column, context_before, context_after, current_line_cstr, s); - if (m_opaque_up == NULL) + if (m_opaque_up == nullptr) return 0; return m_opaque_up->DisplaySourceLinesWithLineNumbers( Index: source/API/SBStream.cpp =================================================================== --- source/API/SBStream.cpp +++ source/API/SBStream.cpp @@ -34,7 +34,7 @@ SBStream::operator bool() const { LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBStream, operator bool); - return (m_opaque_up != NULL); + return (m_opaque_up != nullptr); } // If this stream is not redirected to a file, it will maintain a local cache @@ -42,8 +42,8 @@ const char *SBStream::GetData() { LLDB_RECORD_METHOD_NO_ARGS(const char *, SBStream, GetData); - if (m_is_file || m_opaque_up == NULL) - return NULL; + if (m_is_file || m_opaque_up == nullptr) + return nullptr; return static_cast(m_opaque_up.get())->GetData(); } @@ -53,7 +53,7 @@ size_t SBStream::GetSize() { LLDB_RECORD_METHOD_NO_ARGS(size_t, SBStream, GetSize); - if (m_is_file || m_opaque_up == NULL) + if (m_is_file || m_opaque_up == nullptr) return 0; return static_cast(m_opaque_up.get())->GetSize(); @@ -160,7 +160,7 @@ lldb_private::Stream *SBStream::get() { return m_opaque_up.get(); } lldb_private::Stream &SBStream::ref() { - if (m_opaque_up == NULL) + if (m_opaque_up == nullptr) m_opaque_up.reset(new StreamString()); return *m_opaque_up; } Index: source/API/SBStringList.cpp =================================================================== --- source/API/SBStringList.cpp +++ source/API/SBStringList.cpp @@ -56,13 +56,13 @@ SBStringList::operator bool() const { LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBStringList, operator bool); - return (m_opaque_up != NULL); + return (m_opaque_up != nullptr); } void SBStringList::AppendString(const char *str) { LLDB_RECORD_METHOD(void, SBStringList, AppendString, (const char *), str); - if (str != NULL) { + if (str != nullptr) { if (IsValid()) m_opaque_up->AppendString(str); else @@ -74,7 +74,7 @@ LLDB_RECORD_METHOD(void, SBStringList, AppendList, (const char **, int), strv, strc); - if ((strv != NULL) && (strc > 0)) { + if ((strv != nullptr) && (strc > 0)) { if (IsValid()) m_opaque_up->AppendList(strv, strc); else @@ -115,7 +115,7 @@ if (IsValid()) { return m_opaque_up->GetStringAtIndex(idx); } - return NULL; + return nullptr; } const char *SBStringList::GetStringAtIndex(size_t idx) const { @@ -125,7 +125,7 @@ if (IsValid()) { return m_opaque_up->GetStringAtIndex(idx); } - return NULL; + return nullptr; } void SBStringList::Clear() { Index: source/API/SBSymbol.cpp =================================================================== --- source/API/SBSymbol.cpp +++ source/API/SBSymbol.cpp @@ -18,7 +18,7 @@ using namespace lldb; using namespace lldb_private; -SBSymbol::SBSymbol() : m_opaque_ptr(NULL) { +SBSymbol::SBSymbol() : m_opaque_ptr(nullptr) { LLDB_RECORD_CONSTRUCTOR_NO_ARGS(SBSymbol); } @@ -37,7 +37,7 @@ return LLDB_RECORD_RESULT(*this); } -SBSymbol::~SBSymbol() { m_opaque_ptr = NULL; } +SBSymbol::~SBSymbol() { m_opaque_ptr = nullptr; } void SBSymbol::SetSymbol(lldb_private::Symbol *lldb_object_ptr) { m_opaque_ptr = lldb_object_ptr; @@ -50,13 +50,13 @@ SBSymbol::operator bool() const { LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBSymbol, operator bool); - return m_opaque_ptr != NULL; + return m_opaque_ptr != nullptr; } const char *SBSymbol::GetName() const { LLDB_RECORD_METHOD_CONST_NO_ARGS(const char *, SBSymbol, GetName); - const char *name = NULL; + const char *name = nullptr; if (m_opaque_ptr) name = m_opaque_ptr->GetName().AsCString(); @@ -66,7 +66,7 @@ const char *SBSymbol::GetDisplayName() const { LLDB_RECORD_METHOD_CONST_NO_ARGS(const char *, SBSymbol, GetDisplayName); - const char *name = NULL; + const char *name = nullptr; if (m_opaque_ptr) name = m_opaque_ptr->GetMangled() .GetDisplayDemangledName(m_opaque_ptr->GetLanguage()) @@ -78,7 +78,7 @@ const char *SBSymbol::GetMangledName() const { LLDB_RECORD_METHOD_CONST_NO_ARGS(const char *, SBSymbol, GetMangledName); - const char *name = NULL; + const char *name = nullptr; if (m_opaque_ptr) name = m_opaque_ptr->GetMangled().GetMangledName().AsCString(); return name; @@ -105,7 +105,7 @@ Stream &strm = description.ref(); if (m_opaque_ptr) { - m_opaque_ptr->GetDescription(&strm, lldb::eDescriptionLevelFull, NULL); + m_opaque_ptr->GetDescription(&strm, lldb::eDescriptionLevelFull, nullptr); } else strm.PutCString("No value"); @@ -116,7 +116,7 @@ LLDB_RECORD_METHOD(lldb::SBInstructionList, SBSymbol, GetInstructions, (lldb::SBTarget), target); - return LLDB_RECORD_RESULT(GetInstructions(target, NULL)); + return LLDB_RECORD_RESULT(GetInstructions(target, nullptr)); } SBInstructionList SBSymbol::GetInstructions(SBTarget target, @@ -141,7 +141,7 @@ AddressRange symbol_range(symbol_addr, m_opaque_ptr->GetByteSize()); const bool prefer_file_cache = false; sb_instructions.SetDisassembler(Disassembler::DisassembleRange( - module_sp->GetArchitecture(), NULL, flavor_string, exe_ctx, + module_sp->GetArchitecture(), nullptr, flavor_string, exe_ctx, symbol_range, prefer_file_cache)); } } Index: source/API/SBSymbolContext.cpp =================================================================== --- source/API/SBSymbolContext.cpp +++ source/API/SBSymbolContext.cpp @@ -63,7 +63,7 @@ SBSymbolContext::operator bool() const { LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBSymbolContext, operator bool); - return m_opaque_up != NULL; + return m_opaque_up != nullptr; } SBModule SBSymbolContext::GetModule() { @@ -84,13 +84,13 @@ GetCompileUnit); return LLDB_RECORD_RESULT( - SBCompileUnit(m_opaque_up ? m_opaque_up->comp_unit : NULL)); + SBCompileUnit(m_opaque_up ? m_opaque_up->comp_unit : nullptr)); } SBFunction SBSymbolContext::GetFunction() { LLDB_RECORD_METHOD_NO_ARGS(lldb::SBFunction, SBSymbolContext, GetFunction); - Function *function = NULL; + Function *function = nullptr; if (m_opaque_up) function = m_opaque_up->function; @@ -103,7 +103,8 @@ SBBlock SBSymbolContext::GetBlock() { LLDB_RECORD_METHOD_NO_ARGS(lldb::SBBlock, SBSymbolContext, GetBlock); - return LLDB_RECORD_RESULT(SBBlock(m_opaque_up ? m_opaque_up->block : NULL)); + return LLDB_RECORD_RESULT( + SBBlock(m_opaque_up ? m_opaque_up->block : nullptr)); } SBLineEntry SBSymbolContext::GetLineEntry() { @@ -119,7 +120,7 @@ SBSymbol SBSymbolContext::GetSymbol() { LLDB_RECORD_METHOD_NO_ARGS(lldb::SBSymbol, SBSymbolContext, GetSymbol); - Symbol *symbol = NULL; + Symbol *symbol = nullptr; if (m_opaque_up) symbol = m_opaque_up->symbol; @@ -183,13 +184,13 @@ } lldb_private::SymbolContext &SBSymbolContext::operator*() { - if (m_opaque_up == NULL) + if (m_opaque_up == nullptr) m_opaque_up.reset(new SymbolContext); return *m_opaque_up; } lldb_private::SymbolContext &SBSymbolContext::ref() { - if (m_opaque_up == NULL) + if (m_opaque_up == nullptr) m_opaque_up.reset(new SymbolContext); return *m_opaque_up; } @@ -205,7 +206,7 @@ Stream &strm = description.ref(); if (m_opaque_up) { - m_opaque_up->GetDescription(&strm, lldb::eDescriptionLevelFull, NULL); + m_opaque_up->GetDescription(&strm, lldb::eDescriptionLevelFull, nullptr); } else strm.PutCString("No value"); Index: source/API/SBSymbolContextList.cpp =================================================================== --- source/API/SBSymbolContextList.cpp +++ source/API/SBSymbolContextList.cpp @@ -93,7 +93,7 @@ SBSymbolContextList::operator bool() const { LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBSymbolContextList, operator bool); - return m_opaque_up != NULL; + return m_opaque_up != nullptr; } lldb_private::SymbolContextList *SBSymbolContextList::operator->() const { @@ -111,7 +111,7 @@ Stream &strm = description.ref(); if (m_opaque_up) - m_opaque_up->GetDescription(&strm, lldb::eDescriptionLevelFull, NULL); + m_opaque_up->GetDescription(&strm, lldb::eDescriptionLevelFull, nullptr); return true; } Index: source/API/SBTarget.cpp =================================================================== --- source/API/SBTarget.cpp +++ source/API/SBTarget.cpp @@ -126,7 +126,7 @@ LLDB_RECORD_STATIC_METHOD(bool, SBTarget, EventIsTargetEvent, (const lldb::SBEvent &), event); - return Target::TargetEventData::GetEventDataFromEvent(event.get()) != NULL; + return Target::TargetEventData::GetEventDataFromEvent(event.get()) != nullptr; } SBTarget SBTarget::GetTargetFromEvent(const SBEvent &event) { @@ -171,7 +171,7 @@ SBTarget::operator bool() const { LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBTarget, operator bool); - return m_opaque_sp.get() != NULL && m_opaque_sp->IsValid(); + return m_opaque_sp.get() != nullptr && m_opaque_sp->IsValid(); } SBProcess SBTarget::GetProcess() { @@ -288,9 +288,9 @@ (const char **, const char **, const char *), argv, envp, working_directory); - char *stdin_path = NULL; - char *stdout_path = NULL; - char *stderr_path = NULL; + char *stdin_path = nullptr; + char *stdout_path = nullptr; + char *stderr_path = nullptr; uint32_t launch_flags = 0; bool stop_at_entry = false; SBError error; @@ -307,7 +307,7 @@ TargetSP target_sp(GetSP()); if (target_sp) { std::lock_guard guard(target_sp->GetAPIMutex()); - sb_error.ref() = target_sp->Install(NULL); + sb_error.ref() = target_sp->Install(nullptr); } return LLDB_RECORD_RESULT(sb_error); } @@ -381,7 +381,7 @@ if (listener.IsValid()) launch_info.SetListener(listener.GetSP()); - error.SetError(target_sp->Launch(launch_info, NULL)); + error.SetError(target_sp->Launch(launch_info, nullptr)); sb_process.SetSP(target_sp->GetProcessSP()); } else { @@ -430,7 +430,7 @@ if (arch_spec.IsValid()) launch_info.GetArchitecture() = arch_spec; - error.SetError(target_sp->Launch(launch_info, NULL)); + error.SetError(target_sp->Launch(launch_info, nullptr)); sb_launch_info.set_ref(launch_info); sb_process.SetSP(target_sp->GetProcessSP()); } else { @@ -551,14 +551,14 @@ std::lock_guard guard(target_sp->GetAPIMutex()); if (listener.IsValid()) process_sp = - target_sp->CreateProcess(listener.m_opaque_sp, plugin_name, NULL); + target_sp->CreateProcess(listener.m_opaque_sp, plugin_name, nullptr); else process_sp = target_sp->CreateProcess( - target_sp->GetDebugger().GetListener(), plugin_name, NULL); + target_sp->GetDebugger().GetListener(), plugin_name, nullptr); if (process_sp) { sb_process.SetSP(process_sp); - error.SetError(process_sp->ConnectRemote(NULL, url)); + error.SetError(process_sp->ConnectRemote(nullptr, url)); } else { error.SetErrorString("unable to create lldb_private::Process"); } @@ -788,12 +788,12 @@ FileSpecList module_spec_list; module_spec_list.Append(FileSpec(module_name)); sb_bp = target_sp->CreateBreakpoint( - &module_spec_list, NULL, symbol_name, eFunctionNameTypeAuto, + &module_spec_list, nullptr, symbol_name, eFunctionNameTypeAuto, eLanguageTypeUnknown, offset, skip_prologue, internal, hardware); } else { sb_bp = target_sp->CreateBreakpoint( - NULL, NULL, symbol_name, eFunctionNameTypeAuto, eLanguageTypeUnknown, - offset, skip_prologue, internal, hardware); + nullptr, nullptr, symbol_name, eFunctionNameTypeAuto, + eLanguageTypeUnknown, offset, skip_prologue, internal, hardware); } } @@ -1425,7 +1425,7 @@ // Target::CreateWatchpoint() is thread safe. Status cw_error; // This API doesn't take in a type, so we can't figure out what it is. - CompilerType *type = NULL; + CompilerType *type = nullptr; watchpoint_sp = target_sp->CreateWatchpoint(addr, size, type, watch_type, cw_error); error.SetError(cw_error); @@ -1559,7 +1559,7 @@ (const char *, const char *, const char *), path, triple, uuid_cstr); - return LLDB_RECORD_RESULT(AddModule(path, triple, uuid_cstr, NULL)); + return LLDB_RECORD_RESULT(AddModule(path, triple, uuid_cstr, nullptr)); } lldb::SBModule SBTarget::AddModule(const char *path, const char *triple, @@ -1683,7 +1683,7 @@ ConstString const_triple(triple.c_str()); return const_triple.GetCString(); } - return NULL; + return nullptr; } uint32_t SBTarget::GetDataByteSize() { @@ -1969,7 +1969,7 @@ if (match_count > 0) { ExecutionContextScope *exe_scope = target_sp->GetProcessSP().get(); - if (exe_scope == NULL) + if (exe_scope == nullptr) exe_scope = target_sp.get(); for (uint32_t i = 0; i < match_count; ++i) { lldb::ValueObjectSP valobj_sp(ValueObjectVariable::Create( @@ -2017,7 +2017,7 @@ if (match_count > 0) { ExecutionContextScope *exe_scope = target_sp->GetProcessSP().get(); - if (exe_scope == NULL) + if (exe_scope == nullptr) exe_scope = target_sp.get(); for (uint32_t i = 0; i < match_count; ++i) { lldb::ValueObjectSP valobj_sp(ValueObjectVariable::Create( @@ -2053,7 +2053,7 @@ LLDB_RECORD_METHOD(lldb::SBInstructionList, SBTarget, ReadInstructions, (lldb::SBAddress, uint32_t), base_addr, count); - return LLDB_RECORD_RESULT(ReadInstructions(base_addr, count, NULL)); + return LLDB_RECORD_RESULT(ReadInstructions(base_addr, count, nullptr)); } lldb::SBInstructionList SBTarget::ReadInstructions(lldb::SBAddress base_addr, @@ -2080,7 +2080,7 @@ data.GetByteSize(), error, &load_addr); const bool data_from_file = load_addr == LLDB_INVALID_ADDRESS; sb_instructions.SetDisassembler(Disassembler::DisassembleBytes( - target_sp->GetArchitecture(), NULL, flavor_string, *addr_ptr, + target_sp->GetArchitecture(), nullptr, flavor_string, *addr_ptr, data.GetBytes(), bytes_read, count, data_from_file)); } } @@ -2095,7 +2095,7 @@ (lldb::SBAddress, const void *, size_t), base_addr, buf, size); - return GetInstructionsWithFlavor(base_addr, NULL, buf, size); + return GetInstructionsWithFlavor(base_addr, nullptr, buf, size); } lldb::SBInstructionList @@ -2119,7 +2119,7 @@ const bool data_from_file = true; sb_instructions.SetDisassembler(Disassembler::DisassembleBytes( - target_sp->GetArchitecture(), NULL, flavor_string, addr, buf, size, + target_sp->GetArchitecture(), nullptr, flavor_string, addr, buf, size, UINT32_MAX, data_from_file)); } @@ -2132,7 +2132,7 @@ LLDB_RECORD_DUMMY(lldb::SBInstructionList, SBTarget, GetInstructions, (lldb::addr_t, const void *, size_t), base_addr, buf, size); - return GetInstructionsWithFlavor(ResolveLoadAddress(base_addr), NULL, buf, + return GetInstructionsWithFlavor(ResolveLoadAddress(base_addr), nullptr, buf, size); } @@ -2353,9 +2353,9 @@ SBValue expr_result; ValueObjectSP expr_value_sp; TargetSP target_sp(GetSP()); - StackFrame *frame = NULL; + StackFrame *frame = nullptr; if (target_sp) { - if (expr == NULL || expr[0] == '\0') { + if (expr == nullptr || expr[0] == '\0') { return LLDB_RECORD_RESULT(expr_result); } @@ -2409,7 +2409,7 @@ lldb::SBLaunchInfo SBTarget::GetLaunchInfo() const { LLDB_RECORD_METHOD_CONST_NO_ARGS(lldb::SBLaunchInfo, SBTarget, GetLaunchInfo); - lldb::SBLaunchInfo launch_info(NULL); + lldb::SBLaunchInfo launch_info(nullptr); TargetSP target_sp(GetSP()); if (target_sp) launch_info.set_ref(m_opaque_sp->GetProcessLaunchInfo()); Index: source/API/SBThread.cpp =================================================================== --- source/API/SBThread.cpp +++ source/API/SBThread.cpp @@ -122,7 +122,7 @@ if (target && process) { Process::StopLocker stop_locker; if (stop_locker.TryLock(&process->GetRunLock())) - return m_opaque_sp->GetThreadSP().get() != NULL; + return m_opaque_sp->GetThreadSP().get() != nullptr; } // Without a valid target & process, this thread can't be valid. return false; @@ -359,7 +359,7 @@ stop_desc = exe_ctx.GetProcessPtr()->GetUnixSignals()->GetSignalAsCString( stop_info_sp->GetValue()); - if (stop_desc == NULL || stop_desc[0] == '\0') { + if (stop_desc == nullptr || stop_desc[0] == '\0') { static char signal_desc[] = "signal"; stop_desc = signal_desc; stop_desc_len = @@ -452,7 +452,7 @@ const char *SBThread::GetName() const { LLDB_RECORD_METHOD_CONST_NO_ARGS(const char *, SBThread, GetName); - const char *name = NULL; + const char *name = nullptr; std::unique_lock lock; ExecutionContext exe_ctx(m_opaque_sp.get(), lock); @@ -469,7 +469,7 @@ const char *SBThread::GetQueueName() const { LLDB_RECORD_METHOD_CONST_NO_ARGS(const char *, SBThread, GetQueueName); - const char *name = NULL; + const char *name = nullptr; std::unique_lock lock; ExecutionContext exe_ctx(m_opaque_sp.get(), lock); @@ -566,7 +566,7 @@ // User level plans should be Master Plans so they can be interrupted, other // plans executed, and then a "continue" will resume the plan. - if (new_plan != NULL) { + if (new_plan != nullptr) { new_plan->SetIsMasterPlan(true); new_plan->SetOkayToDiscard(false); } @@ -577,7 +577,7 @@ if (process->GetTarget().GetDebugger().GetAsyncExecution()) sb_error.ref() = process->Resume(); else - sb_error.ref() = process->ResumeSynchronous(NULL); + sb_error.ref() = process->ResumeSynchronous(nullptr); return sb_error; } @@ -627,7 +627,7 @@ LLDB_RECORD_METHOD(void, SBThread, StepInto, (lldb::RunMode), stop_other_threads); - StepInto(NULL, stop_other_threads); + StepInto(nullptr, stop_other_threads); } void SBThread::StepInto(const char *target_name, @@ -716,7 +716,7 @@ const LazyBool avoid_no_debug = eLazyBoolCalculate; Status new_plan_status; ThreadPlanSP new_plan_sp(thread->QueueThreadPlanForStepOut( - abort_other_plans, NULL, false, stop_other_threads, eVoteYes, + abort_other_plans, nullptr, false, stop_other_threads, eVoteYes, eVoteNoOpinion, 0, new_plan_status, avoid_no_debug)); if (new_plan_status.Success()) @@ -763,7 +763,7 @@ Status new_plan_status; ThreadPlanSP new_plan_sp(thread->QueueThreadPlanForStepOut( - abort_other_plans, NULL, false, stop_other_threads, eVoteYes, + abort_other_plans, nullptr, false, stop_other_threads, eVoteYes, eVoteNoOpinion, frame_sp->GetFrameIndex(), new_plan_status)); if (new_plan_status.Success()) @@ -878,7 +878,7 @@ eSymbolContextCompUnit | eSymbolContextFunction | eSymbolContextLineEntry | eSymbolContextSymbol); - if (frame_sc.comp_unit == NULL) { + if (frame_sc.comp_unit == nullptr) { sb_error.SetErrorStringWithFormat( "frame %u doesn't have debug information", frame_sp->GetFrameIndex()); return LLDB_RECORD_RESULT(sb_error); @@ -1235,7 +1235,7 @@ LLDB_RECORD_STATIC_METHOD(bool, SBThread, EventIsThreadEvent, (const lldb::SBEvent &), event); - return Thread::ThreadEventData::GetEventDataFromEvent(event.get()) != NULL; + return Thread::ThreadEventData::GetEventDataFromEvent(event.get()) != nullptr; } SBFrame SBThread::GetStackFrameFromEvent(const SBEvent &event) { Index: source/API/SBThreadCollection.cpp =================================================================== --- source/API/SBThreadCollection.cpp +++ source/API/SBThreadCollection.cpp @@ -67,7 +67,7 @@ SBThreadCollection::operator bool() const { LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBThreadCollection, operator bool); - return m_opaque_sp.get() != NULL; + return m_opaque_sp.get() != nullptr; } size_t SBThreadCollection::GetSize() { Index: source/API/SBThreadPlan.cpp =================================================================== --- source/API/SBThreadPlan.cpp +++ source/API/SBThreadPlan.cpp @@ -92,7 +92,7 @@ SBThreadPlan::operator bool() const { LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBThreadPlan, operator bool); - return m_opaque_sp.get() != NULL; + return m_opaque_sp.get() != nullptr; } void SBThreadPlan::Clear() { @@ -262,7 +262,7 @@ Status plan_status; SBThreadPlan plan = SBThreadPlan(m_opaque_sp->GetThread().QueueThreadPlanForStepInRange( - false, range, sc, NULL, eAllThreads, plan_status)); + false, range, sc, nullptr, eAllThreads, plan_status)); if (plan_status.Fail()) error.SetErrorString(plan_status.AsCString()); Index: source/API/SBType.cpp =================================================================== --- source/API/SBType.cpp +++ source/API/SBType.cpp @@ -92,7 +92,7 @@ SBType::~SBType() {} TypeImpl &SBType::ref() { - if (m_opaque_sp.get() == NULL) + if (m_opaque_sp.get() == nullptr) m_opaque_sp = std::make_shared(); return *m_opaque_sp; } @@ -112,7 +112,7 @@ SBType::operator bool() const { LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBType, operator bool); - if (m_opaque_sp.get() == NULL) + if (m_opaque_sp.get() == nullptr) return false; return m_opaque_sp->IsValid(); @@ -579,7 +579,7 @@ SBTypeList::operator bool() const { LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBTypeList, operator bool); - return (m_opaque_up != NULL); + return (m_opaque_up != nullptr); } SBTypeList &SBTypeList::operator=(const SBTypeList &rhs) { @@ -660,7 +660,7 @@ if (m_opaque_up) return m_opaque_up->GetName().GetCString(); - return NULL; + return nullptr; } SBType SBTypeMember::GetType() { @@ -743,7 +743,7 @@ } TypeMemberImpl &SBTypeMember::ref() { - if (m_opaque_up == NULL) + if (m_opaque_up == nullptr) m_opaque_up.reset(new TypeMemberImpl()); return *m_opaque_up; } @@ -789,7 +789,7 @@ if (m_opaque_sp) return m_opaque_sp->GetName().GetCString(); - return NULL; + return nullptr; } const char *SBTypeMemberFunction::GetDemangledName() { @@ -803,7 +803,7 @@ return mangled.GetDemangledName(mangled.GuessLanguage()).GetCString(); } } - return NULL; + return nullptr; } const char *SBTypeMemberFunction::GetMangledName() { @@ -812,7 +812,7 @@ if (m_opaque_sp) return m_opaque_sp->GetMangledName().GetCString(); - return NULL; + return nullptr; } SBType SBTypeMemberFunction::GetType() { Index: source/API/SBTypeCategory.cpp =================================================================== --- source/API/SBTypeCategory.cpp +++ source/API/SBTypeCategory.cpp @@ -49,7 +49,7 @@ SBTypeCategory::operator bool() const { LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBTypeCategory, operator bool); - return (m_opaque_sp.get() != NULL); + return (m_opaque_sp.get() != nullptr); } bool SBTypeCategory::GetEnabled() { @@ -75,7 +75,7 @@ LLDB_RECORD_METHOD_NO_ARGS(const char *, SBTypeCategory, GetName); if (!IsValid()) - return NULL; + return nullptr; return m_opaque_sp->GetName(); } Index: source/API/SBTypeEnumMember.cpp =================================================================== --- source/API/SBTypeEnumMember.cpp +++ source/API/SBTypeEnumMember.cpp @@ -64,7 +64,7 @@ if (m_opaque_sp.get()) return m_opaque_sp->GetName().GetCString(); - return NULL; + return nullptr; } int64_t SBTypeEnumMember::GetValueAsSigned() { @@ -98,7 +98,7 @@ } TypeEnumMemberImpl &SBTypeEnumMember::ref() { - if (m_opaque_sp.get() == NULL) + if (m_opaque_sp.get() == nullptr) m_opaque_sp = std::make_shared(); return *m_opaque_sp.get(); } @@ -130,7 +130,7 @@ SBTypeEnumMemberList::operator bool() const { LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBTypeEnumMemberList, operator bool); - return (m_opaque_up != NULL); + return (m_opaque_up != nullptr); } SBTypeEnumMemberList &SBTypeEnumMemberList:: Index: source/API/SBTypeFilter.cpp =================================================================== --- source/API/SBTypeFilter.cpp +++ source/API/SBTypeFilter.cpp @@ -40,7 +40,7 @@ SBTypeFilter::operator bool() const { LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBTypeFilter, operator bool); - return m_opaque_sp.get() != NULL; + return m_opaque_sp.get() != nullptr; } uint32_t SBTypeFilter::GetOptions() { @@ -98,7 +98,7 @@ item++; return item; } - return NULL; + return nullptr; } bool SBTypeFilter::ReplaceExpressionPathAtIndex(uint32_t i, const char *item) { Index: source/API/SBTypeFormat.cpp =================================================================== --- source/API/SBTypeFormat.cpp +++ source/API/SBTypeFormat.cpp @@ -49,7 +49,7 @@ SBTypeFormat::operator bool() const { LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBTypeFormat, operator bool); - return m_opaque_sp.get() != NULL; + return m_opaque_sp.get() != nullptr; } lldb::Format SBTypeFormat::GetFormat() { Index: source/API/SBTypeNameSpecifier.cpp =================================================================== --- source/API/SBTypeNameSpecifier.cpp +++ source/API/SBTypeNameSpecifier.cpp @@ -27,7 +27,7 @@ LLDB_RECORD_CONSTRUCTOR(SBTypeNameSpecifier, (const char *, bool), name, is_regex); - if (name == NULL || (*name) == 0) + if (name == nullptr || (*name) == 0) m_opaque_sp.reset(); } @@ -54,14 +54,14 @@ SBTypeNameSpecifier::operator bool() const { LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBTypeNameSpecifier, operator bool); - return m_opaque_sp.get() != NULL; + return m_opaque_sp.get() != nullptr; } const char *SBTypeNameSpecifier::GetName() { LLDB_RECORD_METHOD_NO_ARGS(const char *, SBTypeNameSpecifier, GetName); if (!IsValid()) - return NULL; + return nullptr; return m_opaque_sp->GetName(); } @@ -129,7 +129,7 @@ if (IsRegex() != rhs.IsRegex()) return false; - if (GetName() == NULL || rhs.GetName() == NULL) + if (GetName() == nullptr || rhs.GetName() == nullptr) return false; return (strcmp(GetName(), rhs.GetName()) == 0); Index: source/API/SBTypeSummary.cpp =================================================================== --- source/API/SBTypeSummary.cpp +++ source/API/SBTypeSummary.cpp @@ -202,7 +202,7 @@ SBTypeSummary::operator bool() const { LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBTypeSummary, operator bool); - return m_opaque_sp.get() != NULL; + return m_opaque_sp.get() != nullptr; } bool SBTypeSummary::IsFunctionCode() { @@ -244,7 +244,7 @@ LLDB_RECORD_METHOD_NO_ARGS(const char *, SBTypeSummary, GetData); if (!IsValid()) - return NULL; + return nullptr; if (ScriptSummaryFormat *script_summary_ptr = llvm::dyn_cast(m_opaque_sp.get())) { const char *fname = script_summary_ptr->GetFunctionName(); Index: source/API/SBTypeSynthetic.cpp =================================================================== --- source/API/SBTypeSynthetic.cpp +++ source/API/SBTypeSynthetic.cpp @@ -60,7 +60,7 @@ SBTypeSynthetic::operator bool() const { LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBTypeSynthetic, operator bool); - return m_opaque_sp.get() != NULL; + return m_opaque_sp.get() != nullptr; } bool SBTypeSynthetic::IsClassCode() { @@ -84,7 +84,7 @@ LLDB_RECORD_METHOD_NO_ARGS(const char *, SBTypeSynthetic, GetData); if (!IsValid()) - return NULL; + return nullptr; if (IsClassCode()) return m_opaque_sp->GetPythonCode(); else Index: source/API/SBValue.cpp =================================================================== --- source/API/SBValue.cpp +++ source/API/SBValue.cpp @@ -57,7 +57,7 @@ ValueImpl(lldb::ValueObjectSP in_valobj_sp, lldb::DynamicValueType use_dynamic, bool use_synthetic, - const char *name = NULL) + const char *name = nullptr) : m_valobj_sp(), m_use_dynamic(use_dynamic), m_use_synthetic(use_synthetic), m_name(name) { if (in_valobj_sp) { @@ -84,7 +84,7 @@ } bool IsValid() { - if (m_valobj_sp.get() == NULL) + if (m_valobj_sp.get() == nullptr) return false; else { // FIXME: This check is necessary but not sufficient. We for sure don't @@ -251,8 +251,8 @@ // If this function ever changes to anything that does more than just check // if the opaque shared pointer is non NULL, then we need to update all "if // (m_opaque_sp)" code in this file. - return m_opaque_sp.get() != NULL && m_opaque_sp->IsValid() && - m_opaque_sp->GetRootSP().get() != NULL; + return m_opaque_sp.get() != nullptr && m_opaque_sp->IsValid() && + m_opaque_sp->GetRootSP().get() != nullptr; } void SBValue::Clear() { @@ -290,7 +290,7 @@ const char *SBValue::GetName() { LLDB_RECORD_METHOD_NO_ARGS(const char *, SBValue, GetName); - const char *name = NULL; + const char *name = nullptr; ValueLocker locker; lldb::ValueObjectSP value_sp(GetSP(locker)); if (value_sp) @@ -302,7 +302,7 @@ const char *SBValue::GetTypeName() { LLDB_RECORD_METHOD_NO_ARGS(const char *, SBValue, GetTypeName); - const char *name = NULL; + const char *name = nullptr; ValueLocker locker; lldb::ValueObjectSP value_sp(GetSP(locker)); if (value_sp) { @@ -315,7 +315,7 @@ const char *SBValue::GetDisplayTypeName() { LLDB_RECORD_METHOD_NO_ARGS(const char *, SBValue, GetDisplayTypeName); - const char *name = NULL; + const char *name = nullptr; ValueLocker locker; lldb::ValueObjectSP value_sp(GetSP(locker)); if (value_sp) { @@ -356,7 +356,7 @@ const char *SBValue::GetValue() { LLDB_RECORD_METHOD_NO_ARGS(const char *, SBValue, GetValue); - const char *cstr = NULL; + const char *cstr = nullptr; ValueLocker locker; lldb::ValueObjectSP value_sp(GetSP(locker)); if (value_sp) { @@ -381,7 +381,7 @@ const char *SBValue::GetObjectDescription() { LLDB_RECORD_METHOD_NO_ARGS(const char *, SBValue, GetObjectDescription); - const char *cstr = NULL; + const char *cstr = nullptr; ValueLocker locker; lldb::ValueObjectSP value_sp(GetSP(locker)); if (value_sp) { @@ -394,7 +394,7 @@ const char *SBValue::GetTypeValidatorResult() { LLDB_RECORD_METHOD_NO_ARGS(const char *, SBValue, GetTypeValidatorResult); - const char *cstr = NULL; + const char *cstr = nullptr; ValueLocker locker; lldb::ValueObjectSP value_sp(GetSP(locker)); if (value_sp) { @@ -442,7 +442,7 @@ const char *SBValue::GetSummary() { LLDB_RECORD_METHOD_NO_ARGS(const char *, SBValue, GetSummary); - const char *cstr = NULL; + const char *cstr = nullptr; ValueLocker locker; lldb::ValueObjectSP value_sp(GetSP(locker)); if (value_sp) { @@ -472,7 +472,7 @@ const char *SBValue::GetLocation() { LLDB_RECORD_METHOD_NO_ARGS(const char *, SBValue, GetLocation); - const char *cstr = NULL; + const char *cstr = nullptr; ValueLocker locker; lldb::ValueObjectSP value_sp(GetSP(locker)); if (value_sp) { @@ -1042,7 +1042,7 @@ lldb::ValueObjectSP value_sp(GetSP(locker)); if (value_sp) return value_sp->GetCompilerType().GetOpaqueQualType(); - return NULL; + return nullptr; } lldb::SBTarget SBValue::GetTarget() { Index: source/API/SBValueList.cpp =================================================================== --- source/API/SBValueList.cpp +++ source/API/SBValueList.cpp @@ -92,7 +92,7 @@ SBValueList::operator bool() const { LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBValueList, operator bool); - return (m_opaque_up != NULL); + return (m_opaque_up != nullptr); } void SBValueList::Clear() { @@ -172,7 +172,7 @@ } void SBValueList::CreateIfNeeded() { - if (m_opaque_up == NULL) + if (m_opaque_up == nullptr) m_opaque_up.reset(new ValueListImpl()); } Index: source/API/SBWatchpoint.cpp =================================================================== --- source/API/SBWatchpoint.cpp +++ source/API/SBWatchpoint.cpp @@ -218,7 +218,7 @@ watchpoint_sp->GetTarget().GetAPIMutex()); return watchpoint_sp->GetConditionText(); } - return NULL; + return nullptr; } void SBWatchpoint::SetCondition(const char *condition) { @@ -277,7 +277,7 @@ (const lldb::SBEvent &), event); return Watchpoint::WatchpointEventData::GetEventDataFromEvent(event.get()) != - NULL; + nullptr; } WatchpointEventType Index: source/Breakpoint/BreakpointResolverAddress.cpp =================================================================== --- source/Breakpoint/BreakpointResolverAddress.cpp +++ source/Breakpoint/BreakpointResolverAddress.cpp @@ -124,7 +124,7 @@ BreakpointResolverAddress::SearchCallback(SearchFilter &filter, SymbolContext &context, Address *addr, bool containing) { - assert(m_breakpoint != NULL); + assert(m_breakpoint != nullptr); if (filter.AddressPasses(m_addr)) { if (m_breakpoint->GetNumLocations() == 0) { Index: source/Breakpoint/BreakpointResolverFileLine.cpp =================================================================== --- source/Breakpoint/BreakpointResolverFileLine.cpp +++ source/Breakpoint/BreakpointResolverFileLine.cpp @@ -204,7 +204,7 @@ Address *addr, bool containing) { SymbolContextList sc_list; - assert(m_breakpoint != NULL); + assert(m_breakpoint != nullptr); // There is a tricky bit here. You can have two compilation units that // #include the same file, and in one of them the function at m_line_number Index: source/Breakpoint/BreakpointResolverFileRegex.cpp =================================================================== --- source/Breakpoint/BreakpointResolverFileRegex.cpp +++ source/Breakpoint/BreakpointResolverFileRegex.cpp @@ -98,7 +98,7 @@ SymbolContext &context, Address *addr, bool containing) { - assert(m_breakpoint != NULL); + assert(m_breakpoint != nullptr); if (!context.target_sp) return eCallbackReturnContinue; @@ -145,7 +145,7 @@ BreakpointResolver::SetSCMatchesByLine(filter, sc_list, skip_prologue, m_regex.GetText()); } - assert(m_breakpoint != NULL); + assert(m_breakpoint != nullptr); return Searcher::eCallbackReturnContinue; } Index: source/Breakpoint/BreakpointResolverScripted.cpp =================================================================== --- source/Breakpoint/BreakpointResolverScripted.cpp +++ source/Breakpoint/BreakpointResolverScripted.cpp @@ -127,7 +127,7 @@ BreakpointResolverScripted::SearchCallback(SearchFilter &filter, SymbolContext &context, Address *addr, bool containing) { - assert(m_breakpoint != NULL); + assert(m_breakpoint != nullptr); bool should_continue = true; if (!m_implementation_sp) return Searcher::eCallbackReturnStop; @@ -144,7 +144,7 @@ lldb::SearchDepth BreakpointResolverScripted::GetDepth() { - assert(m_breakpoint != NULL); + assert(m_breakpoint != nullptr); lldb::SearchDepth depth = lldb::eSearchDepthModule; if (m_implementation_sp) { ScriptInterpreter *interp = GetScriptInterpreter(); Index: source/Commands/CommandObjectExpression.h =================================================================== --- source/Commands/CommandObjectExpression.h +++ source/Commands/CommandObjectExpression.h @@ -68,7 +68,7 @@ bool EvaluateExpression(llvm::StringRef expr, Stream *output_stream, Stream *error_stream, - CommandReturnObject *result = NULL); + CommandReturnObject *result = nullptr); void GetMultilineExpression(); Index: source/Core/Communication.cpp =================================================================== --- source/Core/Communication.cpp +++ source/Core/Communication.cpp @@ -359,7 +359,7 @@ // Let clients know that this thread is exiting comm->BroadcastEvent(eBroadcastBitNoMorePendingInput); comm->BroadcastEvent(eBroadcastBitReadThreadDidExit); - return NULL; + return nullptr; } void Communication::SetReadThreadBytesReceivedCallback( Index: source/Core/Debugger.cpp =================================================================== --- source/Core/Debugger.cpp +++ source/Core/Debugger.cpp @@ -1616,7 +1616,7 @@ lldb::thread_result_t Debugger::EventHandlerThread(lldb::thread_arg_t arg) { ((Debugger *)arg)->DefaultEventHandler(); - return NULL; + return nullptr; } bool Debugger::StartEventHandlerThread() { @@ -1661,7 +1661,7 @@ Debugger *debugger = (Debugger *)arg; debugger->ExecuteIOHandlers(); debugger->StopEventHandlerThread(); - return NULL; + return nullptr; } bool Debugger::HasIOHandlerThread() { return m_io_handler_thread.IsJoinable(); } Index: source/Core/Mangled.cpp =================================================================== --- source/Core/Mangled.cpp +++ source/Core/Mangled.cpp @@ -160,7 +160,7 @@ // if (mangled) // { ... Mangled::operator void *() const { - return (m_mangled) ? const_cast(this) : NULL; + return (m_mangled) ? const_cast(this) : nullptr; } // Logical NOT operator. This allows code to check any Mangled objects to see Index: source/Core/Section.cpp =================================================================== --- source/Core/Section.cpp +++ source/Core/Section.cpp @@ -342,7 +342,7 @@ s->PutChar('.'); } else { // The top most section prints the module basename - const char *name = NULL; + const char *name = nullptr; ModuleSP module_sp(GetModule()); if (m_obj_file) { @@ -509,7 +509,7 @@ const_iterator sect_iter; const_iterator end = m_sections.end(); for (sect_iter = m_sections.begin(); - sect_iter != end && sect_sp.get() == NULL; ++sect_iter) { + sect_iter != end && sect_sp.get() == nullptr; ++sect_iter) { Section *child_section = sect_iter->get(); if (child_section) { if (child_section->GetName() == section_dstr) { @@ -530,7 +530,7 @@ const_iterator sect_iter; const_iterator end = m_sections.end(); for (sect_iter = m_sections.begin(); - sect_iter != end && sect_sp.get() == NULL; ++sect_iter) { + sect_iter != end && sect_sp.get() == nullptr; ++sect_iter) { if ((*sect_iter)->GetID() == sect_id) { sect_sp = *sect_iter; break; @@ -567,7 +567,7 @@ const_iterator sect_iter; const_iterator end = m_sections.end(); for (sect_iter = m_sections.begin(); - sect_iter != end && sect_sp.get() == NULL; ++sect_iter) { + sect_iter != end && sect_sp.get() == nullptr; ++sect_iter) { Section *sect = sect_iter->get(); if (sect->ContainsFileAddress(vm_addr)) { // The file address is in this section. We need to make sure one of our @@ -577,7 +577,7 @@ sect_sp = sect->GetChildren().FindSectionContainingFileAddress( vm_addr, depth - 1); - if (sect_sp.get() == NULL && !sect->IsFake()) + if (sect_sp.get() == nullptr && !sect->IsFake()) sect_sp = *sect_iter; } } @@ -585,7 +585,7 @@ } bool SectionList::ContainsSection(user_id_t sect_id) const { - return FindSectionByID(sect_id).get() != NULL; + return FindSectionByID(sect_id).get() != nullptr; } void SectionList::Dump(Stream *s, Target *target, bool show_header, @@ -608,7 +608,7 @@ const_iterator sect_iter; const_iterator end = m_sections.end(); for (sect_iter = m_sections.begin(); sect_iter != end; ++sect_iter) { - (*sect_iter)->Dump(s, target_has_loaded_sections ? target : NULL, depth); + (*sect_iter)->Dump(s, target_has_loaded_sections ? target : nullptr, depth); } if (show_header && !m_sections.empty()) Index: source/Core/SourceManager.cpp =================================================================== --- source/Core/SourceManager.cpp +++ source/Core/SourceManager.cpp @@ -326,7 +326,7 @@ bool inlines_okay = true; bool append = false; size_t num_matches = executable_ptr->FindFunctions( - main_name, NULL, lldb::eFunctionNameTypeBase, inlines_okay, + main_name, nullptr, lldb::eFunctionNameTypeBase, inlines_okay, symbols_okay, append, sc_list); for (size_t idx = 0; idx < num_matches; idx++) { SymbolContext sc; @@ -399,7 +399,7 @@ if (num_matches != 0) { if (num_matches > 1) { SymbolContext sc; - FileSpec *test_cu_spec = NULL; + FileSpec *test_cu_spec = nullptr; for (unsigned i = 0; i < num_matches; i++) { sc_list.GetContextAtIndex(i, sc); @@ -461,12 +461,12 @@ const char *SourceManager::File::PeekLineData(uint32_t line) { if (!LineIsValid(line)) - return NULL; + return nullptr; size_t line_offset = GetLineOffset(line); if (line_offset < m_data_sp->GetByteSize()) return (const char *)m_data_sp->GetBytes() + line_offset; - return NULL; + return nullptr; } uint32_t SourceManager::File::GetLineLength(uint32_t line, @@ -621,7 +621,7 @@ return true; if (m_offsets.empty()) { - if (m_data_sp.get() == NULL) + if (m_data_sp.get() == nullptr) return false; const char *start = (char *)m_data_sp->GetBytes(); Index: source/Core/Value.cpp =================================================================== --- source/Core/Value.cpp +++ source/Core/Value.cpp @@ -39,17 +39,17 @@ using namespace lldb_private; Value::Value() - : m_value(), m_vector(), m_compiler_type(), m_context(NULL), + : m_value(), m_vector(), m_compiler_type(), m_context(nullptr), m_value_type(eValueTypeScalar), m_context_type(eContextTypeInvalid), m_data_buffer() {} Value::Value(const Scalar &scalar) - : m_value(scalar), m_vector(), m_compiler_type(), m_context(NULL), + : m_value(scalar), m_vector(), m_compiler_type(), m_context(nullptr), m_value_type(eValueTypeScalar), m_context_type(eContextTypeInvalid), m_data_buffer() {} Value::Value(const void *bytes, int len) - : m_value(), m_vector(), m_compiler_type(), m_context(NULL), + : m_value(), m_vector(), m_compiler_type(), m_context(nullptr), m_value_type(eValueTypeHostAddress), m_context_type(eContextTypeInvalid), m_data_buffer() { SetBytes(bytes, len); @@ -131,13 +131,13 @@ RegisterInfo *Value::GetRegisterInfo() const { if (m_context_type == eContextTypeRegisterInfo) return static_cast(m_context); - return NULL; + return nullptr; } Type *Value::GetType() { if (m_context_type == eContextTypeLLDBType) return static_cast(m_context); - return NULL; + return nullptr; } size_t Value::AppendDataToHostBuffer(const Value &rhs) { @@ -353,11 +353,11 @@ break; } case eValueTypeLoadAddress: - if (exe_ctx == NULL) { + if (exe_ctx == nullptr) { error.SetErrorString("can't read load address (no execution context)"); } else { Process *process = exe_ctx->GetProcessPtr(); - if (process == NULL || !process->IsAlive()) { + if (process == nullptr || !process->IsAlive()) { Target *target = exe_ctx->GetTargetPtr(); if (target) { // Allow expressions to run and evaluate things when the target has @@ -390,16 +390,16 @@ break; case eValueTypeFileAddress: - if (exe_ctx == NULL) { + if (exe_ctx == nullptr) { error.SetErrorString("can't read file address (no execution context)"); - } else if (exe_ctx->GetTargetPtr() == NULL) { + } else if (exe_ctx->GetTargetPtr() == nullptr) { error.SetErrorString("can't read file address (invalid target)"); } else { address = m_value.ULongLong(LLDB_INVALID_ADDRESS); if (address == LLDB_INVALID_ADDRESS) { error.SetErrorString("invalid file address"); } else { - if (module == NULL) { + if (module == nullptr) { // The only thing we can currently lock down to a module so that we // can resolve a file address, is a variable. Variable *variable = GetVariable(); @@ -527,7 +527,7 @@ } uint8_t *dst = const_cast(data.PeekData(data_offset, byte_size)); - if (dst != NULL) { + if (dst != nullptr) { if (address_type == eAddressTypeHost) { // The address is an address in this process, so just copy it. if (address == 0) { @@ -597,7 +597,7 @@ { DataExtractor data; lldb::addr_t addr = m_value.ULongLong(LLDB_INVALID_ADDRESS); - Status error(GetValueAsData(exe_ctx, data, 0, NULL)); + Status error(GetValueAsData(exe_ctx, data, 0, nullptr)); if (error.Success()) { Scalar scalar; if (compiler_type.GetValueAsScalar(data, 0, data.GetByteSize(), @@ -625,7 +625,7 @@ Variable *Value::GetVariable() { if (m_context_type == eContextTypeVariable) return static_cast(m_context); - return NULL; + return nullptr; } void Value::Clear() { @@ -633,7 +633,7 @@ m_vector.Clear(); m_compiler_type.Clear(); m_value_type = eValueTypeScalar; - m_context = NULL; + m_context = nullptr; m_context_type = eContextTypeInvalid; m_data_buffer.Clear(); } @@ -702,7 +702,7 @@ if (idx < GetSize()) { return &(m_values[idx]); } else - return NULL; + return nullptr; } void ValueList::Clear() { m_values.clear(); } Index: source/Core/ValueObject.cpp =================================================================== --- source/Core/ValueObject.cpp +++ source/Core/ValueObject.cpp @@ -81,12 +81,13 @@ // ValueObject constructor ValueObject::ValueObject(ValueObject &parent) : UserID(++g_value_obj_uid), // Unique identifier for every value object - m_parent(&parent), m_root(NULL), m_update_point(parent.GetUpdatePoint()), - m_name(), m_data(), m_value(), m_error(), m_value_str(), - m_old_value_str(), m_location_str(), m_summary_str(), m_object_desc_str(), - m_validation_result(), m_manager(parent.GetManager()), m_children(), - m_synthetic_children(), m_dynamic_value(NULL), m_synthetic_value(NULL), - m_deref_valobj(NULL), m_format(eFormatDefault), + m_parent(&parent), m_root(nullptr), + m_update_point(parent.GetUpdatePoint()), m_name(), m_data(), m_value(), + m_error(), m_value_str(), m_old_value_str(), m_location_str(), + m_summary_str(), m_object_desc_str(), m_validation_result(), + m_manager(parent.GetManager()), m_children(), m_synthetic_children(), + m_dynamic_value(nullptr), m_synthetic_value(nullptr), + m_deref_valobj(nullptr), m_format(eFormatDefault), m_last_format(eFormatDefault), m_last_format_mgr_revision(0), m_type_summary_sp(), m_type_format_sp(), m_synthetic_children_sp(), m_type_validator_sp(), m_user_id_of_forced_summary(), @@ -108,15 +109,15 @@ ValueObject::ValueObject(ExecutionContextScope *exe_scope, AddressType child_ptr_or_ref_addr_type) : UserID(++g_value_obj_uid), // Unique identifier for every value object - m_parent(NULL), m_root(NULL), m_update_point(exe_scope), m_name(), + m_parent(nullptr), m_root(nullptr), m_update_point(exe_scope), m_name(), m_data(), m_value(), m_error(), m_value_str(), m_old_value_str(), m_location_str(), m_summary_str(), m_object_desc_str(), m_validation_result(), m_manager(), m_children(), m_synthetic_children(), - m_dynamic_value(NULL), m_synthetic_value(NULL), m_deref_valobj(NULL), - m_format(eFormatDefault), m_last_format(eFormatDefault), - m_last_format_mgr_revision(0), m_type_summary_sp(), m_type_format_sp(), - m_synthetic_children_sp(), m_type_validator_sp(), - m_user_id_of_forced_summary(), + m_dynamic_value(nullptr), m_synthetic_value(nullptr), + m_deref_valobj(nullptr), m_format(eFormatDefault), + m_last_format(eFormatDefault), m_last_format_mgr_revision(0), + m_type_summary_sp(), m_type_format_sp(), m_synthetic_children_sp(), + m_type_validator_sp(), m_user_id_of_forced_summary(), m_address_type_of_ptr_or_ref_children(child_ptr_or_ref_addr_type), m_value_checksum(), m_preferred_display_language(lldb::eLanguageTypeUnknown), @@ -465,7 +466,7 @@ } ValueObject *child = m_children.GetChildAtIndex(idx); - if (child != NULL) + if (child != nullptr) return child->GetSP(); } return child_sp; @@ -617,7 +618,7 @@ ValueObject *ValueObject::CreateChildAtIndex(size_t idx, bool synthetic_array_member, int32_t synthetic_index) { - ValueObject *valobj = NULL; + ValueObject *valobj = nullptr; bool omit_empty_base_classes = true; bool ignore_array_bounds = synthetic_array_member; @@ -710,7 +711,7 @@ summary_options); } if (m_summary_str.empty()) - return NULL; + return nullptr; return m_summary_str.c_str(); } @@ -763,12 +764,12 @@ if (is_pointer_type) { Status error; ValueObjectSP pointee_sp = Dereference(error); - if (error.Fail() || pointee_sp.get() == NULL) + if (error.Fail() || pointee_sp.get() == nullptr) return 0; return pointee_sp->GetData(data, error); } else { ValueObjectSP child_sp = GetChildAtIndex(0, true); - if (child_sp.get() == NULL) + if (child_sp.get() == nullptr) return 0; Status error; return child_sp->GetData(data, error); @@ -777,7 +778,7 @@ } else /* (items > 1) */ { Status error; - lldb_private::DataBufferHeap *heap_buf_ptr = NULL; + lldb_private::DataBufferHeap *heap_buf_ptr = nullptr; lldb::DataBufferSP data_sp(heap_buf_ptr = new lldb_private::DataBufferHeap()); @@ -964,7 +965,7 @@ if (is_array) { // We have an array uint64_t array_size = 0; - if (compiler_type.IsArrayType(NULL, &array_size, NULL)) { + if (compiler_type.IsArrayType(nullptr, &array_size, nullptr)) { cstr_len = array_size; if (cstr_len > max_length) { capped_data = true; @@ -1170,7 +1171,7 @@ } } if (m_value_str.empty()) - return NULL; + return nullptr; return m_value_str.c_str(); } @@ -1281,7 +1282,7 @@ buffer_sp, lldb::eByteOrderInvalid, 8)); // none of this matters for a string - pass some defaults options.SetStream(&s); - options.SetPrefixToken(0); + options.SetPrefixToken(nullptr); options.SetQuote('"'); options.SetSourceSize(buffer_sp->GetByteSize()); options.SetIsTruncated(read_string.second); @@ -1670,7 +1671,7 @@ bool ValueObject::IsPointerType() { return GetCompilerType().IsPointerType(); } bool ValueObject::IsArrayType() { - return GetCompilerType().IsArrayType(NULL, NULL, NULL); + return GetCompilerType().IsArrayType(nullptr, nullptr, nullptr); } bool ValueObject::IsScalarType() { return GetCompilerType().IsScalarType(); } @@ -1689,7 +1690,7 @@ if (process) return process->IsPossibleDynamicValue(*this); else - return GetCompilerType().IsPossibleDynamicType(NULL, true, true); + return GetCompilerType().IsPossibleDynamicType(nullptr, true, true); } bool ValueObject::IsRuntimeSupportValue() { @@ -1900,7 +1901,7 @@ // We haven't made a synthetic array member for expression yet, so lets // make one and cache it for any future reference. synthetic_child_sp = GetValueForExpressionPath( - expression, NULL, NULL, + expression, nullptr, nullptr, GetValueForExpressionPathOptions().SetSyntheticChildrenTraversal( GetValueForExpressionPathOptions::SyntheticChildrenTraversal:: None)); @@ -1923,7 +1924,7 @@ TargetSP target_sp(GetTargetSP()); if (target_sp && !target_sp->GetEnableSyntheticValue()) { - m_synthetic_value = NULL; + m_synthetic_value = nullptr; return; } @@ -1932,7 +1933,7 @@ if (!UpdateFormatsIfNeeded() && m_synthetic_value) return; - if (m_synthetic_children_sp.get() == NULL) + if (m_synthetic_children_sp.get() == nullptr) return; if (current_synth_sp == m_synthetic_children_sp && m_synthetic_value) @@ -1959,7 +1960,7 @@ if (use_dynamic == eNoDynamicValues) return ValueObjectSP(); - if (!IsDynamic() && m_dynamic_value == NULL) { + if (!IsDynamic() && m_dynamic_value == nullptr) { CalculateDynamicValue(use_dynamic); } if (m_dynamic_value) @@ -1987,7 +1988,7 @@ bool ValueObject::HasSyntheticValue() { UpdateFormatsIfNeeded(); - if (m_synthetic_children_sp.get() == NULL) + if (m_synthetic_children_sp.get() == nullptr) return false; CalculateSyntheticValue(true); @@ -2020,7 +2021,7 @@ else return GetParent(); } - return NULL; + return nullptr; } bool ValueObject::IsBaseClass(uint32_t &depth) { @@ -3005,12 +3006,12 @@ ExecutionContext exe_ctx( m_exe_ctx_ref.Lock(thread_and_frame_only_if_stopped)); - if (exe_ctx.GetTargetPtr() == NULL) + if (exe_ctx.GetTargetPtr() == nullptr) return false; // If we don't have a process nothing can change. Process *process = exe_ctx.GetProcessPtr(); - if (process == NULL) + if (process == nullptr) return false; // If our stop id is the current stop ID, nothing has changed: @@ -3091,7 +3092,7 @@ if ((clear_mask & eClearUserVisibleDataItemsSyntheticChildren) == eClearUserVisibleDataItemsSyntheticChildren) { if (m_synthetic_value) - m_synthetic_value = NULL; + m_synthetic_value = nullptr; } if ((clear_mask & eClearUserVisibleDataItemsValidator) == @@ -3104,7 +3105,7 @@ if (!m_parent->IsPointerOrReferenceType()) return m_parent->GetSymbolContextScope(); } - return NULL; + return nullptr; } lldb::ValueObjectSP Index: source/Core/ValueObjectConstResultImpl.cpp =================================================================== --- source/Core/ValueObjectConstResultImpl.cpp +++ source/Core/ValueObjectConstResultImpl.cpp @@ -39,7 +39,7 @@ m_address_of_backend() {} lldb::ValueObjectSP ValueObjectConstResultImpl::Dereference(Status &error) { - if (m_impl_backend == NULL) + if (m_impl_backend == nullptr) return lldb::ValueObjectSP(); return m_impl_backend->ValueObject::Dereference(error); @@ -47,12 +47,12 @@ ValueObject *ValueObjectConstResultImpl::CreateChildAtIndex( size_t idx, bool synthetic_array_member, int32_t synthetic_index) { - if (m_impl_backend == NULL) - return NULL; + if (m_impl_backend == nullptr) + return nullptr; m_impl_backend->UpdateValueIfNeeded(false); - ValueObjectConstResultChild *valobj = NULL; + ValueObjectConstResultChild *valobj = nullptr; bool omit_empty_base_classes = true; bool ignore_array_bounds = synthetic_array_member; @@ -106,7 +106,7 @@ lldb::ValueObjectSP ValueObjectConstResultImpl::GetSyntheticChildAtOffset( uint32_t offset, const CompilerType &type, bool can_create, ConstString name_const_str) { - if (m_impl_backend == NULL) + if (m_impl_backend == nullptr) return lldb::ValueObjectSP(); return m_impl_backend->ValueObject::GetSyntheticChildAtOffset( @@ -114,10 +114,10 @@ } lldb::ValueObjectSP ValueObjectConstResultImpl::AddressOf(Status &error) { - if (m_address_of_backend.get() != NULL) + if (m_address_of_backend.get() != nullptr) return m_address_of_backend; - if (m_impl_backend == NULL) + if (m_impl_backend == nullptr) return lldb::ValueObjectSP(); if (m_live_address != LLDB_INVALID_ADDRESS) { CompilerType compiler_type(m_impl_backend->GetCompilerType()); @@ -143,7 +143,7 @@ lldb::ValueObjectSP ValueObjectConstResultImpl::Cast(const CompilerType &compiler_type) { - if (m_impl_backend == NULL) + if (m_impl_backend == nullptr) return lldb::ValueObjectSP(); ValueObjectConstResultCast *result_cast = @@ -156,7 +156,7 @@ ValueObjectConstResultImpl::GetAddressOf(bool scalar_is_load_address, AddressType *address_type) { - if (m_impl_backend == NULL) + if (m_impl_backend == nullptr) return 0; if (m_live_address == LLDB_INVALID_ADDRESS) { @@ -173,7 +173,7 @@ size_t ValueObjectConstResultImpl::GetPointeeData(DataExtractor &data, uint32_t item_idx, uint32_t item_count) { - if (m_impl_backend == NULL) + if (m_impl_backend == nullptr) return 0; return m_impl_backend->ValueObject::GetPointeeData(data, item_idx, item_count); Index: source/Core/ValueObjectMemory.cpp =================================================================== --- source/Core/ValueObjectMemory.cpp +++ source/Core/ValueObjectMemory.cpp @@ -49,7 +49,7 @@ : ValueObject(exe_scope), m_address(address), m_type_sp(type_sp), m_compiler_type() { // Do not attempt to construct one of these objects with no variable! - assert(m_type_sp.get() != NULL); + assert(m_type_sp.get() != nullptr); SetName(ConstString(name)); m_value.SetContext(Value::eContextTypeLLDBType, m_type_sp.get()); TargetSP target_sp(GetTargetSP()); Index: source/Core/ValueObjectRegister.cpp =================================================================== --- source/Core/ValueObjectRegister.cpp +++ source/Core/ValueObjectRegister.cpp @@ -76,7 +76,7 @@ else m_reg_ctx_sp.reset(); - if (m_reg_ctx_sp.get() == NULL) { + if (m_reg_ctx_sp.get() == nullptr) { SetValueIsValid(false); m_error.SetErrorToGenericError(); } else @@ -87,7 +87,7 @@ ValueObject *ValueObjectRegisterContext::CreateChildAtIndex( size_t idx, bool synthetic_array_member, int32_t synthetic_index) { - ValueObject *new_valobj = NULL; + ValueObject *new_valobj = nullptr; const size_t num_children = GetNumChildren(); if (idx < num_children) { @@ -112,7 +112,7 @@ ValueObjectRegisterSet::ValueObjectRegisterSet(ExecutionContextScope *exe_scope, lldb::RegisterContextSP ®_ctx, uint32_t reg_set_idx) - : ValueObject(exe_scope), m_reg_ctx_sp(reg_ctx), m_reg_set(NULL), + : ValueObject(exe_scope), m_reg_ctx_sp(reg_ctx), m_reg_set(nullptr), m_reg_set_idx(reg_set_idx) { assert(reg_ctx); m_reg_set = reg_ctx->GetRegisterSet(m_reg_set_idx); @@ -149,13 +149,13 @@ SetValueDidChange(false); ExecutionContext exe_ctx(GetExecutionContextRef()); StackFrame *frame = exe_ctx.GetFramePtr(); - if (frame == NULL) + if (frame == nullptr) m_reg_ctx_sp.reset(); else { m_reg_ctx_sp = frame->GetRegisterContext(); if (m_reg_ctx_sp) { const RegisterSet *reg_set = m_reg_ctx_sp->GetRegisterSet(m_reg_set_idx); - if (reg_set == NULL) + if (reg_set == nullptr) m_reg_ctx_sp.reset(); else if (m_reg_set != reg_set) { SetValueDidChange(true); @@ -175,7 +175,7 @@ ValueObject *ValueObjectRegisterSet::CreateChildAtIndex( size_t idx, bool synthetic_array_member, int32_t synthetic_index) { - ValueObject *valobj = NULL; + ValueObject *valobj = nullptr; if (m_reg_ctx_sp && m_reg_set) { const size_t num_children = GetNumChildren(); if (idx < num_children) @@ -188,11 +188,11 @@ lldb::ValueObjectSP ValueObjectRegisterSet::GetChildMemberWithName(ConstString name, bool can_create) { - ValueObject *valobj = NULL; + ValueObject *valobj = nullptr; if (m_reg_ctx_sp && m_reg_set) { const RegisterInfo *reg_info = m_reg_ctx_sp->GetRegisterInfoByName(name.AsCString()); - if (reg_info != NULL) + if (reg_info != nullptr) valobj = new ValueObjectRegister(*this, m_reg_ctx_sp, reg_info->kinds[eRegisterKindLLDB]); } @@ -207,7 +207,7 @@ if (m_reg_ctx_sp && m_reg_set) { const RegisterInfo *reg_info = m_reg_ctx_sp->GetRegisterInfoByName(name.AsCString()); - if (reg_info != NULL) + if (reg_info != nullptr) return reg_info->kinds[eRegisterKindLLDB]; } return UINT32_MAX; @@ -289,7 +289,7 @@ m_error.Clear(); ExecutionContext exe_ctx(GetExecutionContextRef()); StackFrame *frame = exe_ctx.GetFramePtr(); - if (frame == NULL) { + if (frame == nullptr) { m_reg_ctx_sp.reset(); m_reg_value.Clear(); } Index: source/Core/ValueObjectVariable.cpp =================================================================== --- source/Core/ValueObjectVariable.cpp +++ source/Core/ValueObjectVariable.cpp @@ -57,7 +57,7 @@ const lldb::VariableSP &var_sp) : ValueObject(exe_scope), m_variable_sp(var_sp) { // Do not attempt to construct one of these objects with no variable! - assert(m_variable_sp.get() != NULL); + assert(m_variable_sp.get() != nullptr); m_name = var_sp->GetName(); } @@ -135,7 +135,7 @@ else m_error.SetErrorString("empty constant data"); // constant bytes can't be edited - sorry - m_resolved_value.SetContext(Value::eContextTypeInvalid, NULL); + m_resolved_value.SetContext(Value::eContextTypeInvalid, nullptr); } else { lldb::addr_t loclist_base_load_addr = LLDB_INVALID_ADDRESS; ExecutionContext exe_ctx(GetExecutionContextRef()); @@ -261,7 +261,7 @@ SetValueIsValid(m_error.Success()); } else { // could not find location, won't allow editing - m_resolved_value.SetContext(Value::eContextTypeInvalid, NULL); + m_resolved_value.SetContext(Value::eContextTypeInvalid, nullptr); } } return m_error.Success(); @@ -298,7 +298,7 @@ SymbolContextScope *ValueObjectVariable::GetSymbolContextScope() { if (m_variable_sp) return m_variable_sp->GetSymbolContextScope(); - return NULL; + return nullptr; } bool ValueObjectVariable::GetDeclaration(Declaration &decl) { Index: source/DataFormatters/DataVisualization.cpp =================================================================== --- source/DataFormatters/DataVisualization.cpp +++ source/DataFormatters/DataVisualization.cpp @@ -89,7 +89,7 @@ lldb::TypeCategoryImplSP &entry, bool allow_create) { entry = GetFormatManager().GetCategory(category, allow_create); - return (entry.get() != NULL); + return (entry.get() != nullptr); } bool DataVisualization::Categories::GetCategory( Index: source/DataFormatters/FormatManager.cpp =================================================================== --- source/DataFormatters/FormatManager.cpp +++ source/DataFormatters/FormatManager.cpp @@ -146,7 +146,7 @@ const char *FormatManager::GetFormatAsCString(Format format) { if (format >= eFormatDefault && format < kNumFormats) return g_format_infos[format].format_name; - return NULL; + return nullptr; } void FormatManager::EnableAllCategories() { @@ -297,7 +297,7 @@ lldb::TypeFormatImplSP format_current_sp = category_sp->GetFormatForType(type_sp); if (format_current_sp && - (format_chosen_sp.get() == NULL || + (format_chosen_sp.get() == nullptr || (prio_category > category_sp->GetEnabledPosition()))) { prio_category = category_sp->GetEnabledPosition(); format_chosen_sp = format_current_sp; @@ -321,7 +321,7 @@ lldb::TypeSummaryImplSP summary_current_sp = category_sp->GetSummaryForType(type_sp); if (summary_current_sp && - (summary_chosen_sp.get() == NULL || + (summary_chosen_sp.get() == nullptr || (prio_category > category_sp->GetEnabledPosition()))) { prio_category = category_sp->GetEnabledPosition(); summary_chosen_sp = summary_current_sp; @@ -345,7 +345,7 @@ lldb::TypeFilterImplSP filter_current_sp( (TypeFilterImpl *)category_sp->GetFilterForType(type_sp).get()); if (filter_current_sp && - (filter_chosen_sp.get() == NULL || + (filter_chosen_sp.get() == nullptr || (prio_category > category_sp->GetEnabledPosition()))) { prio_category = category_sp->GetEnabledPosition(); filter_chosen_sp = filter_current_sp; @@ -370,7 +370,7 @@ (ScriptedSyntheticChildren *)category_sp->GetSyntheticForType(type_sp) .get()); if (synth_current_sp && - (synth_chosen_sp.get() == NULL || + (synth_chosen_sp.get() == nullptr || (prio_category > category_sp->GetEnabledPosition()))) { prio_category = category_sp->GetEnabledPosition(); synth_chosen_sp = synth_current_sp; @@ -394,7 +394,7 @@ lldb::TypeValidatorImplSP validator_current_sp( category_sp->GetValidatorForType(type_sp).get()); if (validator_current_sp && - (validator_chosen_sp.get() == NULL || + (validator_chosen_sp.get() == nullptr || (prio_category > category_sp->GetEnabledPosition()))) { prio_category = category_sp->GetEnabledPosition(); validator_chosen_sp = validator_current_sp; Index: source/DataFormatters/FormattersHelpers.cpp =================================================================== --- source/DataFormatters/FormattersHelpers.cpp +++ source/DataFormatters/FormattersHelpers.cpp @@ -123,7 +123,7 @@ if (*item_name != '[') return UINT32_MAX; item_name++; - char *endptr = NULL; + char *endptr = nullptr; unsigned long int idx = ::strtoul(item_name, &endptr, 0); if (idx == 0 && endptr == item_name) return UINT32_MAX; Index: source/DataFormatters/StringPrinter.cpp =================================================================== --- source/DataFormatters/StringPrinter.cpp +++ source/DataFormatters/StringPrinter.cpp @@ -271,7 +271,7 @@ llvm::ConversionFlags), const StringPrinter::ReadBufferAndDumpToStreamOptions &dump_options) { Stream &stream(*dump_options.GetStream()); - if (dump_options.GetPrefixToken() != 0) + if (dump_options.GetPrefixToken() != nullptr) stream.Printf("%s", dump_options.GetPrefixToken()); if (dump_options.GetQuote() != 0) stream.Printf("%c", dump_options.GetQuote()); @@ -373,7 +373,7 @@ } if (dump_options.GetQuote() != 0) stream.Printf("%c", dump_options.GetQuote()); - if (dump_options.GetSuffixToken() != 0) + if (dump_options.GetSuffixToken() != nullptr) stream.Printf("%s", dump_options.GetSuffixToken()); if (dump_options.GetIsTruncated()) stream.Printf("..."); @@ -449,7 +449,7 @@ const char *prefix_token = options.GetPrefixToken(); char quote = options.GetQuote(); - if (prefix_token != 0) + if (prefix_token != nullptr) options.GetStream()->Printf("%s%c", prefix_token, quote); else if (quote != 0) options.GetStream()->Printf("%c", quote); @@ -497,7 +497,7 @@ const char *suffix_token = options.GetSuffixToken(); - if (suffix_token != 0) + if (suffix_token != nullptr) options.GetStream()->Printf("%c%s", quote, suffix_token); else if (quote != 0) options.GetStream()->Printf("%c", quote); Index: source/DataFormatters/TypeFormat.cpp =================================================================== --- source/DataFormatters/TypeFormat.cpp +++ source/DataFormatters/TypeFormat.cpp @@ -69,7 +69,7 @@ // default value logic if (GetFormat() == eFormatCString) { lldb_private::Flags type_flags(compiler_type.GetTypeInfo( - NULL)); // disambiguate w.r.t. TypeFormatImpl::Flags + nullptr)); // disambiguate w.r.t. TypeFormatImpl::Flags if (type_flags.Test(eTypeIsPointer) && !type_flags.Test(eTypeIsObjC)) { // if we are dumping a pointer as a c-string, get the pointee data Index: source/DataFormatters/TypeSynthetic.cpp =================================================================== --- source/DataFormatters/TypeSynthetic.cpp +++ source/DataFormatters/TypeSynthetic.cpp @@ -128,7 +128,7 @@ ScriptedSyntheticChildren::FrontEnd::FrontEnd(std::string pclass, ValueObject &backend) : SyntheticChildrenFrontEnd(backend), m_python_class(pclass), - m_wrapper_sp(), m_interpreter(NULL) { + m_wrapper_sp(), m_interpreter(nullptr) { if (backend == LLDB_INVALID_UID) return; @@ -139,7 +139,7 @@ m_interpreter = target_sp->GetDebugger().GetScriptInterpreter(); - if (m_interpreter != NULL) + if (m_interpreter != nullptr) m_wrapper_sp = m_interpreter->CreateSyntheticScriptedProvider( m_python_class.c_str(), backend.GetSP()); } @@ -159,26 +159,26 @@ } size_t ScriptedSyntheticChildren::FrontEnd::CalculateNumChildren() { - if (!m_wrapper_sp || m_interpreter == NULL) + if (!m_wrapper_sp || m_interpreter == nullptr) return 0; return m_interpreter->CalculateNumChildren(m_wrapper_sp, UINT32_MAX); } size_t ScriptedSyntheticChildren::FrontEnd::CalculateNumChildren(uint32_t max) { - if (!m_wrapper_sp || m_interpreter == NULL) + if (!m_wrapper_sp || m_interpreter == nullptr) return 0; return m_interpreter->CalculateNumChildren(m_wrapper_sp, max); } bool ScriptedSyntheticChildren::FrontEnd::Update() { - if (!m_wrapper_sp || m_interpreter == NULL) + if (!m_wrapper_sp || m_interpreter == nullptr) return false; return m_interpreter->UpdateSynthProviderInstance(m_wrapper_sp); } bool ScriptedSyntheticChildren::FrontEnd::MightHaveChildren() { - if (!m_wrapper_sp || m_interpreter == NULL) + if (!m_wrapper_sp || m_interpreter == nullptr) return false; return m_interpreter->MightHaveChildrenSynthProviderInstance(m_wrapper_sp); @@ -186,21 +186,21 @@ size_t ScriptedSyntheticChildren::FrontEnd::GetIndexOfChildWithName( ConstString name) { - if (!m_wrapper_sp || m_interpreter == NULL) + if (!m_wrapper_sp || m_interpreter == nullptr) return UINT32_MAX; return m_interpreter->GetIndexOfChildWithName(m_wrapper_sp, name.GetCString()); } lldb::ValueObjectSP ScriptedSyntheticChildren::FrontEnd::GetSyntheticValue() { - if (!m_wrapper_sp || m_interpreter == NULL) + if (!m_wrapper_sp || m_interpreter == nullptr) return nullptr; return m_interpreter->GetSyntheticValue(m_wrapper_sp); } ConstString ScriptedSyntheticChildren::FrontEnd::GetSyntheticTypeName() { - if (!m_wrapper_sp || m_interpreter == NULL) + if (!m_wrapper_sp || m_interpreter == nullptr) return ConstString(); return m_interpreter->GetSyntheticTypeName(m_wrapper_sp); Index: source/DataFormatters/ValueObjectPrinter.cpp =================================================================== --- source/DataFormatters/ValueObjectPrinter.cpp +++ source/DataFormatters/ValueObjectPrinter.cpp @@ -331,7 +331,7 @@ : m_valobj->GetSummaryFormat().get(); if (m_options.m_omit_summary_depth > 0) - entry = NULL; + entry = nullptr; m_summary_formatter.first = entry; m_summary_formatter.second = true; } @@ -415,8 +415,9 @@ // explicitly) TypeSummaryImpl *entry = GetSummaryFormatter(); if (!IsNil() && !IsUninitialized() && !m_value.empty() && - (entry == NULL || (entry->DoesPrintValue(m_valobj) || - m_options.m_format != eFormatDefault) || + (entry == nullptr || + (entry->DoesPrintValue(m_valobj) || + m_options.m_format != eFormatDefault) || m_summary.empty()) && !m_options.m_hide_value) { if (m_options.m_hide_pointer_value && Index: source/Expression/DWARFExpression.cpp =================================================================== --- source/Expression/DWARFExpression.cpp +++ source/Expression/DWARFExpression.cpp @@ -649,7 +649,7 @@ lldb::RegisterKind reg_kind, uint32_t reg_num, Status *error_ptr, Value &value) { - if (reg_ctx == NULL) { + if (reg_ctx == nullptr) { if (error_ptr) error_ptr->SetErrorStringWithFormat("No register context in frame.\n"); } else { @@ -1249,7 +1249,7 @@ if (IsLocationList()) { lldb::offset_t offset = 0; addr_t pc; - StackFrame *frame = NULL; + StackFrame *frame = nullptr; if (reg_ctx) pc = reg_ctx->GetPC(); else { @@ -1323,14 +1323,14 @@ } std::vector stack; - Process *process = NULL; - StackFrame *frame = NULL; + Process *process = nullptr; + StackFrame *frame = nullptr; if (exe_ctx) { process = exe_ctx->GetProcessPtr(); frame = exe_ctx->GetFramePtr(); } - if (reg_ctx == NULL && frame) + if (reg_ctx == nullptr && frame) reg_ctx = frame->GetRegisterContext().get(); if (initial_value_ptr) @@ -3166,7 +3166,7 @@ s.Indent(); if (cu) s.AddressRange(start_addr + base_addr, end_addr + base_addr, - cu->GetAddressByteSize(), NULL, ": "); + cu->GetAddressByteSize(), nullptr, ": "); uint32_t loc_length = debug_loc_data.GetU16(&offset); DataExtractor locationData(debug_loc_data, offset, loc_length); Index: source/Expression/ExpressionVariable.cpp =================================================================== --- source/Expression/ExpressionVariable.cpp +++ source/Expression/ExpressionVariable.cpp @@ -25,7 +25,7 @@ return const_cast( m_frozen_sp->GetDataExtractor().GetDataStart()); } - return NULL; + return nullptr; } PersistentExpressionState::~PersistentExpressionState() {} Index: source/Expression/FunctionCaller.cpp =================================================================== --- source/Expression/FunctionCaller.cpp +++ source/Expression/FunctionCaller.cpp @@ -35,10 +35,9 @@ const Address &functionAddress, const ValueList &arg_value_list, const char *name) - : Expression(exe_scope, eKindFunctionCaller), - m_execution_unit_sp(), m_parser(), - m_jit_module_wp(), m_name(name ? name : ""), - m_function_ptr(NULL), m_function_addr(functionAddress), + : Expression(exe_scope, eKindFunctionCaller), m_execution_unit_sp(), + m_parser(), m_jit_module_wp(), m_name(name ? name : ""), + m_function_ptr(nullptr), m_function_addr(functionAddress), m_function_return_type(return_type), m_wrapper_function_name("__lldb_caller_function"), m_wrapper_struct_name("__lldb_caller_struct"), m_wrapper_args_addrs(), @@ -138,7 +137,7 @@ Process *process = exe_ctx.GetProcessPtr(); - if (process == NULL) + if (process == nullptr) return return_value; lldb::ProcessSP jit_process_sp(m_jit_process_wp.lock()); @@ -239,11 +238,11 @@ // FIXME: Use the errors Stream for better error reporting. Thread *thread = exe_ctx.GetThreadPtr(); - if (thread == NULL) { + if (thread == nullptr) { diagnostic_manager.PutString( eDiagnosticSeverityError, "Can't call a function without a valid thread."); - return NULL; + return nullptr; } // Okay, now run the function: @@ -279,7 +278,7 @@ Process *process = exe_ctx.GetProcessPtr(); - if (process == NULL) + if (process == nullptr) return false; lldb::ProcessSP jit_process_sp(m_jit_process_wp.lock()); @@ -326,7 +325,7 @@ lldb::addr_t args_addr; - if (args_addr_ptr != NULL) + if (args_addr_ptr != nullptr) args_addr = *args_addr_ptr; else args_addr = LLDB_INVALID_ADDRESS; @@ -376,7 +375,7 @@ if (exe_ctx.GetProcessPtr()) exe_ctx.GetProcessPtr()->SetRunningUserExpression(false); - if (args_addr_ptr != NULL) + if (args_addr_ptr != nullptr) *args_addr_ptr = args_addr; if (return_value != lldb::eExpressionCompleted) @@ -384,7 +383,7 @@ FetchFunctionResults(exe_ctx, args_addr, results); - if (args_addr_ptr == NULL) + if (args_addr_ptr == nullptr) DeallocateFunctionResults(exe_ctx, args_addr); return lldb::eExpressionCompleted; Index: source/Expression/IRExecutionUnit.cpp =================================================================== --- source/Expression/IRExecutionUnit.cpp +++ source/Expression/IRExecutionUnit.cpp @@ -165,8 +165,8 @@ ArchSpec arch(target->GetArchitecture()); - const char *plugin_name = NULL; - const char *flavor_string = NULL; + const char *plugin_name = nullptr; + const char *flavor_string = nullptr; lldb::DisassemblerSP disassembler_sp = Disassembler::FindPlugin(arch, flavor_string, plugin_name); @@ -251,7 +251,7 @@ std::string s; llvm::raw_string_ostream oss(s); - m_module->print(oss, NULL); + m_module->print(oss, nullptr); oss.flush(); @@ -839,7 +839,7 @@ }; if (sc.module_sp) { - sc.module_sp->FindFunctions(spec.name, NULL, spec.mask, + sc.module_sp->FindFunctions(spec.name, nullptr, spec.mask, true, // include_symbols false, // include_inlines true, // append Index: source/Expression/IRInterpreter.cpp =================================================================== --- source/Expression/IRInterpreter.cpp +++ source/Expression/IRInterpreter.cpp @@ -654,7 +654,7 @@ std::string s; raw_string_ostream oss(s); - module.print(oss, NULL); + module.print(oss, nullptr); oss.flush(); Index: source/Expression/IRMemoryMap.cpp =================================================================== --- source/Expression/IRMemoryMap.cpp +++ source/Expression/IRMemoryMap.cpp @@ -263,7 +263,7 @@ if (target_sp) return target_sp.get(); - return NULL; + return nullptr; } IRMemoryMap::Allocation::Allocation(lldb::addr_t process_alloc, Index: source/Expression/LLVMUserExpression.cpp =================================================================== --- source/Expression/LLVMUserExpression.cpp +++ source/Expression/LLVMUserExpression.cpp @@ -50,7 +50,7 @@ m_allow_objc(false), m_transformed_text(), m_execution_unit_sp(), m_materializer_up(), m_jit_module_wp(), m_enforce_valid_object(true), m_in_cplusplus_method(false), m_in_objectivec_method(false), - m_in_static_method(false), m_needs_object_ptr(false), m_target(NULL), + m_in_static_method(false), m_needs_object_ptr(false), m_target(nullptr), m_can_interpret(false), m_materialized_address(LLDB_INVALID_ADDRESS) {} LLVMUserExpression::~LLVMUserExpression() { @@ -181,7 +181,7 @@ if (execution_result == lldb::eExpressionInterrupted || execution_result == lldb::eExpressionHitBreakpoint) { - const char *error_desc = NULL; + const char *error_desc = nullptr; if (call_plan_sp) { lldb::StopInfoSP real_stop_info_sp = call_plan_sp->GetRealStopInfo(); Index: source/Expression/UserExpression.cpp =================================================================== --- source/Expression/UserExpression.cpp +++ source/Expression/UserExpression.cpp @@ -174,7 +174,7 @@ Process *process = exe_ctx.GetProcessPtr(); - if (process == NULL || process->GetState() != lldb::eStateStopped) { + if (process == nullptr || process->GetState() != lldb::eStateStopped) { if (execution_policy == eExecutionPolicyAlways) { if (log) log->Printf("== [UserExpression::Evaluate] Expression may not run, but " @@ -186,7 +186,7 @@ } } - if (process == NULL || !process->CanJIT()) + if (process == nullptr || !process->CanJIT()) execution_policy = eExecutionPolicyNever; // We need to set the expression execution thread here, turns out parse can @@ -375,7 +375,7 @@ return lldb::eExpressionInterrupted; } - if (result_valobj_sp.get() == NULL) { + if (result_valobj_sp.get() == nullptr) { result_valobj_sp = ValueObjectConstResult::Create( exe_ctx.GetBestExecutionContextScope(), error); } Index: source/Host/common/Editline.cpp =================================================================== --- source/Host/common/Editline.cpp +++ source/Host/common/Editline.cpp @@ -163,7 +163,7 @@ // Use static GetHistory() function to get a EditlineHistorySP to one of // these objects EditlineHistory(const std::string &prefix, uint32_t size, bool unique_entries) - : m_history(NULL), m_event(), m_prefix(prefix), m_path() { + : m_history(nullptr), m_event(), m_prefix(prefix), m_path() { m_history = history_winit(); history_w(m_history, &m_event, H_SETSIZE, size); if (unique_entries) @@ -202,7 +202,7 @@ if (m_history) { history_wend(m_history); - m_history = NULL; + m_history = nullptr; } } @@ -224,7 +224,7 @@ return history_sp; } - bool IsValid() const { return m_history != NULL; } + bool IsValid() const { return m_history != nullptr; } HistoryW *GetHistoryPtr() { return m_history; } @@ -514,11 +514,13 @@ // Read returns, immediately lock the mutex again and check if we were // interrupted. m_output_mutex.unlock(); - int read_count = m_input_connection.Read(&ch, 1, llvm::None, status, NULL); + int read_count = + m_input_connection.Read(&ch, 1, llvm::None, status, nullptr); m_output_mutex.lock(); if (m_editor_status == EditorStatus::Interrupted) { while (read_count > 0 && status == lldb::eConnectionStatusSuccess) - read_count = m_input_connection.Read(&ch, 1, llvm::None, status, NULL); + read_count = + m_input_connection.Read(&ch, 1, llvm::None, status, nullptr); lldbassert(status == lldb::eConnectionStatusInterrupted); return 0; } @@ -1081,7 +1083,7 @@ // Allow user-specific customization prior to registering bindings we // absolutely require - el_source(m_editline, NULL); + el_source(m_editline, nullptr); // Register an internal binding that external developers shouldn't use el_wset(m_editline, EL_ADDFN, EditLineConstString("lldb-revert-line"), Index: source/Host/common/File.cpp =================================================================== --- source/Host/common/File.cpp +++ source/Host/common/File.cpp @@ -65,11 +65,11 @@ } else if (options & File::eOpenOptionWrite) { return "w"; } - return NULL; + return nullptr; } int File::kInvalidDescriptor = -1; -FILE *File::kInvalidStream = NULL; +FILE *File::kInvalidStream = nullptr; File::~File() { Close(); } @@ -634,9 +634,9 @@ size_t File::PrintfVarArg(const char *format, va_list args) { size_t result = 0; if (DescriptorIsValid()) { - char *s = NULL; + char *s = nullptr; result = vasprintf(&s, format, args); - if (s != NULL) { + if (s != nullptr) { if (result > 0) { size_t s_len = result; Write(s, s_len); Index: source/Host/common/Host.cpp =================================================================== --- source/Host/common/Host.cpp +++ source/Host/common/Host.cpp @@ -112,7 +112,7 @@ ::snprintf(thread_name, sizeof(thread_name), "", pid); return ThreadLauncher::LaunchThread( - thread_name, MonitorChildProcessThreadFunction, info_ptr, NULL); + thread_name, MonitorChildProcessThreadFunction, info_ptr, nullptr); } #ifndef __linux__ @@ -219,7 +219,7 @@ bool exited = false; int signal = 0; int exit_status = 0; - const char *status_cstr = NULL; + const char *status_cstr = nullptr; if (WIFSTOPPED(status)) { signal = WSTOPSIG(status); status_cstr = "STOPPED"; @@ -282,7 +282,7 @@ if (log) log->Printf("%s (arg = %p) thread exiting...", __FUNCTION__, arg); - return NULL; + return nullptr; } #endif // #if !defined (__APPLE__) && !defined (_WIN32) @@ -393,7 +393,7 @@ default: break; } - return NULL; + return nullptr; } #endif Index: source/Host/common/HostNativeThreadBase.cpp =================================================================== --- source/Host/common/HostNativeThreadBase.cpp +++ source/Host/common/HostNativeThreadBase.cpp @@ -18,10 +18,10 @@ using namespace lldb_private; HostNativeThreadBase::HostNativeThreadBase() - : m_thread(LLDB_INVALID_HOST_THREAD), m_result(0) {} + : m_thread(LLDB_INVALID_HOST_THREAD), m_result(nullptr) {} HostNativeThreadBase::HostNativeThreadBase(thread_t thread) - : m_thread(thread), m_result(0) {} + : m_thread(thread), m_result(nullptr) {} lldb::thread_t HostNativeThreadBase::GetSystemHandle() const { return m_thread; @@ -37,7 +37,7 @@ void HostNativeThreadBase::Reset() { m_thread = LLDB_INVALID_HOST_THREAD; - m_result = 0; + m_result = nullptr; } bool HostNativeThreadBase::EqualsThread(lldb::thread_t thread) const { @@ -47,7 +47,7 @@ lldb::thread_t HostNativeThreadBase::Release() { lldb::thread_t result = m_thread; m_thread = LLDB_INVALID_HOST_THREAD; - m_result = 0; + m_result = nullptr; return result; } Index: source/Host/common/OptionParser.cpp =================================================================== --- source/Host/common/OptionParser.cpp +++ source/Host/common/OptionParser.cpp @@ -55,11 +55,11 @@ int i = 0; bool done = false; while (!done) { - if (long_options[i].name == 0 && long_options[i].has_arg == 0 && - long_options[i].flag == 0 && long_options[i].val == 0) { + if (long_options[i].name == nullptr && long_options[i].has_arg == 0 && + long_options[i].flag == nullptr && long_options[i].val == 0) { done = true; } else { - if (long_options[i].flag == NULL && isalpha(long_options[i].val)) { + if (long_options[i].flag == nullptr && isalpha(long_options[i].val)) { s.append(1, (char)long_options[i].val); switch (long_options[i].has_arg) { default: Index: source/Host/common/ProcessRunLock.cpp =================================================================== --- source/Host/common/ProcessRunLock.cpp +++ source/Host/common/ProcessRunLock.cpp @@ -12,7 +12,7 @@ namespace lldb_private { ProcessRunLock::ProcessRunLock() : m_running(false) { - int err = ::pthread_rwlock_init(&m_rwlock, NULL); + int err = ::pthread_rwlock_init(&m_rwlock, nullptr); (void)err; } Index: source/Host/common/SocketAddress.cpp =================================================================== --- source/Host/common/SocketAddress.cpp +++ source/Host/common/SocketAddress.cpp @@ -236,11 +236,11 @@ hints.ai_protocol = ai_protocol; hints.ai_flags = ai_flags; - struct addrinfo *service_info_list = NULL; + struct addrinfo *service_info_list = nullptr; int err = ::getaddrinfo(hostname, servname, &hints, &service_info_list); if (err == 0 && service_info_list) { - for (struct addrinfo *service_ptr = service_info_list; service_ptr != NULL; - service_ptr = service_ptr->ai_next) { + for (struct addrinfo *service_ptr = service_info_list; + service_ptr != nullptr; service_ptr = service_ptr->ai_next) { addr_list.emplace_back(SocketAddress(service_ptr)); } } Index: source/Host/common/TCPSocket.cpp =================================================================== --- source/Host/common/TCPSocket.cpp +++ source/Host/common/TCPSocket.cpp @@ -143,7 +143,7 @@ return error; auto addresses = lldb_private::SocketAddress::GetAddressInfo( - host_str.c_str(), NULL, AF_UNSPEC, SOCK_STREAM, IPPROTO_TCP); + host_str.c_str(), nullptr, AF_UNSPEC, SOCK_STREAM, IPPROTO_TCP); for (auto address : addresses) { error = CreateSocket(address.GetFamily()); if (error.Fail()) @@ -182,7 +182,7 @@ if (host_str == "*") host_str = "0.0.0.0"; auto addresses = lldb_private::SocketAddress::GetAddressInfo( - host_str.c_str(), NULL, AF_UNSPEC, SOCK_STREAM, IPPROTO_TCP); + host_str.c_str(), nullptr, AF_UNSPEC, SOCK_STREAM, IPPROTO_TCP); for (auto address : addresses) { int fd = Socket::CreateSocket(address.GetFamily(), kType, IPPROTO_TCP, m_child_processes_inherit, error); Index: source/Host/common/TaskPool.cpp =================================================================== --- source/Host/common/TaskPool.cpp +++ source/Host/common/TaskPool.cpp @@ -73,7 +73,7 @@ lldb::thread_result_t TaskPoolImpl::WorkerPtr(void *pool) { Worker((TaskPoolImpl *)pool); - return 0; + return nullptr; } void TaskPoolImpl::Worker(TaskPoolImpl *pool) { Index: source/Host/common/Terminal.cpp =================================================================== --- source/Host/common/Terminal.cpp +++ source/Host/common/Terminal.cpp @@ -112,7 +112,7 @@ m_tflags = ::fcntl(fd, F_GETFL, 0); #endif #ifdef LLDB_CONFIG_TERMIOS_SUPPORTED - if (m_termios_up == NULL) + if (m_termios_up == nullptr) m_termios_up.reset(new struct termios); int err = ::tcgetattr(fd, m_termios_up.get()); if (err != 0) @@ -151,7 +151,7 @@ if (ProcessGroupIsValid()) { // Save the original signal handler. - void (*saved_sigttou_callback)(int) = NULL; + void (*saved_sigttou_callback)(int) = nullptr; saved_sigttou_callback = (void (*)(int))signal(SIGTTOU, SIG_IGN); // Set the process group tcsetpgrp(fd, m_process_group); @@ -177,7 +177,7 @@ // Returns true if m_ttystate is valid bool TerminalState::TTYStateIsValid() const { #ifdef LLDB_CONFIG_TERMIOS_SUPPORTED - return m_termios_up != 0; + return m_termios_up != nullptr; #else return false; #endif Index: source/Host/common/ThreadLauncher.cpp =================================================================== --- source/Host/common/ThreadLauncher.cpp +++ source/Host/common/ThreadLauncher.cpp @@ -49,7 +49,7 @@ } #endif - pthread_attr_t *thread_attr_ptr = NULL; + pthread_attr_t *thread_attr_ptr = nullptr; pthread_attr_t thread_attr; bool destroy_attr = false; if (min_stack_byte_size > 0) { Index: source/Host/common/XML.cpp =================================================================== --- source/Host/common/XML.cpp +++ source/Host/common/XML.cpp @@ -134,7 +134,7 @@ llvm::StringRef XMLNode::GetAttributeValue(const char *name, const char *fail_value) const { - const char *attr_value = NULL; + const char *attr_value = nullptr; #if defined(LIBXML2_DEFINED) if (IsValid()) Index: source/Host/linux/Host.cpp =================================================================== --- source/Host/linux/Host.cpp +++ source/Host/linux/Host.cpp @@ -216,12 +216,12 @@ DIR *dirproc = opendir(procdir); if (dirproc) { - struct dirent *direntry = NULL; + struct dirent *direntry = nullptr; const uid_t our_uid = getuid(); const lldb::pid_t our_pid = getpid(); bool all_users = match_info.GetMatchAllUsers(); - while ((direntry = readdir(dirproc)) != NULL) { + while ((direntry = readdir(dirproc)) != nullptr) { if (direntry->d_type != DT_DIR || !IsDirNumeric(direntry->d_name)) continue; @@ -269,8 +269,8 @@ DIR *dirproc = opendir(process_task_dir.c_str()); if (dirproc) { - struct dirent *direntry = NULL; - while ((direntry = readdir(dirproc)) != NULL) { + struct dirent *direntry = nullptr; + while ((direntry = readdir(dirproc)) != nullptr) { if (direntry->d_type != DT_DIR || !IsDirNumeric(direntry->d_name)) continue; Index: source/Host/linux/HostInfoLinux.cpp =================================================================== --- source/Host/linux/HostInfoLinux.cpp +++ source/Host/linux/HostInfoLinux.cpp @@ -121,7 +121,8 @@ // retrieve the distribution id string. char distribution_id[256] = {'\0'}; - if (fgets(distribution_id, sizeof(distribution_id) - 1, file) != NULL) { + if (fgets(distribution_id, sizeof(distribution_id) - 1, file) != + nullptr) { if (log) log->Printf("distribution id command returned \"%s\"", distribution_id); Index: source/Host/posix/ConnectionFileDescriptorPosix.cpp =================================================================== --- source/Host/posix/ConnectionFileDescriptorPosix.cpp +++ source/Host/posix/ConnectionFileDescriptorPosix.cpp @@ -111,7 +111,7 @@ if (log) log->Printf("%p ConnectionFileDescriptor::~ConnectionFileDescriptor ()", static_cast(this)); - Disconnect(NULL); + Disconnect(nullptr); CloseCommandPipe(); } Index: source/Host/posix/HostThreadPosix.cpp =================================================================== --- source/Host/posix/HostThreadPosix.cpp +++ source/Host/posix/HostThreadPosix.cpp @@ -29,7 +29,7 @@ error.SetError(err, lldb::eErrorTypePOSIX); } else { if (result) - *result = NULL; + *result = nullptr; error.SetError(EINVAL, eErrorTypePOSIX); } Index: source/Interpreter/CommandInterpreter.cpp =================================================================== --- source/Interpreter/CommandInterpreter.cpp +++ source/Interpreter/CommandInterpreter.cpp @@ -1739,7 +1739,7 @@ log->Printf("HandleCommand, (revised) command_string: '%s'", command_string.c_str()); const bool wants_raw_input = - (cmd_obj != NULL) ? cmd_obj->WantsRawCommandString() : false; + (cmd_obj != nullptr) ? cmd_obj->WantsRawCommandString() : false; log->Printf("HandleCommand, wants_raw_input:'%s'", wants_raw_input ? "True" : "False"); } @@ -2214,7 +2214,7 @@ const char *CommandInterpreter::GetCommandPrefix() { const char *prefix = GetDebugger().GetIOHandlerCommandPrefix(); - return prefix == NULL ? "" : prefix; + return prefix == nullptr ? "" : prefix; } PlatformSP CommandInterpreter::GetPlatform(bool prefer_target_platform) { @@ -3206,7 +3206,7 @@ if (!scratch_command.empty()) revised_command_line.Printf(" %s", scratch_command.c_str()); - if (cmd_obj != NULL) + if (cmd_obj != nullptr) command_line = revised_command_line.GetString(); return cmd_obj; Index: source/Interpreter/OptionValue.cpp =================================================================== --- source/Interpreter/OptionValue.cpp +++ source/Interpreter/OptionValue.cpp @@ -165,13 +165,13 @@ OptionValueLanguage *OptionValue::GetAsLanguage() { if (GetType() == OptionValue::eTypeLanguage) return static_cast(this); - return NULL; + return nullptr; } const OptionValueLanguage *OptionValue::GetAsLanguage() const { if (GetType() == OptionValue::eTypeLanguage) return static_cast(this); - return NULL; + return nullptr; } OptionValueFormatEntity *OptionValue::GetAsFormatEntity() { @@ -520,7 +520,7 @@ value_sp.reset(new OptionValueFormat(eFormatInvalid)); break; case 1u << eTypeFormatEntity: - value_sp.reset(new OptionValueFormatEntity(NULL)); + value_sp.reset(new OptionValueFormatEntity(nullptr)); break; case 1u << eTypeLanguage: value_sp.reset(new OptionValueLanguage(eLanguageTypeUnknown)); Index: source/Plugins/ABI/SysV-arm/ABISysV_arm.cpp =================================================================== --- source/Plugins/ABI/SysV-arm/ABISysV_arm.cpp +++ source/Plugins/ABI/SysV-arm/ABISysV_arm.cpp @@ -1739,8 +1739,8 @@ uint32_t index = 0; for (index = 0; index < num_children; index++) { std::string name; - base_type = - compiler_type.GetFieldAtIndex(index, name, NULL, NULL, NULL); + base_type = compiler_type.GetFieldAtIndex(index, name, nullptr, + nullptr, nullptr); if (base_type.IsFloatingPointType(float_count, is_complex)) { llvm::Optional base_byte_size = @@ -1799,7 +1799,7 @@ const RegisterInfo *reg_info = reg_ctx->GetRegisterInfo(eRegisterKindDWARF, regnum); - if (reg_info == NULL) + if (reg_info == nullptr) break; RegisterValue reg_value; Index: source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp =================================================================== --- source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp +++ source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp @@ -356,7 +356,7 @@ return; else { const uint8_t *bytes = data.PeekData(offset, inst_size); - if (bytes == NULL) + if (bytes == nullptr) return; m_opcode_name.assign(".byte"); m_opcode.SetOpcodeBytes(bytes, inst_size); @@ -956,7 +956,7 @@ return Instance(); std::unique_ptr context_up( - new llvm::MCContext(asm_info_up.get(), reg_info_up.get(), 0)); + new llvm::MCContext(asm_info_up.get(), reg_info_up.get(), nullptr)); if (!context_up) return Instance(); @@ -1079,7 +1079,7 @@ DisassemblerLLVMC::DisassemblerLLVMC(const ArchSpec &arch, const char *flavor_string) - : Disassembler(arch, flavor_string), m_exe_ctx(NULL), m_inst(NULL), + : Disassembler(arch, flavor_string), m_exe_ctx(nullptr), m_inst(nullptr), m_data_from_file(false) { if (!FlavorValidForArchSpec(arch, m_flavor.c_str())) { m_flavor.assign("default"); @@ -1242,7 +1242,7 @@ if (disasm_up.get() && disasm_up->IsValid()) return disasm_up.release(); } - return NULL; + return nullptr; } size_t DisassemblerLLVMC::DecodeInstructions(const Address &base_addr, @@ -1329,7 +1329,7 @@ bool DisassemblerLLVMC::FlavorValidForArchSpec( const lldb_private::ArchSpec &arch, const char *flavor) { llvm::Triple triple = arch.GetTriple(); - if (flavor == NULL || strcmp(flavor, "default") == 0) + if (flavor == nullptr || strcmp(flavor, "default") == 0) return true; if (triple.getArch() == llvm::Triple::x86 || @@ -1358,7 +1358,7 @@ if (*type_ptr) { if (m_exe_ctx && m_inst) { // std::string remove_this_prior_to_checkin; - Target *target = m_exe_ctx ? m_exe_ctx->GetTargetPtr() : NULL; + Target *target = m_exe_ctx ? m_exe_ctx->GetTargetPtr() : nullptr; Address value_so_addr; Address pc_so_addr; if (m_inst->UsingFileAddress()) { @@ -1423,8 +1423,8 @@ } *type_ptr = LLVMDisassembler_ReferenceType_InOut_None; - *name = NULL; - return NULL; + *name = nullptr; + return nullptr; } // PluginInterface protocol Index: source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp =================================================================== --- source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp +++ source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp @@ -73,9 +73,9 @@ "on 32-bit targets)."}}; static constexpr PropertyDefinition g_properties[] = { - {"load-kexts", OptionValue::eTypeBoolean, true, true, NULL, {}, + {"load-kexts", OptionValue::eTypeBoolean, true, true, nullptr, {}, "Automatically loads kext images when attaching to a kernel."}, - {"scan-type", OptionValue::eTypeEnum, true, eKASLRScanNearPC, NULL, + {"scan-type", OptionValue::eTypeEnum, true, eKASLRScanNearPC, nullptr, OptionEnumValues(g_kaslr_kernel_scan_enum_values), "Control how many reads lldb will make while searching for a Darwin " "kernel on attach."}}; @@ -99,13 +99,13 @@ bool GetLoadKexts() const { const uint32_t idx = ePropertyLoadKexts; return m_collection_sp->GetPropertyAtIndexAsBoolean( - NULL, idx, g_properties[idx].default_uint_value != 0); + nullptr, idx, g_properties[idx].default_uint_value != 0); } KASLRScanType GetScanType() const { const uint32_t idx = ePropertyScanType; return (KASLRScanType)m_collection_sp->GetPropertyAtIndexAsEnumeration( - NULL, idx, g_properties[idx].default_uint_value); + nullptr, idx, g_properties[idx].default_uint_value); } }; @@ -132,7 +132,7 @@ ObjectFile *object_file = exe_module->GetObjectFile(); if (object_file) { if (object_file->GetStrata() != ObjectFile::eStrataKernel) { - return NULL; + return nullptr; } } } @@ -149,7 +149,7 @@ case llvm::Triple::WatchOS: // NEED_BRIDGEOS_TRIPLE case llvm::Triple::BridgeOS: if (triple_ref.getVendor() != llvm::Triple::Apple) { - return NULL; + return nullptr; } break; // If we have triple like armv7-unknown-unknown, we should try looking for @@ -157,7 +157,7 @@ case llvm::Triple::UnknownOS: break; default: - return NULL; + return nullptr; break; } } @@ -171,7 +171,7 @@ process->SetCanRunCode(false); return new DynamicLoaderDarwinKernel(process, kernel_load_address); } - return NULL; + return nullptr; } lldb::addr_t @@ -198,11 +198,11 @@ lldb::addr_t DynamicLoaderDarwinKernel::SearchForKernelAtSameLoadAddr(Process *process) { Module *exe_module = process->GetTarget().GetExecutableModulePointer(); - if (exe_module == NULL) + if (exe_module == nullptr) return LLDB_INVALID_ADDRESS; ObjectFile *exe_objfile = exe_module->GetObjectFile(); - if (exe_objfile == NULL) + if (exe_objfile == nullptr) return LLDB_INVALID_ADDRESS; if (exe_objfile->GetType() != ObjectFile::eTypeExecutable || @@ -282,7 +282,7 @@ } ThreadSP thread = process->GetThreadList().GetSelectedThread(); - if (thread.get() == NULL) + if (thread.get() == nullptr) return LLDB_INVALID_ADDRESS; addr_t pc = thread->GetRegisterContext()->GetPC(LLDB_INVALID_ADDRESS); @@ -454,7 +454,7 @@ return UUID(); ObjectFile *exe_objfile = memory_module_sp->GetObjectFile(); - if (exe_objfile == NULL) { + if (exe_objfile == nullptr) { if (log) log->Printf("DynamicLoaderDarwinKernel::CheckForKernelImageAtAddress " "found a binary at 0x%" PRIx64 @@ -541,7 +541,7 @@ m_process->ClearBreakpointSiteByID(m_break_id); if (clear_process) - m_process = NULL; + m_process = nullptr; m_kernel.Clear(); m_known_kexts.clear(); m_kext_summary_header_ptr_addr.Clear(); @@ -638,7 +638,7 @@ bool DynamicLoaderDarwinKernel::KextImageInfo::ReadMemoryModule( Process *process) { Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST); - if (m_memory_module_sp.get() != NULL) + if (m_memory_module_sp.get() != nullptr) return true; if (m_load_address == LLDB_INVALID_ADDRESS) return false; @@ -658,7 +658,7 @@ ModuleSP memory_module_sp = process->ReadModuleFromMemory(file_spec, m_load_address, size_to_read); - if (memory_module_sp.get() == NULL) + if (memory_module_sp.get() == nullptr) return false; bool is_kernel = false; @@ -806,9 +806,9 @@ FileSpec kext_filespec(m_name.c_str()); FileSpecList search_paths = target.GetExecutableSearchPaths(); kext_bundle_module_spec.GetFileSpec() = kext_filespec; - platform_sp->GetSharedModule( - kext_bundle_module_spec, process, m_module_sp, - &search_paths, NULL, NULL); + platform_sp->GetSharedModule(kext_bundle_module_spec, process, + m_module_sp, &search_paths, nullptr, + nullptr); } } @@ -1378,7 +1378,7 @@ lldb::offset_t offset = kext_summary_offset; const void *name_data = extractor.GetData(&offset, KERNEL_MODULE_MAX_NAME); - if (name_data == NULL) + if (name_data == nullptr) break; image_infos[i].SetName((const char *)name_data); UUID uuid = UUID::fromOptionalData(extractor.GetData(&offset, 16), 16); @@ -1426,7 +1426,7 @@ // Dump the _dyld_all_image_infos members and all current image infos that we // have parsed to the file handle provided. void DynamicLoaderDarwinKernel::PutToLog(Log *log) const { - if (log == NULL) + if (log == nullptr) return; std::lock_guard guard(m_mutex); @@ -1464,7 +1464,7 @@ module_spec_list.Append(m_kernel.GetModule()->GetFileSpec()); Breakpoint *bp = m_process->GetTarget() - .CreateBreakpoint(&module_spec_list, NULL, + .CreateBreakpoint(&module_spec_list, nullptr, "OSKextLoadedKextSummariesUpdated", eFunctionNameTypeFull, eLanguageTypeUnknown, 0, skip_prologue, internal_bp, hardware) Index: source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp =================================================================== --- source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp +++ source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp @@ -104,7 +104,7 @@ if (create) return new DynamicLoaderHexagonDYLD(process); - return NULL; + return nullptr; } DynamicLoaderHexagonDYLD::DynamicLoaderHexagonDYLD(Process *process) @@ -420,7 +420,7 @@ const SymbolContext &context = frame->GetSymbolContext(eSymbolContextSymbol); Symbol *sym = context.symbol; - if (sym == NULL || !sym->IsTrampoline()) + if (sym == nullptr || !sym->IsTrampoline()) return thread_plan_sp; const ConstString sym_name = sym->GetMangled().GetName( Index: source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp =================================================================== --- source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp +++ source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp @@ -84,7 +84,7 @@ void DynamicLoaderDarwin::Clear(bool clear_process) { std::lock_guard guard(m_mutex); if (clear_process) - m_process = NULL; + m_process = nullptr; m_dyld_image_infos.clear(); m_dyld_image_infos_stop_id = UINT32_MAX; m_dyld.Clear(false); @@ -115,7 +115,7 @@ // We'll call Target::ModulesDidLoad after all the modules have been // added to the target, don't let it be called for every one. module_sp = target.GetOrCreateModule(module_spec, false /* notify */); - if (!module_sp || module_sp->GetObjectFile() == NULL) + if (!module_sp || module_sp->GetObjectFile() == nullptr) module_sp = m_process->ReadModuleFromMemory(image_info.file_spec, image_info.address); @@ -533,8 +533,8 @@ if (exe_idx != UINT32_MAX) { const bool can_create = true; - ModuleSP exe_module_sp( - FindTargetModuleForImageInfo(image_infos[exe_idx], can_create, NULL)); + ModuleSP exe_module_sp(FindTargetModuleForImageInfo(image_infos[exe_idx], + can_create, nullptr)); if (exe_module_sp) { if (log) log->Printf("Found executable module: %s", @@ -549,8 +549,8 @@ if (dyld_idx != UINT32_MAX) { const bool can_create = true; - ModuleSP dyld_sp = - FindTargetModuleForImageInfo(image_infos[dyld_idx], can_create, NULL); + ModuleSP dyld_sp = FindTargetModuleForImageInfo(image_infos[dyld_idx], + can_create, nullptr); if (dyld_sp.get()) { if (log) log->Printf("Found dyld module: %s", @@ -567,7 +567,7 @@ if (image_info.header.filetype == llvm::MachO::MH_DYLINKER) { const bool can_create = true; ModuleSP dyld_sp = - FindTargetModuleForImageInfo(image_info, can_create, NULL); + FindTargetModuleForImageInfo(image_info, can_create, nullptr); if (dyld_sp.get()) { Target &target = m_process->GetTarget(); target.GetImages().AppendIfNeeded(dyld_sp); @@ -605,7 +605,7 @@ m_dyld_image_infos.push_back(image_infos[idx]); ModuleSP image_module_sp( - FindTargetModuleForImageInfo(image_infos[idx], true, NULL)); + FindTargetModuleForImageInfo(image_infos[idx], true, nullptr)); if (image_module_sp) { ObjectFile *objfile = image_module_sp->GetObjectFile(); @@ -628,7 +628,7 @@ commpage_image_module_sp = target.GetOrCreateModule(module_spec, true /* notify */); if (!commpage_image_module_sp || - commpage_image_module_sp->GetObjectFile() == NULL) { + commpage_image_module_sp->GetObjectFile() == nullptr) { commpage_image_module_sp = m_process->ReadModuleFromMemory( image_infos[idx].file_spec, image_infos[idx].address); // Always load a memory image right away in the target in case @@ -686,15 +686,16 @@ if (sym_ctx.symbol) { module_sp = sym_ctx.symbol->GetAddressRef().GetModule(); } - if (module_sp.get() == NULL && sym_ctx.function) { + if (module_sp.get() == nullptr && sym_ctx.function) { module_sp = sym_ctx.function->GetAddressRange().GetBaseAddress().GetModule(); } - if (module_sp.get() == NULL) + if (module_sp.get() == nullptr) return false; ObjCLanguageRuntime *objc_runtime = m_process->GetObjCLanguageRuntime(); - return objc_runtime != NULL && objc_runtime->IsModuleObjCLibrary(module_sp); + return objc_runtime != nullptr && + objc_runtime->IsModuleObjCLibrary(module_sp); } // Dump a Segment to the file handle provided. @@ -719,7 +720,7 @@ if (segments[i].name == name) return &segments[i]; } - return NULL; + return nullptr; } // Dump an image info structure to the file handle provided. @@ -791,7 +792,7 @@ Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); TargetSP target_sp(thread.CalculateTarget()); - if (current_symbol != NULL) { + if (current_symbol != nullptr) { std::vector
addresses; if (current_symbol->IsTrampoline()) { Index: source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp =================================================================== --- source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp +++ source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp @@ -68,7 +68,7 @@ if (create) return new DynamicLoaderMacOS(process); - return NULL; + return nullptr; } // Constructor @@ -334,7 +334,7 @@ // Dump the _dyld_all_image_infos members and all current image infos that we // have parsed to the file handle provided. void DynamicLoaderMacOS::PutToLog(Log *log) const { - if (log == NULL) + if (log == nullptr) return; } Index: source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp =================================================================== --- source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp +++ source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp @@ -88,7 +88,7 @@ if (create) return new DynamicLoaderMacOSXDYLD(process); - return NULL; + return nullptr; } // Constructor @@ -608,7 +608,7 @@ // We'll remove them all at one go later on. ModuleSP unload_image_module_sp( - FindTargetModuleForImageInfo(image_infos[idx], false, NULL)); + FindTargetModuleForImageInfo(image_infos[idx], false, nullptr)); if (unload_image_module_sp.get()) { // When we unload, be sure to use the image info from the old list, // since that has sections correctly filled in. @@ -794,7 +794,7 @@ if (data.GetU32(&offset, &header->cputype, (sizeof(llvm::MachO::mach_header) / sizeof(uint32_t)) - 1)) { - if (load_command_data == NULL) + if (load_command_data == nullptr) return true; // We were able to read the mach_header and weren't asked // to read the load command bytes @@ -922,7 +922,7 @@ &data)) continue; - ParseLoadCommands(data, image_infos[i], NULL); + ParseLoadCommands(data, image_infos[i], nullptr); if (image_infos[i].header.filetype == llvm::MachO::MH_EXECUTE) exe_idx = i; @@ -933,8 +933,8 @@ if (exe_idx < image_infos.size()) { const bool can_create = true; - ModuleSP exe_module_sp( - FindTargetModuleForImageInfo(image_infos[exe_idx], can_create, NULL)); + ModuleSP exe_module_sp(FindTargetModuleForImageInfo(image_infos[exe_idx], + can_create, nullptr)); if (exe_module_sp) { UpdateImageLoadAddress(exe_module_sp.get(), image_infos[exe_idx]); @@ -969,7 +969,7 @@ // Dump the _dyld_all_image_infos members and all current image infos that we // have parsed to the file handle provided. void DynamicLoaderMacOSXDYLD::PutToLog(Log *log) const { - if (log == NULL) + if (log == nullptr) return; std::lock_guard guard(m_mutex); Index: source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp =================================================================== --- source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp +++ source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp @@ -68,7 +68,7 @@ if (create) return new DynamicLoaderPOSIXDYLD(process); - return NULL; + return nullptr; } DynamicLoaderPOSIXDYLD::DynamicLoaderPOSIXDYLD(Process *process) @@ -463,7 +463,7 @@ const SymbolContext &context = frame->GetSymbolContext(eSymbolContextSymbol); Symbol *sym = context.symbol; - if (sym == NULL || !sym->IsTrampoline()) + if (sym == nullptr || !sym->IsTrampoline()) return thread_plan_sp; ConstString sym_name = sym->GetName(); @@ -638,7 +638,7 @@ if (m_entry_point != LLDB_INVALID_ADDRESS) return m_entry_point; - if (m_auxv == NULL) + if (m_auxv == nullptr) return LLDB_INVALID_ADDRESS; AuxVector::iterator I = m_auxv->FindEntry(AuxVector::AUXV_AT_ENTRY); Index: source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.cpp =================================================================== --- source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.cpp +++ source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.cpp @@ -43,7 +43,7 @@ if (create) return new DynamicLoaderStatic(process); - return NULL; + return nullptr; } // Constructor Index: source/Plugins/ExpressionParser/Clang/ASTDumper.cpp =================================================================== --- source/Plugins/ExpressionParser/Clang/ASTDumper.cpp +++ source/Plugins/ExpressionParser/Clang/ASTDumper.cpp @@ -85,7 +85,7 @@ memcpy(str, m_dump.c_str(), len); - char *end = NULL; + char *end = nullptr; end = strchr(str, '\n'); Index: source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp =================================================================== --- source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp +++ source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp @@ -34,8 +34,9 @@ ASTResultSynthesizer::ASTResultSynthesizer(ASTConsumer *passthrough, bool top_level, Target &target) - : m_ast_context(NULL), m_passthrough(passthrough), m_passthrough_sema(NULL), - m_target(target), m_sema(NULL), m_top_level(top_level) { + : m_ast_context(nullptr), m_passthrough(passthrough), + m_passthrough_sema(nullptr), m_target(target), m_sema(nullptr), + m_top_level(top_level) { if (!m_passthrough) return; @@ -311,7 +312,7 @@ (is_lvalue ? "lvalue" : "rvalue"), s.c_str()); } - clang::VarDecl *result_decl = NULL; + clang::VarDecl *result_decl = nullptr; if (is_lvalue) { IdentifierInfo *result_ptr_id; @@ -329,14 +330,14 @@ QualType ptr_qual_type; - if (expr_qual_type->getAs() != NULL) + if (expr_qual_type->getAs() != nullptr) ptr_qual_type = Ctx.getObjCObjectPointerType(expr_qual_type); else ptr_qual_type = Ctx.getPointerType(expr_qual_type); result_decl = VarDecl::Create(Ctx, DC, SourceLocation(), SourceLocation(), - result_ptr_id, ptr_qual_type, NULL, SC_Static); + result_ptr_id, ptr_qual_type, nullptr, SC_Static); if (!result_decl) return false; @@ -350,8 +351,9 @@ } else { IdentifierInfo &result_id = Ctx.Idents.get("$__lldb_expr_result"); - result_decl = VarDecl::Create(Ctx, DC, SourceLocation(), SourceLocation(), - &result_id, expr_qual_type, NULL, SC_Static); + result_decl = + VarDecl::Create(Ctx, DC, SourceLocation(), SourceLocation(), &result_id, + expr_qual_type, nullptr, SC_Static); if (!result_decl) return false; @@ -507,7 +509,7 @@ } void ASTResultSynthesizer::ForgetSema() { - m_sema = NULL; + m_sema = nullptr; if (m_passthrough_sema) m_passthrough_sema->ForgetSema(); Index: source/Plugins/ExpressionParser/Clang/ASTStructExtractor.cpp =================================================================== --- source/Plugins/ExpressionParser/Clang/ASTStructExtractor.cpp +++ source/Plugins/ExpressionParser/Clang/ASTStructExtractor.cpp @@ -29,9 +29,9 @@ ASTStructExtractor::ASTStructExtractor(ASTConsumer *passthrough, const char *struct_name, ClangFunctionCaller &function) - : m_ast_context(NULL), m_passthrough(passthrough), m_passthrough_sema(NULL), - m_sema(NULL), m_action(NULL), m_function(function), - m_struct_name(struct_name) { + : m_ast_context(nullptr), m_passthrough(passthrough), + m_passthrough_sema(nullptr), m_sema(nullptr), m_action(nullptr), + m_function(function), m_struct_name(struct_name) { if (!m_passthrough) return; @@ -57,7 +57,7 @@ if (!body_compound_stmt) return; // do we have to handle this? - RecordDecl *struct_decl = NULL; + RecordDecl *struct_decl = nullptr; StringRef desired_name(m_struct_name); @@ -177,8 +177,8 @@ } void ASTStructExtractor::ForgetSema() { - m_sema = NULL; - m_action = NULL; + m_sema = nullptr; + m_action = nullptr; if (m_passthrough_sema) m_passthrough_sema->ForgetSema(); Index: source/Plugins/ExpressionParser/Clang/ClangASTSource.h =================================================================== --- source/Plugins/ExpressionParser/Clang/ClangASTSource.h +++ source/Plugins/ExpressionParser/Clang/ClangASTSource.h @@ -45,15 +45,15 @@ ~ClangASTSource() override; /// Interface stubs. - clang::Decl *GetExternalDecl(uint32_t) override { return NULL; } - clang::Stmt *GetExternalDeclStmt(uint64_t) override { return NULL; } + clang::Decl *GetExternalDecl(uint32_t) override { return nullptr; } + clang::Stmt *GetExternalDeclStmt(uint64_t) override { return nullptr; } clang::Selector GetExternalSelector(uint32_t) override { return clang::Selector(); } uint32_t GetNumExternalSelectors() override { return 0; } clang::CXXBaseSpecifier * GetExternalCXXBaseSpecifiers(uint64_t Offset) override { - return NULL; + return nullptr; } void MaterializeVisibleDecls(const clang::DeclContext *DC) { return; } Index: source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp =================================================================== --- source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp +++ source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp @@ -51,7 +51,7 @@ ClangASTSource::ClangASTSource(const lldb::TargetSP &target) : m_import_in_progress(false), m_lookups_enabled(false), m_target(target), - m_ast_context(NULL), m_active_lexical_decls(), m_active_lookups() { + m_ast_context(nullptr), m_active_lexical_decls(), m_active_lookups() { if (!target->GetUseModernTypeLookup()) { m_ast_importer_sp = m_target->GetClangASTImporter(); } @@ -441,8 +441,8 @@ return; } - Decl *original_decl = NULL; - ASTContext *original_ctx = NULL; + Decl *original_decl = nullptr; + ASTContext *original_ctx = nullptr; if (m_ast_importer_sp->ResolveDeclOrigin(interface_decl, &original_decl, &original_ctx)) { @@ -475,12 +475,12 @@ lldb::ProcessSP process(m_target->GetProcessSP()); if (!process) - return NULL; + return nullptr; ObjCLanguageRuntime *language_runtime(process->GetObjCLanguageRuntime()); if (!language_runtime) - return NULL; + return nullptr; ConstString class_name(interface_decl->getNameAsString().c_str()); @@ -488,7 +488,7 @@ language_runtime->LookupInCompleteClassCache(class_name)); if (!complete_type_sp) - return NULL; + return nullptr; TypeFromUser complete_type = TypeFromUser(complete_type_sp->GetFullCompilerType()); @@ -496,7 +496,7 @@ complete_type.GetOpaqueQualType(); if (!complete_opaque_type) - return NULL; + return nullptr; const clang::Type *complete_clang_type = QualType::getFromOpaquePtr(complete_opaque_type).getTypePtr(); @@ -504,7 +504,7 @@ dyn_cast(complete_clang_type); if (!complete_interface_type) - return NULL; + return nullptr; ObjCInterfaceDecl *complete_iface_decl(complete_interface_type->getDecl()); @@ -569,8 +569,8 @@ current_id, static_cast(m_ast_context)); } - Decl *original_decl = NULL; - ASTContext *original_ctx = NULL; + Decl *original_decl = nullptr; + ASTContext *original_ctx = nullptr; if (!m_ast_importer_sp->ResolveDeclOrigin(context_decl, &original_decl, &original_ctx)) @@ -993,9 +993,9 @@ template class TaggedASTDecl { public: - TaggedASTDecl() : decl(NULL) {} + TaggedASTDecl() : decl(nullptr) {} TaggedASTDecl(D *_decl) : decl(_decl) {} - bool IsValid() const { return (decl != NULL); } + bool IsValid() const { return (decl != nullptr); } bool IsInvalid() const { return !IsValid(); } D *operator->() const { return decl; } D *decl; @@ -1028,7 +1028,7 @@ template DeclFromUser DeclFromParser::GetOrigin(ClangASTSource &source) { DeclFromUser<> origin_decl; - source.ResolveDeclOrigin(this->decl, &origin_decl.decl, NULL); + source.ResolveDeclOrigin(this->decl, &origin_decl.decl, nullptr); if (origin_decl.IsInvalid()) return DeclFromUser(); return DeclFromUser(dyn_cast(origin_decl.decl)); @@ -1158,8 +1158,8 @@ return; do { - Decl *original_decl = NULL; - ASTContext *original_ctx = NULL; + Decl *original_decl = nullptr; + ASTContext *original_ctx = nullptr; m_ast_importer_sp->ResolveDeclOrigin(interface_decl, &original_decl, &original_ctx); @@ -2063,12 +2063,12 @@ assert(type && "Type for variable must be valid!"); if (!type.IsValid()) - return NULL; + return nullptr; ClangASTContext *lldb_ast = llvm::dyn_cast(type.GetTypeSystem()); if (!lldb_ast) - return NULL; + return nullptr; IdentifierInfo *ii = m_decl_name.getAsIdentifierInfo(); @@ -2076,7 +2076,7 @@ clang::NamedDecl *Decl = VarDecl::Create( *ast, const_cast(m_decl_context), SourceLocation(), - SourceLocation(), ii, ClangUtil::GetQualType(type), 0, SC_Static); + SourceLocation(), ii, ClangUtil::GetQualType(type), nullptr, SC_Static); m_decls.push_back(Decl); return Decl; @@ -2087,15 +2087,15 @@ assert(type && "Type for variable must be valid!"); if (!type.IsValid()) - return NULL; + return nullptr; if (m_function_types.count(type)) - return NULL; + return nullptr; ClangASTContext *lldb_ast = llvm::dyn_cast(type.GetTypeSystem()); if (!lldb_ast) - return NULL; + return nullptr; m_function_types.insert(type); @@ -2124,7 +2124,7 @@ clang::FunctionDecl *func_decl = FunctionDecl::Create( *ast, context, SourceLocation(), SourceLocation(), decl_name, qual_type, - NULL, SC_Extern, isInlineSpecified, hasWrittenPrototype, + nullptr, SC_Extern, isInlineSpecified, hasWrittenPrototype, isConstexprSpecified); // We have to do more than just synthesize the FunctionDecl. We have to @@ -2143,9 +2143,10 @@ for (ArgIndex = 0; ArgIndex < NumArgs; ++ArgIndex) { QualType arg_qual_type(func_proto_type->getParamType(ArgIndex)); - parm_var_decls.push_back(ParmVarDecl::Create( - *ast, const_cast(context), SourceLocation(), - SourceLocation(), NULL, arg_qual_type, NULL, SC_Static, NULL)); + parm_var_decls.push_back( + ParmVarDecl::Create(*ast, const_cast(context), + SourceLocation(), SourceLocation(), nullptr, + arg_qual_type, nullptr, SC_Static, nullptr)); } func_decl->setParams(ArrayRef(parm_var_decls)); @@ -2166,7 +2167,7 @@ ClangASTContext::IsOperator(decl_name.getAsString().c_str(), op_kind)) { if (!ClangASTContext::CheckOverloadedOperatorKindParameterCount( false, op_kind, func_proto_type->getNumParams())) - return NULL; + return nullptr; } m_decls.push_back(func_decl); @@ -2214,7 +2215,7 @@ return (NamedDecl *)interface_decl; } } - return NULL; + return nullptr; } void NameSearchContext::AddLookupResult(clang::DeclContextLookupResult result) { Index: source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h =================================================================== --- source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h +++ source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h @@ -242,9 +242,8 @@ /// \return /// Valid load address for the symbol lldb::addr_t GetSymbolAddress(Target &target, Process *process, - ConstString name, - lldb::SymbolType symbol_type, - Module *module = NULL); + ConstString name, lldb::SymbolType symbol_type, + Module *module = nullptr); lldb::addr_t GetSymbolAddress(ConstString name, lldb::SymbolType symbol_type); @@ -331,7 +330,7 @@ return m_exe_ctx.GetTargetPtr(); else if (m_sym_ctx.target_sp) m_sym_ctx.target_sp.get(); - return NULL; + return nullptr; } ExecutionContext m_exe_ctx; ///< The execution context to use when parsing. @@ -368,7 +367,7 @@ struct StructVars { StructVars() : m_struct_alignment(0), m_struct_size(0), m_struct_laid_out(false), - m_result_name(), m_object_pointer_type(NULL, NULL) {} + m_result_name(), m_object_pointer_type(nullptr, nullptr) {} lldb::offset_t m_struct_alignment; ///< The alignment of the struct in bytes. @@ -421,7 +420,7 @@ lldb::VariableSP FindGlobalVariable(Target &target, lldb::ModuleSP &module, ConstString name, CompilerDeclContext *namespace_decl, - TypeFromUser *type = NULL); + TypeFromUser *type = nullptr); /// Get the value of a variable in a given execution context and return the /// associated Types if needed. @@ -449,8 +448,8 @@ /// Return true if the value was successfully filled in. bool GetVariableValue(lldb::VariableSP &var, lldb_private::Value &var_location, - TypeFromUser *found_type = NULL, - TypeFromParser *parser_type = NULL); + TypeFromUser *found_type = nullptr, + TypeFromParser *parser_type = nullptr); /// Use the NameSearchContext to generate a Decl for the given LLDB /// Variable, and put it in the Tuple list. Index: source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp =================================================================== --- source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp +++ source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp @@ -367,7 +367,7 @@ Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); ExecutionContext &exe_ctx = m_parser_vars->m_exe_ctx; Target *target = exe_ctx.GetTargetPtr(); - if (target == NULL) + if (target == nullptr) return false; ClangASTContext *context(target->GetScratchClangASTContext()); @@ -951,7 +951,7 @@ // Clang is looking for the type of "this" - if (frame == NULL) + if (frame == nullptr) return; // Find the block that defines the function represented by "sym_ctx" @@ -1277,7 +1277,8 @@ } } if (target) { - var = FindGlobalVariable(*target, module_sp, name, &namespace_decl, NULL); + var = FindGlobalVariable(*target, module_sp, name, &namespace_decl, + nullptr); if (var) { valobj = ValueObjectVariable::Create(target, var); @@ -1434,8 +1435,8 @@ } if (sc_list.GetSize()) { - Symbol *extern_symbol = NULL; - Symbol *non_extern_symbol = NULL; + Symbol *extern_symbol = nullptr; + Symbol *non_extern_symbol = nullptr; for (uint32_t index = 0, num_indices = sc_list.GetSize(); index < num_indices; ++index) { @@ -1452,13 +1453,13 @@ if (decl_ctx.IsClassMethod(nullptr, nullptr, nullptr)) continue; - AddOneFunction(context, sym_ctx.function, NULL, current_id); + AddOneFunction(context, sym_ctx.function, nullptr, current_id); context.m_found.function_with_type_info = true; context.m_found.function = true; } else if (sym_ctx.symbol) { if (sym_ctx.symbol->GetType() == eSymbolTypeReExported && target) { sym_ctx.symbol = sym_ctx.symbol->ResolveReExportedSymbol(*target); - if (sym_ctx.symbol == NULL) + if (sym_ctx.symbol == nullptr) continue; } @@ -1484,10 +1485,10 @@ if (!context.m_found.function_with_type_info) { if (extern_symbol) { - AddOneFunction(context, NULL, extern_symbol, current_id); + AddOneFunction(context, nullptr, extern_symbol, current_id); context.m_found.function = true; } else if (non_extern_symbol) { - AddOneFunction(context, NULL, non_extern_symbol, current_id); + AddOneFunction(context, nullptr, non_extern_symbol, current_id); context.m_found.function = true; } } @@ -1723,7 +1724,7 @@ bool is_reference = pt.IsReferenceType(); - NamedDecl *var_decl = NULL; + NamedDecl *var_decl = nullptr; if (is_reference) var_decl = context.AddVarDecl(pt); else @@ -1740,7 +1741,7 @@ entity->GetParserVars(GetParserID()); parser_vars->m_parser_type = pt; parser_vars->m_named_decl = var_decl; - parser_vars->m_llvm_value = NULL; + parser_vars->m_llvm_value = nullptr; parser_vars->m_lldb_value = var_location; parser_vars->m_lldb_var = var; @@ -1783,7 +1784,7 @@ ->GetParserVars(GetParserID()); parser_vars->m_parser_type = parser_type; parser_vars->m_named_decl = var_decl; - parser_vars->m_llvm_value = NULL; + parser_vars->m_llvm_value = nullptr; parser_vars->m_lldb_value.Clear(); if (log) { @@ -1802,7 +1803,7 @@ Target *target = m_parser_vars->m_exe_ctx.GetTargetPtr(); - if (target == NULL) + if (target == nullptr) return; ASTContext *scratch_ast_context = @@ -1841,7 +1842,7 @@ parser_vars->m_parser_type = parser_type; parser_vars->m_named_decl = var_decl; - parser_vars->m_llvm_value = NULL; + parser_vars->m_llvm_value = nullptr; parser_vars->m_lldb_sym = &symbol; if (log) { @@ -1889,7 +1890,7 @@ var_type.getAsOpaquePtr(), ClangASTContext::GetASTContext(&var_decl->getASTContext())); - lldb::opaque_compiler_type_t copied_type = 0; + lldb::opaque_compiler_type_t copied_type = nullptr; if (m_ast_importer_sp) { copied_type = m_ast_importer_sp->CopyType( scratch_ast_context->getASTContext(), &var_decl->getASTContext(), @@ -1962,7 +1963,7 @@ entity->GetParserVars(GetParserID()); parser_vars->m_parser_type = parser_clang_type; parser_vars->m_named_decl = var_decl; - parser_vars->m_llvm_value = NULL; + parser_vars->m_llvm_value = nullptr; parser_vars->m_lldb_value.Clear(); entity->m_flags |= ClangExpressionVariable::EVBareRegister; @@ -1981,7 +1982,7 @@ Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); - NamedDecl *function_decl = NULL; + NamedDecl *function_decl = nullptr; Address fun_address; CompilerType function_clang_type; @@ -2141,7 +2142,7 @@ } parser_vars->m_named_decl = function_decl; - parser_vars->m_llvm_value = NULL; + parser_vars->m_llvm_value = nullptr; if (log) { std::string function_str = @@ -2194,7 +2195,7 @@ CXXMethodDecl *method_decl = ClangASTContext::GetASTContext(m_ast_context) ->AddMethodToCXXRecordType( - copied_clang_type.GetOpaqueQualType(), "$__lldb_expr", NULL, + copied_clang_type.GetOpaqueQualType(), "$__lldb_expr", nullptr, method_type, lldb::eAccessPublic, is_virtual, is_static, is_inline, is_explicit, is_attr_used, is_artificial); Index: source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp =================================================================== --- source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp +++ source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp @@ -1229,7 +1229,7 @@ type_system_helper->DeclMap(); // result can be NULL if (decl_map) { - Stream *error_stream = NULL; + Stream *error_stream = nullptr; Target *target = exe_ctx.GetTargetPtr(); error_stream = target->GetDebugger().GetErrorFile().get(); Index: source/Plugins/ExpressionParser/Clang/ClangExpressionVariable.h =================================================================== --- source/Plugins/ExpressionParser/Clang/ClangExpressionVariable.h +++ source/Plugins/ExpressionParser/Clang/ClangExpressionVariable.h @@ -117,8 +117,8 @@ class ParserVars { public: ParserVars() - : m_parser_type(), m_named_decl(NULL), m_llvm_value(NULL), - m_lldb_value(), m_lldb_var(), m_lldb_sym(NULL) {} + : m_parser_type(), m_named_decl(nullptr), m_llvm_value(nullptr), + m_lldb_value(), m_lldb_var(), m_lldb_sym(nullptr) {} TypeFromParser m_parser_type; ///< The type of the variable according to the parser @@ -152,7 +152,7 @@ ParserVarMap::iterator i = m_parser_vars.find(parser_id); if (i == m_parser_vars.end()) - return NULL; + return nullptr; else return &i->second; } @@ -186,7 +186,7 @@ JITVarMap::iterator i = m_jit_vars.find(parser_id); if (i == m_jit_vars.end()) - return NULL; + return nullptr; else return &i->second; } Index: source/Plugins/ExpressionParser/Clang/ClangFunctionCaller.h =================================================================== --- source/Plugins/ExpressionParser/Clang/ClangFunctionCaller.h +++ source/Plugins/ExpressionParser/Clang/ClangFunctionCaller.h @@ -72,7 +72,7 @@ /// Return the object that the parser should use when resolving external /// values. May be NULL if everything should be self-contained. - ClangExpressionDeclMap *DeclMap() override { return NULL; } + ClangExpressionDeclMap *DeclMap() override { return nullptr; } /// Return the object that the parser should allow to access ASTs. May be /// NULL if the ASTs do not need to be transformed. Index: source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.cpp =================================================================== --- source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.cpp +++ source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.cpp @@ -48,7 +48,7 @@ return; name++; - if (strtoul(name, NULL, 0) == m_next_persistent_variable_id - 1) + if (strtoul(name, nullptr, 0) == m_next_persistent_variable_id - 1) m_next_persistent_variable_id--; } @@ -72,7 +72,7 @@ m_persistent_decls.find(name.GetCString()); if (i == m_persistent_decls.end()) - return NULL; + return nullptr; else return i->second; } Index: source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp =================================================================== --- source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp +++ source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp @@ -102,7 +102,7 @@ } StackFrame *frame = exe_ctx.GetFramePtr(); - if (frame == NULL) { + if (frame == nullptr) { if (log) log->Printf(" [CUE::SC] Null stack frame"); return; Index: source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.cpp =================================================================== --- source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.cpp +++ source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.cpp @@ -90,7 +90,7 @@ ResetDeclMap(exe_ctx, keep_result_in_memory); - if (!DeclMap()->WillParse(exe_ctx, NULL)) { + if (!DeclMap()->WillParse(exe_ctx, nullptr)) { diagnostic_manager.PutString( eDiagnosticSeverityError, "current process state is unsuitable for expression parsing"); Index: source/Plugins/ExpressionParser/Clang/IRForTarget.cpp =================================================================== --- source/Plugins/ExpressionParser/Clang/IRForTarget.cpp +++ source/Plugins/ExpressionParser/Clang/IRForTarget.cpp @@ -60,7 +60,7 @@ static llvm::Value *FindEntryInstruction(llvm::Function *function) { if (function->empty()) - return NULL; + return nullptr; return function->getEntryBlock().getFirstNonPHIOrDbg(); } @@ -71,11 +71,12 @@ lldb_private::Stream &error_stream, const char *func_name) : ModulePass(ID), m_resolve_vars(resolve_vars), m_func_name(func_name), - m_module(NULL), m_decl_map(decl_map), m_CFStringCreateWithBytes(NULL), - m_sel_registerName(NULL), m_objc_getClass(NULL), m_intptr_ty(NULL), - m_error_stream(error_stream), - m_execution_unit(execution_unit), m_result_store(NULL), - m_result_is_pointer(false), m_reloc_placeholder(NULL), + m_module(nullptr), m_decl_map(decl_map), + m_CFStringCreateWithBytes(nullptr), m_sel_registerName(nullptr), + m_objc_getClass(nullptr), m_intptr_ty(nullptr), + m_error_stream(error_stream), m_execution_unit(execution_unit), + m_result_store(nullptr), m_result_is_pointer(false), + m_reloc_placeholder(nullptr), m_entry_instruction_finder(FindEntryInstruction) {} /* Handy utility functions used at several places in the code */ @@ -116,7 +117,7 @@ module->getNamedMetadata("clang.global.decl.ptrs"); if (!named_metadata) - return NULL; + return nullptr; unsigned num_nodes = named_metadata->getNumOperands(); unsigned node_index; @@ -125,7 +126,7 @@ llvm::MDNode *metadata_node = dyn_cast(named_metadata->getOperand(node_index)); if (!metadata_node) - return NULL; + return nullptr; if (metadata_node->getNumOperands() != 2) continue; @@ -138,14 +139,14 @@ mdconst::dyn_extract(metadata_node->getOperand(1)); if (!constant_int) - return NULL; + return nullptr; uintptr_t ptr = constant_int->getZExtValue(); return reinterpret_cast(ptr); } - return NULL; + return nullptr; } clang::NamedDecl *IRForTarget::DeclForGlobal(GlobalValue *global_val) { @@ -164,7 +165,7 @@ ValueSymbolTable &value_symbol_table = m_module->getValueSymbolTable(); std::string result_name_str; - const char *result_name = NULL; + const char *result_name = nullptr; for (ValueSymbolTable::iterator vi = value_symbol_table.begin(), ve = value_symbol_table.end(); @@ -342,8 +343,8 @@ GlobalVariable *new_result_global = new GlobalVariable( (*m_module), result_global->getType()->getElementType(), - false, /* not constant */ - GlobalValue::ExternalLinkage, NULL, /* no initializer */ + false, /* not constant */ + GlobalValue::ExternalLinkage, nullptr, /* no initializer */ m_result_name.GetCString()); // It's too late in compilation to create a new VarDecl for this, but we @@ -488,7 +489,7 @@ CFSCWB_ty, ConstantExpr::getIntToPtr(CFSCWB_addr_int, CFSCWB_ptr_ty)}; } - ConstantDataSequential *string_array = NULL; + ConstantDataSequential *string_array = nullptr; if (cstr) string_array = dyn_cast(cstr->getInitializer()); @@ -733,7 +734,7 @@ } if (!cstr_array) - cstr_global = NULL; + cstr_global = nullptr; if (!RewriteObjCConstString(nsstring_global, cstr_global)) { if (log) @@ -1149,8 +1150,8 @@ return false; GlobalVariable *persistent_global = new GlobalVariable( - (*m_module), alloc->getType(), false, /* not constant */ - GlobalValue::ExternalLinkage, NULL, /* no initializer */ + (*m_module), alloc->getType(), false, /* not constant */ + GlobalValue::ExternalLinkage, nullptr, /* no initializer */ alloc->getName().str()); // What we're going to do here is make believe this was a regular old @@ -1346,13 +1347,13 @@ std::string name(named_decl->getName().str()); clang::ValueDecl *value_decl = dyn_cast(named_decl); - if (value_decl == NULL) + if (value_decl == nullptr) return false; lldb_private::CompilerType compiler_type(&value_decl->getASTContext(), value_decl->getType()); - const Type *value_type = NULL; + const Type *value_type = nullptr; if (name[0] == '$') { // The $__lldb_expr_result name indicates the return value has allocated @@ -1630,12 +1631,12 @@ } static bool isGuardVariableRef(Value *V) { - Constant *Old = NULL; + Constant *Old = nullptr; if (!(Old = dyn_cast(V))) return false; - ConstantExpr *CE = NULL; + ConstantExpr *CE = nullptr; if ((CE = dyn_cast(V))) { if (CE->getOpcode() != Instruction::BitCast) @@ -1930,8 +1931,8 @@ } for (element_index = 0; element_index < num_elements; ++element_index) { - const clang::NamedDecl *decl = NULL; - Value *value = NULL; + const clang::NamedDecl *decl = nullptr; + Value *value = nullptr; lldb::offset_t offset; lldb_private::ConstString name; @@ -2051,7 +2052,7 @@ std::string s; raw_string_ostream oss(s); - m_module->print(oss, NULL); + m_module->print(oss, nullptr); oss.flush(); @@ -2088,7 +2089,7 @@ m_reloc_placeholder = new llvm::GlobalVariable( (*m_module), int8_ty, false /* IsConstant */, GlobalVariable::InternalLinkage, Constant::getNullValue(int8_ty), - "reloc_placeholder", NULL /* InsertBefore */, + "reloc_placeholder", nullptr /* InsertBefore */, GlobalVariable::NotThreadLocal /* ThreadLocal */, 0 /* AddressSpace */); //////////////////////////////////////////////////////////// @@ -2110,7 +2111,7 @@ std::string s; raw_string_ostream oss(s); - m_module->print(oss, NULL); + m_module->print(oss, nullptr); oss.flush(); @@ -2245,7 +2246,7 @@ std::string s; raw_string_ostream oss(s); - m_module->print(oss, NULL); + m_module->print(oss, nullptr); oss.flush(); Index: source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp =================================================================== --- source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp +++ source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp @@ -749,7 +749,7 @@ } } - return NULL; + return nullptr; } bool EmulateInstructionARM::SetTargetTriple(const ArchSpec &arch) { @@ -13213,7 +13213,7 @@ (g_arm_opcodes[i].variants & arm_isa) != 0) return &g_arm_opcodes[i]; } - return NULL; + return nullptr; } EmulateInstructionARM::ARMOpcode * @@ -13763,7 +13763,7 @@ (g_thumb_opcodes[i].variants & arm_isa) != 0) return &g_thumb_opcodes[i]; } - return NULL; + return nullptr; } bool EmulateInstructionARM::SetArchitecture(const ArchSpec &arch) { @@ -14311,7 +14311,7 @@ } bool EmulateInstructionARM::EvaluateInstruction(uint32_t evaluate_options) { - ARMOpcode *opcode_data = NULL; + ARMOpcode *opcode_data = nullptr; if (m_opcode_mode == eModeThumb) opcode_data = @@ -14400,7 +14400,7 @@ OptionValueSP value_sp = test_data->GetValueForKey(opcode_key); uint32_t test_opcode; - if ((value_sp.get() == NULL) || + if ((value_sp.get() == nullptr) || (value_sp->GetType() != OptionValue::eTypeUInt64)) { out_stream->Printf("TestEmulation: Error reading opcode from test file.\n"); return false; @@ -14426,7 +14426,7 @@ EmulationStateARM after_state; value_sp = test_data->GetValueForKey(before_key); - if ((value_sp.get() == NULL) || + if ((value_sp.get() == nullptr) || (value_sp->GetType() != OptionValue::eTypeDictionary)) { out_stream->Printf("TestEmulation: Failed to find 'before' state.\n"); return false; @@ -14439,7 +14439,7 @@ } value_sp = test_data->GetValueForKey(after_key); - if ((value_sp.get() == NULL) || + if ((value_sp.get() == nullptr) || (value_sp->GetType() != OptionValue::eTypeDictionary)) { out_stream->Printf("TestEmulation: Failed to find 'after' state.\n"); return false; Index: source/Plugins/Instruction/ARM/EmulationStateARM.cpp =================================================================== --- source/Plugins/Instruction/ARM/EmulationStateARM.cpp +++ source/Plugins/Instruction/ARM/EmulationStateARM.cpp @@ -284,14 +284,14 @@ // Load memory, if present. - if (value_sp.get() != NULL) { + if (value_sp.get() != nullptr) { static ConstString address_key("address"); static ConstString data_key("data"); uint64_t start_address = 0; OptionValueDictionary *mem_dict = value_sp->GetAsDictionary(); value_sp = mem_dict->GetValueForKey(address_key); - if (value_sp.get() == NULL) + if (value_sp.get() == nullptr) return false; else start_address = value_sp->GetUInt64Value(); @@ -306,7 +306,7 @@ for (uint32_t i = 0; i < num_elts; ++i) { value_sp = mem_array->GetValueAtIndex(i); - if (value_sp.get() == NULL) + if (value_sp.get() == nullptr) return false; uint64_t value = value_sp->GetUInt64Value(); StoreToPseudoAddress(address, value); @@ -315,7 +315,7 @@ } value_sp = test_data->GetValueForKey(registers_key); - if (value_sp.get() == NULL) + if (value_sp.get() == nullptr) return false; // Load General Registers @@ -328,7 +328,7 @@ sstr.Printf("r%d", i); ConstString reg_name(sstr.GetString()); value_sp = reg_dict->GetValueForKey(reg_name); - if (value_sp.get() == NULL) + if (value_sp.get() == nullptr) return false; uint64_t reg_value = value_sp->GetUInt64Value(); StorePseudoRegisterValue(dwarf_r0 + i, reg_value); @@ -336,7 +336,7 @@ static ConstString cpsr_name("cpsr"); value_sp = reg_dict->GetValueForKey(cpsr_name); - if (value_sp.get() == NULL) + if (value_sp.get() == nullptr) return false; StorePseudoRegisterValue(dwarf_cpsr, value_sp->GetUInt64Value()); @@ -346,7 +346,7 @@ sstr.Printf("s%d", i); ConstString reg_name(sstr.GetString()); value_sp = reg_dict->GetValueForKey(reg_name); - if (value_sp.get() == NULL) + if (value_sp.get() == nullptr) return false; uint64_t reg_value = value_sp->GetUInt64Value(); StorePseudoRegisterValue(dwarf_s0 + i, reg_value); Index: source/Plugins/Instruction/ARM64/EmulateInstructionARM64.cpp =================================================================== --- source/Plugins/Instruction/ARM64/EmulateInstructionARM64.cpp +++ source/Plugins/Instruction/ARM64/EmulateInstructionARM64.cpp @@ -154,7 +154,7 @@ } } - return NULL; + return nullptr; } bool EmulateInstructionARM64::SetTargetTriple(const ArchSpec &arch) { @@ -411,7 +411,7 @@ bool EmulateInstructionARM64::EvaluateInstruction(uint32_t evaluate_options) { const uint32_t opcode = m_opcode.GetOpcode32(); Opcode *opcode_data = GetOpcodeForInstruction(opcode); - if (opcode_data == NULL) + if (opcode_data == nullptr) return false; // printf ("opcode template for 0x%8.8x: %s\n", opcode, opcode_data->name); Index: source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.cpp =================================================================== --- source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.cpp +++ source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.cpp @@ -213,7 +213,7 @@ } } - return NULL; + return nullptr; } bool EmulateInstructionMIPS::SetTargetTriple(const ArchSpec &arch) { @@ -966,7 +966,7 @@ return &g_opcodes[i]; } - return NULL; + return nullptr; } uint32_t @@ -1083,7 +1083,7 @@ */ const char *op_name = m_insn_info->getName(mc_insn.getOpcode()).data(); - if (op_name == NULL) + if (op_name == nullptr) return false; /* @@ -1092,7 +1092,7 @@ */ MipsOpcode *opcode_data = GetOpcodeForInstruction(op_name); - if (opcode_data == NULL) + if (opcode_data == nullptr) return false; uint64_t old_pc = 0, new_pc = 0; @@ -2875,7 +2875,7 @@ bool success = false, branch_hit = true; int32_t target = 0; RegisterValue reg_value; - const uint8_t *ptr = NULL; + const uint8_t *ptr = nullptr; uint32_t wt = m_reg_info->getEncodingValue(insn.getOperand(0).getReg()); int32_t offset = insn.getOperand(1).getImm(); Index: source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.cpp =================================================================== --- source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.cpp +++ source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.cpp @@ -200,7 +200,7 @@ } } - return NULL; + return nullptr; } bool EmulateInstructionMIPS64::SetTargetTriple(const ArchSpec &arch) { @@ -931,7 +931,7 @@ return &g_opcodes[i]; } - return NULL; + return nullptr; } bool EmulateInstructionMIPS64::ReadInstruction() { @@ -974,7 +974,7 @@ */ const char *op_name = m_insn_info->getName(mc_insn.getOpcode()).data(); - if (op_name == NULL) + if (op_name == nullptr) return false; /* @@ -983,7 +983,7 @@ */ MipsOpcode *opcode_data = GetOpcodeForInstruction(op_name); - if (opcode_data == NULL) + if (opcode_data == nullptr) return false; uint64_t old_pc = 0, new_pc = 0; @@ -2186,7 +2186,7 @@ bool success = false, branch_hit = true; int64_t target = 0; RegisterValue reg_value; - const uint8_t *ptr = NULL; + const uint8_t *ptr = nullptr; uint32_t wt = m_reg_info->getEncodingValue(insn.getOperand(0).getReg()); int64_t offset = insn.getOperand(1).getImm(); Index: source/Plugins/InstrumentationRuntime/ASan/ASanRuntime.cpp =================================================================== --- source/Plugins/InstrumentationRuntime/ASan/ASanRuntime.cpp +++ source/Plugins/InstrumentationRuntime/ASan/ASanRuntime.cpp @@ -287,7 +287,7 @@ const Symbol *symbol = GetRuntimeModuleSP()->FindFirstSymbolWithNameAndType( symbol_name, eSymbolTypeCode); - if (symbol == NULL) + if (symbol == nullptr) return; if (!symbol->ValueIsAddress() || !symbol->GetAddressRef().IsValid()) Index: source/Plugins/InstrumentationRuntime/TSan/TSanRuntime.cpp =================================================================== --- source/Plugins/InstrumentationRuntime/TSan/TSanRuntime.cpp +++ source/Plugins/InstrumentationRuntime/TSan/TSanRuntime.cpp @@ -900,7 +900,7 @@ const Symbol *symbol = GetRuntimeModuleSP()->FindFirstSymbolWithNameAndType( symbol_name, eSymbolTypeCode); - if (symbol == NULL) + if (symbol == nullptr) return; if (!symbol->ValueIsAddress() || !symbol->GetAddressRef().IsValid()) Index: source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp =================================================================== --- source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp +++ source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp @@ -46,7 +46,7 @@ bool ItaniumABILanguageRuntime::CouldHaveDynamicValue(ValueObject &in_value) { const bool check_cxx = true; const bool check_objc = false; - return in_value.GetCompilerType().IsPossibleDynamicType(NULL, check_cxx, + return in_value.GetCompilerType().IsPossibleDynamicType(nullptr, check_cxx, check_objc); } @@ -69,7 +69,7 @@ target.GetImages().ResolveSymbolContextForAddress( vtable_addr, eSymbolContextSymbol, sc); Symbol *symbol = sc.symbol; - if (symbol != NULL) { + if (symbol != nullptr) { const char *name = symbol->GetMangled() .GetDemangledName(lldb::eLanguageTypeC_plus_plus) @@ -306,7 +306,7 @@ } bool ItaniumABILanguageRuntime::IsVTableName(const char *name) { - if (name == NULL) + if (name == nullptr) return false; // Can we maybe ask Clang about this? @@ -326,7 +326,7 @@ language == eLanguageTypeC_plus_plus_14) return new ItaniumABILanguageRuntime(process); else - return NULL; + return nullptr; } class CommandObjectMultiwordItaniumABI_Demangle : public CommandObjectParsed { @@ -490,7 +490,7 @@ Target &target = m_process->GetTarget(); FileSpecList filter_modules; BreakpointResolverSP exception_resolver_sp = - CreateExceptionResolver(NULL, catch_bp, throw_bp, for_expressions); + CreateExceptionResolver(nullptr, catch_bp, throw_bp, for_expressions); SearchFilterSP filter_sp(CreateExceptionSearchFilter()); const bool hardware = false; const bool resolve_indirect_functions = false; Index: source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp =================================================================== --- source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp +++ source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp @@ -173,7 +173,7 @@ m_runtime.GetClassDescriptorFromISA(isa); if (!descriptor) - return NULL; + return nullptr; ConstString name(descriptor->GetClassName()); @@ -203,7 +203,7 @@ ObjCRuntimeMethodType(const char *types) : m_is_valid(false) { const char *cursor = types; enum ParserState { Start = 0, InType, InPos } state = Start; - const char *type = NULL; + const char *type = nullptr; int brace_depth = 0; uint32_t stepsLeft = 256; @@ -261,7 +261,7 @@ m_is_valid = false; return; } - type = NULL; + type = nullptr; } else { ++cursor; } @@ -319,7 +319,7 @@ bool instance, ObjCLanguageRuntime::EncodingToTypeSP type_realizer_sp) { if (!m_is_valid || m_type_vector.size() < 3) - return NULL; + return nullptr; clang::ASTContext &ast_ctx(interface_decl->getASTContext()); @@ -354,7 +354,7 @@ clang::IdentifierInfo **identifier_infos = selector_components.data(); if (!identifier_infos) { - return NULL; + return nullptr; } clang::Selector sel = ast_ctx.Selectors.getSelector( @@ -367,12 +367,13 @@ for_expression)); if (ret_type.isNull()) - return NULL; + return nullptr; clang::ObjCMethodDecl *ret = clang::ObjCMethodDecl::Create( ast_ctx, clang::SourceLocation(), clang::SourceLocation(), sel, - ret_type, NULL, interface_decl, isInstance, isVariadic, isSynthesized, - isImplicitlyDeclared, isDefined, impControl, HasRelatedResultType); + ret_type, nullptr, interface_decl, isInstance, isVariadic, + isSynthesized, isImplicitlyDeclared, isDefined, impControl, + HasRelatedResultType); std::vector parm_vars; @@ -383,12 +384,12 @@ ast_ctx, m_type_vector[ai].c_str(), for_expression)); if (arg_type.isNull()) - return NULL; // well, we just wasted a bunch of time. Wish we could - // delete the stuff we'd just made! + return nullptr; // well, we just wasted a bunch of time. Wish we could + // delete the stuff we'd just made! parm_vars.push_back(clang::ParmVarDecl::Create( - ast_ctx, ret, clang::SourceLocation(), clang::SourceLocation(), NULL, - arg_type, NULL, clang::SC_None, NULL)); + ast_ctx, ret, clang::SourceLocation(), clang::SourceLocation(), + nullptr, arg_type, nullptr, clang::SC_None, nullptr)); } ret->setMethodParams(ast_ctx, @@ -512,7 +513,7 @@ clang::SourceLocation(), &m_ast_ctx.getASTContext()->Idents.get(name), ClangUtil::GetQualType(ivar_type), type_source_info, // TypeSourceInfo * - clang::ObjCIvarDecl::Public, 0, is_synthesized); + clang::ObjCIvarDecl::Public, nullptr, is_synthesized); if (ivar_decl) { interface_decl->addDecl(ivar_decl); Index: source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp =================================================================== --- source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp +++ source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp @@ -128,9 +128,9 @@ // ret.SetContext(Value::eContextTypeClangType, return_compiler_type); ret.SetCompilerType(return_compiler_type); - if (exe_ctx.GetFramePtr() == NULL) { + if (exe_ctx.GetFramePtr() == nullptr) { Thread *thread = exe_ctx.GetThreadPtr(); - if (thread == NULL) { + if (thread == nullptr) { exe_ctx.SetThreadSP(process->GetThreadList().GetSelectedThread()); thread = exe_ctx.GetThreadPtr(); } @@ -225,7 +225,7 @@ eSymbolTypeCode, contexts)) && (!modules.FindSymbolsWithNameAndType(ConstString("_CFPrintForDebugger"), eSymbolTypeCode, contexts))) - return NULL; + return nullptr; contexts.GetContextAtIndex(0, context); @@ -237,7 +237,7 @@ bool AppleObjCRuntime::CouldHaveDynamicValue(ValueObject &in_value) { return in_value.GetCompilerType().IsPossibleDynamicType( - NULL, + nullptr, false, // do not check C++ true); // check ObjC } @@ -327,7 +327,7 @@ // reread it? m_objc_trampoline_handler_up.reset( new AppleObjCTrampolineHandler(m_process->shared_from_this(), module_sp)); - if (m_objc_trampoline_handler_up != NULL) { + if (m_objc_trampoline_handler_up != nullptr) { m_read_objc_library = true; return true; } else Index: source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp =================================================================== --- source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp +++ source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp @@ -75,9 +75,9 @@ ObjCRuntimeVersions::eAppleObjC_V1) return new AppleObjCRuntimeV1(process); else - return NULL; + return nullptr; } else - return NULL; + return nullptr; } void AppleObjCRuntimeV1::Initialize() { Index: source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp =================================================================== --- source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp +++ source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp @@ -414,8 +414,9 @@ m_encoding_to_type_sp(), m_noclasses_warning_emitted(false), m_CFBoolean_values() { static const ConstString g_gdb_object_getClass("gdb_object_getClass"); - m_has_object_getClass = (objc_module_sp->FindFirstSymbolWithNameAndType( - g_gdb_object_getClass, eSymbolTypeCode) != NULL); + m_has_object_getClass = + (objc_module_sp->FindFirstSymbolWithNameAndType( + g_gdb_object_getClass, eSymbolTypeCode) != nullptr); RegisterObjCExceptionRecognizer(); } @@ -424,7 +425,7 @@ TypeAndOrName &class_type_or_name, Address &address, Value::ValueType &value_type) { // We should never get here with a null process... - assert(m_process != NULL); + assert(m_process != nullptr); // The Runtime is attached to a particular process, you shouldn't pass in a // value from another process. Note, however, the process might be NULL (e.g. @@ -488,9 +489,9 @@ ObjCRuntimeVersions::eAppleObjC_V2) return new AppleObjCRuntimeV2(process, objc_module_sp); else - return NULL; + return nullptr; } else - return NULL; + return nullptr; } static constexpr OptionDefinition g_objc_classtable_dump_options[] = { @@ -938,7 +939,7 @@ public: RemoteNXMapTable() : m_count(0), m_num_buckets_minus_one(0), - m_buckets_ptr(LLDB_INVALID_ADDRESS), m_process(NULL), + m_buckets_ptr(LLDB_INVALID_ADDRESS), m_process(nullptr), m_end_iterator(*this, -1), m_load_addr(LLDB_INVALID_ADDRESS), m_map_pair_size(0), m_invalid_key(0) {} @@ -1273,7 +1274,7 @@ RemoteNXMapTable &hash_table) { Process *process = GetProcess(); - if (process == NULL) + if (process == nullptr) return DescriptorMapUpdateResult::Fail(); uint32_t num_class_infos = 0; @@ -1509,7 +1510,8 @@ } else { // Read the 32 bit hash for the class name const uint32_t name_hash = data.GetU32(&offset); - ClassDescriptorSP descriptor_sp(new ClassDescriptorV2(*this, isa, NULL)); + ClassDescriptorSP descriptor_sp( + new ClassDescriptorV2(*this, isa, nullptr)); // The code in g_get_shared_cache_class_info_body sets the value of the hash // to 0 to signal a demangled symbol. We use class_getName() in that code to @@ -1538,7 +1540,7 @@ AppleObjCRuntimeV2::UpdateISAToDescriptorMapSharedCache() { Process *process = GetProcess(); - if (process == NULL) + if (process == nullptr) return DescriptorMapUpdateResult::Fail(); Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_TYPES)); @@ -1752,7 +1754,7 @@ Process *process = GetProcess(); - if (process == NULL) + if (process == nullptr) return false; uint32_t num_map_table_isas = 0; @@ -2037,18 +2039,18 @@ auto objc_debug_isa_magic_mask = ExtractRuntimeGlobalSymbol( process, ConstString("objc_debug_isa_magic_mask"), objc_module_sp, error); if (error.Fail()) - return NULL; + return nullptr; auto objc_debug_isa_magic_value = ExtractRuntimeGlobalSymbol( process, ConstString("objc_debug_isa_magic_value"), objc_module_sp, error); if (error.Fail()) - return NULL; + return nullptr; auto objc_debug_isa_class_mask = ExtractRuntimeGlobalSymbol( process, ConstString("objc_debug_isa_class_mask"), objc_module_sp, error); if (error.Fail()) - return NULL; + return nullptr; if (log) log->PutCString("AOCRT::NPI: Found all the non-indexed ISA masks"); Index: source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.h =================================================================== --- source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.h +++ source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.h @@ -74,8 +74,9 @@ class VTableRegion { public: VTableRegion() - : m_valid(false), m_owner(NULL), m_header_addr(LLDB_INVALID_ADDRESS), - m_code_start_addr(0), m_code_end_addr(0), m_next_region(0) {} + : m_valid(false), m_owner(nullptr), + m_header_addr(LLDB_INVALID_ADDRESS), m_code_start_addr(0), + m_code_end_addr(0), m_next_region(0) {} VTableRegion(AppleObjCVTables *owner, lldb::addr_t header_addr); Index: source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp =================================================================== --- source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp +++ source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp @@ -470,7 +470,7 @@ const Symbol *trampoline_symbol = m_objc_module_sp->FindFirstSymbolWithNameAndType(trampoline_name, eSymbolTypeData); - if (trampoline_symbol != NULL) { + if (trampoline_symbol != nullptr) { m_trampoline_header = trampoline_symbol->GetLoadAddress(&target); if (m_trampoline_header == LLDB_INVALID_ADDRESS) return false; @@ -480,7 +480,7 @@ const Symbol *changed_symbol = m_objc_module_sp->FindFirstSymbolWithNameAndType(changed_name, eSymbolTypeCode); - if (changed_symbol != NULL) { + if (changed_symbol != nullptr) { const Address changed_symbol_addr = changed_symbol->GetAddress(); if (!changed_symbol_addr.IsValid()) return false; @@ -541,7 +541,7 @@ Status error; DataExtractor data; error = argument_values.GetValueAtIndex(0)->GetValueAsData(&exe_ctx, data, - 0, NULL); + 0, nullptr); lldb::offset_t offset = 0; lldb::addr_t region_addr = data.GetPointer(&offset); @@ -668,7 +668,7 @@ ConstString msg_forward_name("_objc_msgForward"); ConstString msg_forward_stret_name("_objc_msgForward_stret"); - Target *target = process_sp ? &process_sp->GetTarget() : NULL; + Target *target = process_sp ? &process_sp->GetTarget() : nullptr; const Symbol *class_getMethodImplementation = m_objc_module_sp->FindFirstSymbolWithNameAndType(get_impl_name, eSymbolTypeCode); @@ -771,7 +771,7 @@ // First stage is to make the ClangUtility to hold our injected function: if (!m_impl_code) { - if (m_lookup_implementation_function_code != NULL) { + if (m_lookup_implementation_function_code != nullptr) { Status error; m_impl_code.reset(exe_ctx.GetTargetRef().GetUtilityFunctionForLanguage( m_lookup_implementation_function_code, eLanguageTypeObjC, @@ -886,11 +886,11 @@ lldb::StackFrameSP thread_cur_frame = thread.GetStackFrameAtIndex(0); - const ABI *abi = NULL; + const ABI *abi = nullptr; ProcessSP process_sp(thread.CalculateProcess()); if (process_sp) abi = process_sp->GetABI().get(); - if (abi == NULL) + if (abi == nullptr) return ret_plan_sp; TargetSP target_sp(thread.CalculateTarget()); @@ -1037,7 +1037,7 @@ } ObjCLanguageRuntime *objc_runtime = thread.GetProcess()->GetObjCLanguageRuntime(); - assert(objc_runtime != NULL); + assert(objc_runtime != nullptr); impl_addr = objc_runtime->LookupInMethodCache(isa_addr, sel_addr); } Index: source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.cpp =================================================================== --- source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.cpp +++ source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.cpp @@ -36,7 +36,7 @@ eVoteNoOpinion), m_trampoline_handler(trampoline_handler), m_args_addr(LLDB_INVALID_ADDRESS), m_input_values(input_values), - m_isa_addr(isa_addr), m_sel_addr(sel_addr), m_impl_function(NULL), + m_isa_addr(isa_addr), m_sel_addr(sel_addr), m_impl_function(nullptr), m_stop_others(stop_others) {} // Destructor @@ -172,7 +172,7 @@ ObjCLanguageRuntime *objc_runtime = GetThread().GetProcess()->GetObjCLanguageRuntime(); - assert(objc_runtime != NULL); + assert(objc_runtime != nullptr); objc_runtime->AddToMethodCache(m_isa_addr, m_sel_addr, target_addr); if (log) log->Printf("Adding {isa-addr=0x%" PRIx64 ", sel-addr=0x%" PRIx64 Index: source/Plugins/MemoryHistory/asan/MemoryHistoryASan.cpp =================================================================== --- source/Plugins/MemoryHistory/asan/MemoryHistoryASan.cpp +++ source/Plugins/MemoryHistory/asan/MemoryHistoryASan.cpp @@ -30,7 +30,7 @@ MemoryHistorySP MemoryHistoryASan::CreateInstance(const ProcessSP &process_sp) { if (!process_sp.get()) - return NULL; + return nullptr; Target &target = process_sp->GetTarget(); Index: source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.h =================================================================== --- source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.h +++ source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.h @@ -125,7 +125,7 @@ const Object *GetObjectAtIndex(size_t idx) { if (idx < m_objects.size()) return &m_objects[idx]; - return NULL; + return nullptr; } size_t ParseObjects(); Index: source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp =================================================================== --- source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp +++ source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp @@ -121,7 +121,7 @@ if (ar_name_len > 0) { const void *ar_name_ptr = data.GetData(&offset, ar_name_len); // Make sure there was enough data for the string value and bail if not - if (ar_name_ptr == NULL) + if (ar_name_ptr == nullptr) return LLDB_INVALID_OFFSET; str.assign((const char *)ar_name_ptr, ar_name_len); ar_name.SetCString(str.c_str()); @@ -190,7 +190,7 @@ return &m_objects[match->value]; } } - return NULL; + return nullptr; } ObjectContainerBSDArchive::Archive::shared_ptr @@ -351,7 +351,7 @@ } } } - return NULL; + return nullptr; } bool ObjectContainerBSDArchive::MagicBytesMatch(const DataExtractor &data) { @@ -378,7 +378,7 @@ ObjectContainerBSDArchive::~ObjectContainerBSDArchive() {} bool ObjectContainerBSDArchive::ParseHeader() { - if (m_archive_sp.get() == NULL) { + if (m_archive_sp.get() == nullptr) { if (m_data.GetByteSize() > 0) { ModuleSP module_sp(GetModule()); if (module_sp) { @@ -391,7 +391,7 @@ m_data.Clear(); } } - return m_archive_sp.get() != NULL; + return m_archive_sp.get() != nullptr; } void ObjectContainerBSDArchive::Dump(Stream *s) const { Index: source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.cpp =================================================================== --- source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.cpp +++ source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.cpp @@ -57,7 +57,7 @@ } } } - return NULL; + return nullptr; } bool ObjectContainerUniversalMachO::MagicBytesMatch(const DataExtractor &data) { Index: source/Plugins/ObjectFile/ELF/ELFHeader.cpp =================================================================== --- source/Plugins/ObjectFile/ELF/ELFHeader.cpp +++ source/Plugins/ObjectFile/ELF/ELFHeader.cpp @@ -114,7 +114,7 @@ bool ELFHeader::Parse(lldb_private::DataExtractor &data, lldb::offset_t *offset) { // Read e_ident. This provides byte order and address size info. - if (data.GetU8(offset, &e_ident, EI_NIDENT) == NULL) + if (data.GetU8(offset, &e_ident, EI_NIDENT) == nullptr) return false; const unsigned byte_size = Is32Bit() ? 4 : 8; @@ -122,11 +122,11 @@ data.SetAddressByteSize(byte_size); // Read e_type and e_machine. - if (data.GetU16(offset, &e_type, 2) == NULL) + if (data.GetU16(offset, &e_type, 2) == nullptr) return false; // Read e_version. - if (data.GetU32(offset, &e_version, 1) == NULL) + if (data.GetU32(offset, &e_version, 1) == nullptr) return false; // Read e_entry, e_phoff and e_shoff. @@ -134,11 +134,11 @@ return false; // Read e_flags. - if (data.GetU32(offset, &e_flags, 1) == NULL) + if (data.GetU32(offset, &e_flags, 1) == nullptr) return false; // Read e_ehsize, e_phentsize, e_phnum, e_shentsize, e_shnum and e_shstrndx. - if (data.GetU16(offset, &e_ehsize, 6) == NULL) + if (data.GetU16(offset, &e_ehsize, 6) == nullptr) return false; // Initialize e_phnum, e_shnum, and e_shstrndx with the values read from the @@ -224,7 +224,7 @@ const unsigned byte_size = data.GetAddressByteSize(); // Read sh_name and sh_type. - if (data.GetU32(offset, &sh_name, 2) == NULL) + if (data.GetU32(offset, &sh_name, 2) == nullptr) return false; // Read sh_flags. @@ -236,7 +236,7 @@ return false; // Read sh_link and sh_info. - if (data.GetU32(offset, &sh_link, 2) == NULL) + if (data.GetU32(offset, &sh_link, 2) == nullptr) return false; // Read sh_addralign and sh_entsize. @@ -322,7 +322,7 @@ const bool parsing_32 = byte_size == 4; // Read st_name. - if (data.GetU32(offset, &st_name, 1) == NULL) + if (data.GetU32(offset, &st_name, 1) == nullptr) return false; if (parsing_32) { @@ -331,23 +331,23 @@ return false; // Read st_info and st_other. - if (data.GetU8(offset, &st_info, 2) == NULL) + if (data.GetU8(offset, &st_info, 2) == nullptr) return false; // Read st_shndx. - if (data.GetU16(offset, &st_shndx, 1) == NULL) + if (data.GetU16(offset, &st_shndx, 1) == nullptr) return false; } else { // Read st_info and st_other. - if (data.GetU8(offset, &st_info, 2) == NULL) + if (data.GetU8(offset, &st_info, 2) == nullptr) return false; // Read st_shndx. - if (data.GetU16(offset, &st_shndx, 1) == NULL) + if (data.GetU16(offset, &st_shndx, 1) == nullptr) return false; // Read st_value and st_size. - if (data.GetU64(offset, &st_value, 2) == NULL) + if (data.GetU64(offset, &st_value, 2) == nullptr) return false; } return true; @@ -365,7 +365,7 @@ const bool parsing_32 = byte_size == 4; // Read p_type; - if (data.GetU32(offset, &p_type, 1) == NULL) + if (data.GetU32(offset, &p_type, 1) == nullptr) return false; if (parsing_32) { @@ -374,7 +374,7 @@ return false; // Read p_flags. - if (data.GetU32(offset, &p_flags, 1) == NULL) + if (data.GetU32(offset, &p_flags, 1) == nullptr) return false; // Read p_align. @@ -382,7 +382,7 @@ return false; } else { // Read p_flags. - if (data.GetU32(offset, &p_flags, 1) == NULL) + if (data.GetU32(offset, &p_flags, 1) == nullptr) return false; // Read p_offset, p_vaddr, p_paddr, p_filesz, p_memsz and p_align. Index: source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp =================================================================== --- source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp +++ source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp @@ -162,7 +162,7 @@ reloc = new ELFRela(); else { assert(false && "unexpected relocation type"); - reloc = static_cast(NULL); + reloc = static_cast(nullptr); } } @@ -243,7 +243,7 @@ bool ELFNote::Parse(const DataExtractor &data, lldb::offset_t *offset) { // Read all fields. - if (data.GetU32(offset, &n_namesz, 3) == NULL) + if (data.GetU32(offset, &n_namesz, 3) == nullptr) return false; // The name field is required to be nul-terminated, and n_namesz includes the @@ -262,7 +262,7 @@ } const char *cstr = data.GetCStr(offset, llvm::alignTo(n_namesz, 4)); - if (cstr == NULL) { + if (cstr == nullptr) { Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SYMBOLS)); if (log) log->Printf("Failed to parse note name lacking nul terminator"); @@ -396,7 +396,7 @@ return objfile_up.release(); } - return NULL; + return nullptr; } ObjectFile *ObjectFileELF::CreateMemoryInstance( @@ -415,7 +415,7 @@ } } } - return NULL; + return nullptr; } bool ObjectFileELF::MagicBytesMatch(DataBufferSP &data_sp, @@ -1656,12 +1656,12 @@ const ObjectFileELF::ELFSectionHeaderInfo * ObjectFileELF::GetSectionHeaderByIndex(lldb::user_id_t id) { if (!ParseSectionHeaders()) - return NULL; + return nullptr; if (id < m_section_headers.size()) return &m_section_headers[id]; - return NULL; + return nullptr; } lldb::user_id_t ObjectFileELF::GetSectionIndexByName(const char *name) { @@ -2376,7 +2376,7 @@ const ELFDynamic *ObjectFileELF::FindDynamicSymbol(unsigned tag) { if (!ParseDynamicSymbols()) - return NULL; + return nullptr; DynamicSymbolCollIter I = m_dynamic_symbols.begin(); DynamicSymbolCollIter E = m_dynamic_symbols.end(); @@ -2387,7 +2387,7 @@ return symbol; } - return NULL; + return nullptr; } unsigned ObjectFileELF::PLTRelocationType() { @@ -2604,7 +2604,7 @@ if (!rel.Parse(rel_data, &offset)) break; - Symbol *symbol = NULL; + Symbol *symbol = nullptr; if (hdr->Is32Bit()) { switch (reloc_type(rel)) { @@ -2723,7 +2723,7 @@ Symtab *ObjectFileELF::GetSymtab() { ModuleSP module_sp(GetModule()); if (!module_sp) - return NULL; + return nullptr; // We always want to use the main object file so we (hopefully) only have one // cached copy of our symtab, dynamic sections, etc. @@ -2731,10 +2731,10 @@ if (module_obj_file && module_obj_file != this) return module_obj_file->GetSymtab(); - if (m_symtab_up == NULL) { + if (m_symtab_up == nullptr) { SectionList *section_list = module_sp->GetSectionList(); if (!section_list) - return NULL; + return nullptr; uint64_t symbol_id = 0; std::lock_guard guard(module_sp->GetMutex()); @@ -2934,10 +2934,10 @@ s->EOL(); SectionList *section_list = GetSectionList(); if (section_list) - section_list->Dump(s, NULL, true, UINT32_MAX); + section_list->Dump(s, nullptr, true, UINT32_MAX); Symtab *symtab = GetSymtab(); if (symtab) - symtab->Dump(s, NULL, eSortOrderNone); + symtab->Dump(s, nullptr, eSortOrderNone); s->EOL(); DumpDependentModules(s); s->EOL(); Index: source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp =================================================================== --- source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp +++ source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp @@ -66,7 +66,7 @@ lldb::offset_t length) { // JIT'ed object file is backed by the ObjectFileJITDelegate, never read from // a file - return NULL; + return nullptr; } ObjectFile *ObjectFileJIT::CreateMemoryInstance(const lldb::ModuleSP &module_sp, @@ -75,7 +75,7 @@ lldb::addr_t header_addr) { // JIT'ed object file is backed by the ObjectFileJITDelegate, never read from // memory - return NULL; + return nullptr; } size_t ObjectFileJIT::GetModuleSpecifications( @@ -88,7 +88,7 @@ ObjectFileJIT::ObjectFileJIT(const lldb::ModuleSP &module_sp, const ObjectFileJITDelegateSP &delegate_sp) - : ObjectFile(module_sp, NULL, 0, 0, DataBufferSP(), 0), m_delegate_wp() { + : ObjectFile(module_sp, nullptr, 0, 0, DataBufferSP(), 0), m_delegate_wp() { if (delegate_sp) { m_delegate_wp = delegate_sp; m_data.SetByteOrder(delegate_sp->GetByteOrder()); @@ -115,7 +115,7 @@ ModuleSP module_sp(GetModule()); if (module_sp) { std::lock_guard guard(module_sp->GetMutex()); - if (m_symtab_up == NULL) { + if (m_symtab_up == nullptr) { m_symtab_up.reset(new Symtab(this)); std::lock_guard symtab_guard( m_symtab_up->GetMutex()); @@ -159,10 +159,10 @@ SectionList *sections = GetSectionList(); if (sections) - sections->Dump(s, NULL, true, UINT32_MAX); + sections->Dump(s, nullptr, true, UINT32_MAX); if (m_symtab_up) - m_symtab_up->Dump(s, NULL, eSortOrderNone); + m_symtab_up->Dump(s, nullptr, eSortOrderNone); } } Index: source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp =================================================================== --- source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp +++ source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp @@ -173,7 +173,7 @@ const char *alt_name, size_t reg_byte_size, Stream &data) { const RegisterInfo *reg_info = reg_ctx->GetRegisterInfoByName(name); - if (reg_info == NULL) + if (reg_info == nullptr) reg_info = reg_ctx->GetRegisterInfoByName(alt_name); if (reg_info) { lldb_private::RegisterValue reg_value; @@ -202,27 +202,27 @@ data.PutHex32(GPRRegSet); // Flavor data.PutHex32(GPRWordCount); - WriteRegister(reg_ctx, "rax", NULL, 8, data); - WriteRegister(reg_ctx, "rbx", NULL, 8, data); - WriteRegister(reg_ctx, "rcx", NULL, 8, data); - WriteRegister(reg_ctx, "rdx", NULL, 8, data); - WriteRegister(reg_ctx, "rdi", NULL, 8, data); - WriteRegister(reg_ctx, "rsi", NULL, 8, data); - WriteRegister(reg_ctx, "rbp", NULL, 8, data); - WriteRegister(reg_ctx, "rsp", NULL, 8, data); - WriteRegister(reg_ctx, "r8", NULL, 8, data); - WriteRegister(reg_ctx, "r9", NULL, 8, data); - WriteRegister(reg_ctx, "r10", NULL, 8, data); - WriteRegister(reg_ctx, "r11", NULL, 8, data); - WriteRegister(reg_ctx, "r12", NULL, 8, data); - WriteRegister(reg_ctx, "r13", NULL, 8, data); - WriteRegister(reg_ctx, "r14", NULL, 8, data); - WriteRegister(reg_ctx, "r15", NULL, 8, data); - WriteRegister(reg_ctx, "rip", NULL, 8, data); - WriteRegister(reg_ctx, "rflags", NULL, 8, data); - WriteRegister(reg_ctx, "cs", NULL, 8, data); - WriteRegister(reg_ctx, "fs", NULL, 8, data); - WriteRegister(reg_ctx, "gs", NULL, 8, data); + WriteRegister(reg_ctx, "rax", nullptr, 8, data); + WriteRegister(reg_ctx, "rbx", nullptr, 8, data); + WriteRegister(reg_ctx, "rcx", nullptr, 8, data); + WriteRegister(reg_ctx, "rdx", nullptr, 8, data); + WriteRegister(reg_ctx, "rdi", nullptr, 8, data); + WriteRegister(reg_ctx, "rsi", nullptr, 8, data); + WriteRegister(reg_ctx, "rbp", nullptr, 8, data); + WriteRegister(reg_ctx, "rsp", nullptr, 8, data); + WriteRegister(reg_ctx, "r8", nullptr, 8, data); + WriteRegister(reg_ctx, "r9", nullptr, 8, data); + WriteRegister(reg_ctx, "r10", nullptr, 8, data); + WriteRegister(reg_ctx, "r11", nullptr, 8, data); + WriteRegister(reg_ctx, "r12", nullptr, 8, data); + WriteRegister(reg_ctx, "r13", nullptr, 8, data); + WriteRegister(reg_ctx, "r14", nullptr, 8, data); + WriteRegister(reg_ctx, "r15", nullptr, 8, data); + WriteRegister(reg_ctx, "rip", nullptr, 8, data); + WriteRegister(reg_ctx, "rflags", nullptr, 8, data); + WriteRegister(reg_ctx, "cs", nullptr, 8, data); + WriteRegister(reg_ctx, "fs", nullptr, 8, data); + WriteRegister(reg_ctx, "gs", nullptr, 8, data); // // Write out the FPU registers // const size_t fpu_byte_size = sizeof(FPU); @@ -311,9 +311,9 @@ // Write out the EXC registers data.PutHex32(EXCRegSet); data.PutHex32(EXCWordCount); - WriteRegister(reg_ctx, "trapno", NULL, 4, data); - WriteRegister(reg_ctx, "err", NULL, 4, data); - WriteRegister(reg_ctx, "faultvaddr", NULL, 8, data); + WriteRegister(reg_ctx, "trapno", nullptr, 4, data); + WriteRegister(reg_ctx, "err", nullptr, 4, data); + WriteRegister(reg_ctx, "faultvaddr", nullptr, 8, data); return true; } return false; @@ -404,7 +404,7 @@ const char *alt_name, size_t reg_byte_size, Stream &data) { const RegisterInfo *reg_info = reg_ctx->GetRegisterInfoByName(name); - if (reg_info == NULL) + if (reg_info == nullptr) reg_info = reg_ctx->GetRegisterInfoByName(alt_name); if (reg_info) { lldb_private::RegisterValue reg_value; @@ -433,29 +433,29 @@ data.PutHex32(GPRRegSet); // Flavor data.PutHex32(GPRWordCount); - WriteRegister(reg_ctx, "eax", NULL, 4, data); - WriteRegister(reg_ctx, "ebx", NULL, 4, data); - WriteRegister(reg_ctx, "ecx", NULL, 4, data); - WriteRegister(reg_ctx, "edx", NULL, 4, data); - WriteRegister(reg_ctx, "edi", NULL, 4, data); - WriteRegister(reg_ctx, "esi", NULL, 4, data); - WriteRegister(reg_ctx, "ebp", NULL, 4, data); - WriteRegister(reg_ctx, "esp", NULL, 4, data); - WriteRegister(reg_ctx, "ss", NULL, 4, data); - WriteRegister(reg_ctx, "eflags", NULL, 4, data); - WriteRegister(reg_ctx, "eip", NULL, 4, data); - WriteRegister(reg_ctx, "cs", NULL, 4, data); - WriteRegister(reg_ctx, "ds", NULL, 4, data); - WriteRegister(reg_ctx, "es", NULL, 4, data); - WriteRegister(reg_ctx, "fs", NULL, 4, data); - WriteRegister(reg_ctx, "gs", NULL, 4, data); + WriteRegister(reg_ctx, "eax", nullptr, 4, data); + WriteRegister(reg_ctx, "ebx", nullptr, 4, data); + WriteRegister(reg_ctx, "ecx", nullptr, 4, data); + WriteRegister(reg_ctx, "edx", nullptr, 4, data); + WriteRegister(reg_ctx, "edi", nullptr, 4, data); + WriteRegister(reg_ctx, "esi", nullptr, 4, data); + WriteRegister(reg_ctx, "ebp", nullptr, 4, data); + WriteRegister(reg_ctx, "esp", nullptr, 4, data); + WriteRegister(reg_ctx, "ss", nullptr, 4, data); + WriteRegister(reg_ctx, "eflags", nullptr, 4, data); + WriteRegister(reg_ctx, "eip", nullptr, 4, data); + WriteRegister(reg_ctx, "cs", nullptr, 4, data); + WriteRegister(reg_ctx, "ds", nullptr, 4, data); + WriteRegister(reg_ctx, "es", nullptr, 4, data); + WriteRegister(reg_ctx, "fs", nullptr, 4, data); + WriteRegister(reg_ctx, "gs", nullptr, 4, data); // Write out the EXC registers data.PutHex32(EXCRegSet); data.PutHex32(EXCWordCount); - WriteRegister(reg_ctx, "trapno", NULL, 4, data); - WriteRegister(reg_ctx, "err", NULL, 4, data); - WriteRegister(reg_ctx, "faultvaddr", NULL, 4, data); + WriteRegister(reg_ctx, "trapno", nullptr, 4, data); + WriteRegister(reg_ctx, "err", nullptr, 4, data); + WriteRegister(reg_ctx, "faultvaddr", nullptr, 4, data); return true; } return false; @@ -555,7 +555,7 @@ const char *alt_name, size_t reg_byte_size, Stream &data) { const RegisterInfo *reg_info = reg_ctx->GetRegisterInfoByName(name); - if (reg_info == NULL) + if (reg_info == nullptr) reg_info = reg_ctx->GetRegisterInfoByName(alt_name); if (reg_info) { lldb_private::RegisterValue reg_value; @@ -584,23 +584,23 @@ data.PutHex32(GPRRegSet); // Flavor data.PutHex32(GPRWordCount); - WriteRegister(reg_ctx, "r0", NULL, 4, data); - WriteRegister(reg_ctx, "r1", NULL, 4, data); - WriteRegister(reg_ctx, "r2", NULL, 4, data); - WriteRegister(reg_ctx, "r3", NULL, 4, data); - WriteRegister(reg_ctx, "r4", NULL, 4, data); - WriteRegister(reg_ctx, "r5", NULL, 4, data); - WriteRegister(reg_ctx, "r6", NULL, 4, data); - WriteRegister(reg_ctx, "r7", NULL, 4, data); - WriteRegister(reg_ctx, "r8", NULL, 4, data); - WriteRegister(reg_ctx, "r9", NULL, 4, data); - WriteRegister(reg_ctx, "r10", NULL, 4, data); - WriteRegister(reg_ctx, "r11", NULL, 4, data); - WriteRegister(reg_ctx, "r12", NULL, 4, data); - WriteRegister(reg_ctx, "sp", NULL, 4, data); - WriteRegister(reg_ctx, "lr", NULL, 4, data); - WriteRegister(reg_ctx, "pc", NULL, 4, data); - WriteRegister(reg_ctx, "cpsr", NULL, 4, data); + WriteRegister(reg_ctx, "r0", nullptr, 4, data); + WriteRegister(reg_ctx, "r1", nullptr, 4, data); + WriteRegister(reg_ctx, "r2", nullptr, 4, data); + WriteRegister(reg_ctx, "r3", nullptr, 4, data); + WriteRegister(reg_ctx, "r4", nullptr, 4, data); + WriteRegister(reg_ctx, "r5", nullptr, 4, data); + WriteRegister(reg_ctx, "r6", nullptr, 4, data); + WriteRegister(reg_ctx, "r7", nullptr, 4, data); + WriteRegister(reg_ctx, "r8", nullptr, 4, data); + WriteRegister(reg_ctx, "r9", nullptr, 4, data); + WriteRegister(reg_ctx, "r10", nullptr, 4, data); + WriteRegister(reg_ctx, "r11", nullptr, 4, data); + WriteRegister(reg_ctx, "r12", nullptr, 4, data); + WriteRegister(reg_ctx, "sp", nullptr, 4, data); + WriteRegister(reg_ctx, "lr", nullptr, 4, data); + WriteRegister(reg_ctx, "pc", nullptr, 4, data); + WriteRegister(reg_ctx, "cpsr", nullptr, 4, data); // Write out the EXC registers // data.PutHex32 (EXCRegSet); @@ -710,7 +710,7 @@ const char *alt_name, size_t reg_byte_size, Stream &data) { const RegisterInfo *reg_info = reg_ctx->GetRegisterInfoByName(name); - if (reg_info == NULL) + if (reg_info == nullptr) reg_info = reg_ctx->GetRegisterInfoByName(alt_name); if (reg_info) { lldb_private::RegisterValue reg_value; @@ -739,40 +739,40 @@ data.PutHex32(GPRRegSet); // Flavor data.PutHex32(GPRWordCount); - WriteRegister(reg_ctx, "x0", NULL, 8, data); - WriteRegister(reg_ctx, "x1", NULL, 8, data); - WriteRegister(reg_ctx, "x2", NULL, 8, data); - WriteRegister(reg_ctx, "x3", NULL, 8, data); - WriteRegister(reg_ctx, "x4", NULL, 8, data); - WriteRegister(reg_ctx, "x5", NULL, 8, data); - WriteRegister(reg_ctx, "x6", NULL, 8, data); - WriteRegister(reg_ctx, "x7", NULL, 8, data); - WriteRegister(reg_ctx, "x8", NULL, 8, data); - WriteRegister(reg_ctx, "x9", NULL, 8, data); - WriteRegister(reg_ctx, "x10", NULL, 8, data); - WriteRegister(reg_ctx, "x11", NULL, 8, data); - WriteRegister(reg_ctx, "x12", NULL, 8, data); - WriteRegister(reg_ctx, "x13", NULL, 8, data); - WriteRegister(reg_ctx, "x14", NULL, 8, data); - WriteRegister(reg_ctx, "x15", NULL, 8, data); - WriteRegister(reg_ctx, "x16", NULL, 8, data); - WriteRegister(reg_ctx, "x17", NULL, 8, data); - WriteRegister(reg_ctx, "x18", NULL, 8, data); - WriteRegister(reg_ctx, "x19", NULL, 8, data); - WriteRegister(reg_ctx, "x20", NULL, 8, data); - WriteRegister(reg_ctx, "x21", NULL, 8, data); - WriteRegister(reg_ctx, "x22", NULL, 8, data); - WriteRegister(reg_ctx, "x23", NULL, 8, data); - WriteRegister(reg_ctx, "x24", NULL, 8, data); - WriteRegister(reg_ctx, "x25", NULL, 8, data); - WriteRegister(reg_ctx, "x26", NULL, 8, data); - WriteRegister(reg_ctx, "x27", NULL, 8, data); - WriteRegister(reg_ctx, "x28", NULL, 8, data); - WriteRegister(reg_ctx, "fp", NULL, 8, data); - WriteRegister(reg_ctx, "lr", NULL, 8, data); - WriteRegister(reg_ctx, "sp", NULL, 8, data); - WriteRegister(reg_ctx, "pc", NULL, 8, data); - WriteRegister(reg_ctx, "cpsr", NULL, 4, data); + WriteRegister(reg_ctx, "x0", nullptr, 8, data); + WriteRegister(reg_ctx, "x1", nullptr, 8, data); + WriteRegister(reg_ctx, "x2", nullptr, 8, data); + WriteRegister(reg_ctx, "x3", nullptr, 8, data); + WriteRegister(reg_ctx, "x4", nullptr, 8, data); + WriteRegister(reg_ctx, "x5", nullptr, 8, data); + WriteRegister(reg_ctx, "x6", nullptr, 8, data); + WriteRegister(reg_ctx, "x7", nullptr, 8, data); + WriteRegister(reg_ctx, "x8", nullptr, 8, data); + WriteRegister(reg_ctx, "x9", nullptr, 8, data); + WriteRegister(reg_ctx, "x10", nullptr, 8, data); + WriteRegister(reg_ctx, "x11", nullptr, 8, data); + WriteRegister(reg_ctx, "x12", nullptr, 8, data); + WriteRegister(reg_ctx, "x13", nullptr, 8, data); + WriteRegister(reg_ctx, "x14", nullptr, 8, data); + WriteRegister(reg_ctx, "x15", nullptr, 8, data); + WriteRegister(reg_ctx, "x16", nullptr, 8, data); + WriteRegister(reg_ctx, "x17", nullptr, 8, data); + WriteRegister(reg_ctx, "x18", nullptr, 8, data); + WriteRegister(reg_ctx, "x19", nullptr, 8, data); + WriteRegister(reg_ctx, "x20", nullptr, 8, data); + WriteRegister(reg_ctx, "x21", nullptr, 8, data); + WriteRegister(reg_ctx, "x22", nullptr, 8, data); + WriteRegister(reg_ctx, "x23", nullptr, 8, data); + WriteRegister(reg_ctx, "x24", nullptr, 8, data); + WriteRegister(reg_ctx, "x25", nullptr, 8, data); + WriteRegister(reg_ctx, "x26", nullptr, 8, data); + WriteRegister(reg_ctx, "x27", nullptr, 8, data); + WriteRegister(reg_ctx, "x28", nullptr, 8, data); + WriteRegister(reg_ctx, "fp", nullptr, 8, data); + WriteRegister(reg_ctx, "lr", nullptr, 8, data); + WriteRegister(reg_ctx, "sp", nullptr, 8, data); + WriteRegister(reg_ctx, "pc", nullptr, 8, data); + WriteRegister(reg_ctx, "cpsr", nullptr, 4, data); // Write out the EXC registers // data.PutHex32 (EXCRegSet); @@ -889,7 +889,7 @@ if (objfile_up.get() && objfile_up->ParseHeader()) return objfile_up.release(); } - return NULL; + return nullptr; } size_t ObjectFileMachO::GetModuleSpecifications( @@ -1312,7 +1312,7 @@ ModuleSP module_sp(GetModule()); if (module_sp) { std::lock_guard guard(module_sp->GetMutex()); - if (m_symtab_up == NULL) { + if (m_symtab_up == nullptr) { m_symtab_up.reset(new Symtab(this)); std::lock_guard symtab_guard( m_symtab_up->GetMutex()); @@ -1332,14 +1332,14 @@ const lldb::offset_t load_cmd_offset = offset; load_command lc; - if (m_data.GetU32(&offset, &lc.cmd, 2) == NULL) + if (m_data.GetU32(&offset, &lc.cmd, 2) == nullptr) break; if (lc.cmd == LC_DYSYMTAB) { m_dysymtab.cmd = lc.cmd; m_dysymtab.cmdsize = lc.cmdsize; if (m_data.GetU32(&offset, &m_dysymtab.ilocalsym, (sizeof(m_dysymtab) / sizeof(uint32_t)) - 2) == - NULL) { + nullptr) { // Clear m_dysymtab if we were unable to read all items from the // load command ::memset(&m_dysymtab, 0, sizeof(m_dysymtab)); @@ -1361,7 +1361,7 @@ encryption_info_command encryption_cmd; for (uint32_t i = 0; i < m_header.ncmds; ++i) { const lldb::offset_t load_cmd_offset = offset; - if (m_data.GetU32(&offset, &encryption_cmd, 2) == NULL) + if (m_data.GetU32(&offset, &encryption_cmd, 2) == nullptr) break; // LC_ENCRYPTION_INFO and LC_ENCRYPTION_INFO_64 have the same sizes for the @@ -1713,15 +1713,15 @@ for (segment_sect_idx = 0; segment_sect_idx < load_cmd.nsects; ++segment_sect_idx) { if (m_data.GetU8(&offset, (uint8_t *)sect64.sectname, - sizeof(sect64.sectname)) == NULL) + sizeof(sect64.sectname)) == nullptr) break; if (m_data.GetU8(&offset, (uint8_t *)sect64.segname, - sizeof(sect64.segname)) == NULL) + sizeof(sect64.segname)) == nullptr) break; sect64.addr = m_data.GetAddress(&offset); sect64.size = m_data.GetAddress(&offset); - if (m_data.GetU32(&offset, §64.offset, num_u32s) == NULL) + if (m_data.GetU32(&offset, §64.offset, num_u32s) == nullptr) break; // Keep a list of mach sections around in case we need to get at data that @@ -1830,7 +1830,7 @@ bool section_is_encrypted = false; if (!segment_is_encrypted && load_cmd.filesize != 0) section_is_encrypted = context.EncryptedRanges.FindEntryThatContains( - sect64.offset) != NULL; + sect64.offset) != nullptr; section_sp->SetIsEncrypted(segment_is_encrypted || section_is_encrypted); section_sp->SetPermissions(segment_permissions); @@ -1856,7 +1856,7 @@ if (curr_section_sp.get()) { if (curr_section_sp->GetByteSize() == 0) { - if (next_section_sp.get() != NULL) + if (next_section_sp.get() != nullptr) curr_section_sp->SetByteSize(next_section_sp->GetFileAddress() - curr_section_sp->GetFileAddress()); else @@ -1892,7 +1892,7 @@ struct load_command load_cmd; for (uint32_t i = 0; i < m_header.ncmds; ++i) { const lldb::offset_t load_cmd_offset = offset; - if (m_data.GetU32(&offset, &load_cmd, 2) == NULL) + if (m_data.GetU32(&offset, &load_cmd, 2) == nullptr) break; if (load_cmd.cmd == LC_SEGMENT || load_cmd.cmd == LC_SEGMENT_64) @@ -2021,7 +2021,7 @@ if (terminalSize != 0) { TrieEntryWithOffset e(offset); e.entry.flags = data.GetULEB128(&offset); - const char *import_name = NULL; + const char *import_name = nullptr; if (e.entry.flags & EXPORT_SYMBOL_FLAGS_REEXPORT) { e.entry.address = 0; e.entry.other = data.GetULEB128(&offset); // dylib ordinal @@ -2129,7 +2129,7 @@ const lldb::offset_t cmd_offset = offset; // Read in the load command and load command size struct load_command lc; - if (m_data.GetU32(&offset, &lc, 2) == NULL) + if (m_data.GetU32(&offset, &lc, 2) == nullptr) break; // Watch for the symbol table load command switch (lc.cmd) { @@ -2138,7 +2138,7 @@ symtab_load_command.cmdsize = lc.cmdsize; // Read in the rest of the symtab load command if (m_data.GetU32(&offset, &symtab_load_command.symoff, 4) == - 0) // fill in symoff, nsyms, stroff, strsize fields + nullptr) // fill in symoff, nsyms, stroff, strsize fields return 0; if (symtab_load_command.symoff == 0) { if (log) @@ -2201,7 +2201,7 @@ function_starts_load_command.cmd = lc.cmd; function_starts_load_command.cmdsize = lc.cmdsize; if (m_data.GetU32(&offset, &function_starts_load_command.dataoff, 2) == - NULL) // fill in symoff, nsyms, stroff, strsize fields + nullptr) // fill in symoff, nsyms, stroff, strsize fields memset(&function_starts_load_command, 0, sizeof(function_starts_load_command)); break; @@ -2215,7 +2215,7 @@ if (symtab_load_command.cmd) { Symtab *symtab = m_symtab_up.get(); SectionList *section_list = GetSectionList(); - if (section_list == NULL) + if (section_list == nullptr) return 0; const uint32_t addr_byte_size = m_data.GetAddressByteSize(); @@ -2224,12 +2224,12 @@ const size_t nlist_byte_size = bit_width_32 ? sizeof(struct nlist) : sizeof(struct nlist_64); - DataExtractor nlist_data(NULL, 0, byte_order, addr_byte_size); - DataExtractor strtab_data(NULL, 0, byte_order, addr_byte_size); - DataExtractor function_starts_data(NULL, 0, byte_order, addr_byte_size); - DataExtractor indirect_symbol_index_data(NULL, 0, byte_order, + DataExtractor nlist_data(nullptr, 0, byte_order, addr_byte_size); + DataExtractor strtab_data(nullptr, 0, byte_order, addr_byte_size); + DataExtractor function_starts_data(nullptr, 0, byte_order, addr_byte_size); + DataExtractor indirect_symbol_index_data(nullptr, 0, byte_order, addr_byte_size); - DataExtractor dyld_trie_data(NULL, 0, byte_order, addr_byte_size); + DataExtractor dyld_trie_data(nullptr, 0, byte_order, addr_byte_size); const addr_t nlist_data_byte_size = symtab_load_command.nsyms * nlist_byte_size; @@ -2550,10 +2550,10 @@ // so we know NListIndexToSymbolIndexMap m_nlist_idx_to_sym_idx; uint32_t nlist_idx = 0; - Symbol *symbol_ptr = NULL; + Symbol *symbol_ptr = nullptr; uint32_t sym_idx = 0; - Symbol *sym = NULL; + Symbol *sym = nullptr; size_t num_syms = 0; std::string memory_symbol_name; uint32_t unmapped_local_symbols_found = 0; @@ -3749,7 +3749,7 @@ // If the sym array was not created while parsing the DSC unmapped // symbols, create it now. - if (sym == NULL) { + if (sym == nullptr) { sym = symtab->Resize(symtab_load_command.nsyms + m_dysymtab.nindirectsyms); num_syms = symtab->GetNumSymbols(); @@ -3780,12 +3780,12 @@ nlist.n_value = nlist_data.GetAddress_unchecked(&nlist_data_offset); SymbolType type = eSymbolTypeInvalid; - const char *symbol_name = NULL; + const char *symbol_name = nullptr; if (have_strtab_data) { symbol_name = strtab_data.PeekCStr(nlist.n_strx); - if (symbol_name == NULL) { + if (symbol_name == nullptr) { // No symbol should be NULL, even the symbols with no string values // should have an offset zero which points to an empty C-string Host::SystemLog(Host::eSystemLogError, @@ -3796,7 +3796,7 @@ continue; } if (symbol_name[0] == '\0') - symbol_name = NULL; + symbol_name = nullptr; } else { const addr_t str_addr = strtab_addr + nlist.n_strx; Status str_error; @@ -3804,7 +3804,7 @@ str_error)) symbol_name = memory_symbol_name.c_str(); } - const char *symbol_name_non_abi_mangled = NULL; + const char *symbol_name_non_abi_mangled = nullptr; SectionSP symbol_section; lldb::addr_t symbol_byte_size = 0; @@ -3957,7 +3957,7 @@ case N_SO: // source file name type = eSymbolTypeSourceFile; - if (symbol_name == NULL) { + if (symbol_name == nullptr) { add_nlist = false; if (N_SO_index != UINT32_MAX) { // Set the size of the N_SO to the terminating index of this @@ -4426,7 +4426,7 @@ if (func_start_entry->addr != symbol_lookup_file_addr && func_start_entry->addr != (symbol_lookup_file_addr + 1)) { // Not the right entry, NULL it out... - func_start_entry = NULL; + func_start_entry = nullptr; } } if (func_start_entry) { @@ -4710,7 +4710,7 @@ NListIndexToSymbolIndexMap::const_iterator index_pos = m_nlist_idx_to_sym_idx.find(stub_sym_id); - Symbol *stub_symbol = NULL; + Symbol *stub_symbol = nullptr; if (index_pos != end_index_pos) { // We have a remapping from the original nlist index to a // current symbol index, so just look this up by index @@ -4742,7 +4742,7 @@ Mangled stub_symbol_mangled_name(stub_symbol->GetMangled()); if (sym_idx >= num_syms) { sym = symtab->Resize(++num_syms); - stub_symbol = NULL; // this pointer no longer valid + stub_symbol = nullptr; // this pointer no longer valid } sym[sym_idx].SetID(synthetic_sym_id++); sym[sym_idx].GetMangled() = stub_symbol_mangled_name; @@ -4828,10 +4828,10 @@ SectionList *sections = GetSectionList(); if (sections) - sections->Dump(s, NULL, true, UINT32_MAX); + sections->Dump(s, nullptr, true, UINT32_MAX); if (m_symtab_up) - m_symtab_up->Dump(s, NULL, eSortOrderNone); + m_symtab_up->Dump(s, nullptr, eSortOrderNone); } } @@ -4844,7 +4844,7 @@ lldb::offset_t offset = lc_offset; for (i = 0; i < header.ncmds; ++i) { const lldb::offset_t cmd_offset = offset; - if (data.GetU32(&offset, &load_cmd, 2) == NULL) + if (data.GetU32(&offset, &load_cmd, 2) == nullptr) break; if (load_cmd.cmd == LC_UUID) { @@ -4982,7 +4982,7 @@ lldb::offset_t offset = lc_offset; for (uint32_t i = 0; i < header.ncmds; ++i) { const lldb::offset_t cmd_offset = offset; - if (data.GetU32(&offset, &load_cmd, 2) == NULL) + if (data.GetU32(&offset, &load_cmd, 2) == nullptr) break; struct version_min_command version_min; @@ -5015,7 +5015,7 @@ offset = lc_offset; for (uint32_t i = 0; i < header.ncmds; ++i) { const lldb::offset_t cmd_offset = offset; - if (data.GetU32(&offset, &load_cmd, 2) == NULL) + if (data.GetU32(&offset, &load_cmd, 2) == nullptr) break; do { if (load_cmd.cmd == llvm::MachO::LC_BUILD_VERSION) { @@ -5077,7 +5077,7 @@ uint32_t i; for (i = 0; i < m_header.ncmds; ++i) { const uint32_t cmd_offset = offset; - if (m_data.GetU32(&offset, &load_cmd, 2) == NULL) + if (m_data.GetU32(&offset, &load_cmd, 2) == nullptr) break; switch (load_cmd.cmd) { @@ -5211,7 +5211,7 @@ for (i = 0; i < m_header.ncmds; ++i) { const lldb::offset_t cmd_offset = offset; - if (m_data.GetU32(&offset, &load_cmd, 2) == NULL) + if (m_data.GetU32(&offset, &load_cmd, 2) == nullptr) break; switch (load_cmd.cmd) { @@ -5350,7 +5350,7 @@ thread_command thread_cmd; for (uint32_t i = 0; i < m_header.ncmds; ++i) { const uint32_t cmd_offset = offset; - if (m_data.GetU32(&offset, &thread_cmd, 2) == NULL) + if (m_data.GetU32(&offset, &thread_cmd, 2) == nullptr) break; if (thread_cmd.cmd == LC_THREAD) { @@ -5377,8 +5377,8 @@ for (uint32_t i = 0; i < m_header.ncmds; ++i) { const uint32_t cmd_offset = offset; load_command lc; - if (m_data.GetU32(&offset, &lc.cmd, 2) == NULL) - break; + if (m_data.GetU32(&offset, &lc.cmd, 2) == nullptr) + break; if (lc.cmd == LC_NOTE) { char data_owner[17]; @@ -5422,7 +5422,7 @@ for (uint32_t i = 0; i < m_header.ncmds; ++i) { const uint32_t cmd_offset = offset; struct ident_command ident_command; - if (m_data.GetU32(&offset, &ident_command, 2) == NULL) + if (m_data.GetU32(&offset, &ident_command, 2) == nullptr) break; if (ident_command.cmd == LC_IDENT && ident_command.cmdsize != 0) { char *buf = (char *) malloc (ident_command.cmdsize); @@ -5451,8 +5451,8 @@ for (uint32_t i = 0; i < m_header.ncmds; ++i) { const uint32_t cmd_offset = offset; load_command lc; - if (m_data.GetU32(&offset, &lc.cmd, 2) == NULL) - break; + if (m_data.GetU32(&offset, &lc.cmd, 2) == nullptr) + break; if (lc.cmd == LC_NOTE) { char data_owner[17]; @@ -5649,13 +5649,13 @@ uint32_t i; for (i = 0; i < m_header.ncmds; ++i) { const lldb::offset_t cmd_offset = offset; - if (m_data.GetU32(&offset, &load_cmd, 2) == NULL) + if (m_data.GetU32(&offset, &load_cmd, 2) == nullptr) break; if (load_cmd.cmd == LC_ID_DYLIB) { if (version_cmd == 0) { version_cmd = load_cmd.cmd; - if (m_data.GetU32(&offset, &load_cmd.dylib, 4) == NULL) + if (m_data.GetU32(&offset, &load_cmd.dylib, 4) == nullptr) break; version = load_cmd.dylib.current_version; } @@ -5795,7 +5795,7 @@ const lldb::offset_t load_cmd_offset = offset; version_min_command lc; - if (m_data.GetU32(&offset, &lc.cmd, 2) == NULL) + if (m_data.GetU32(&offset, &lc.cmd, 2) == nullptr) break; if (lc.cmd == llvm::MachO::LC_VERSION_MIN_MACOSX || lc.cmd == llvm::MachO::LC_VERSION_MIN_IPHONEOS || @@ -5855,7 +5855,7 @@ const lldb::offset_t load_cmd_offset = offset; version_min_command lc; - if (m_data.GetU32(&offset, &lc.cmd, 2) == NULL) + if (m_data.GetU32(&offset, &lc.cmd, 2) == nullptr) break; if (lc.cmd == llvm::MachO::LC_VERSION_MIN_MACOSX || lc.cmd == llvm::MachO::LC_VERSION_MIN_IPHONEOS || @@ -5886,7 +5886,7 @@ const lldb::offset_t load_cmd_offset = offset; version_min_command lc; - if (m_data.GetU32(&offset, &lc.cmd, 2) == NULL) + if (m_data.GetU32(&offset, &lc.cmd, 2) == nullptr) break; if (lc.cmd == llvm::MachO::LC_BUILD_VERSION) { // struct build_version_command { @@ -5932,7 +5932,7 @@ // the sentinel value indicating that this object file // does not have a valid minimum os version #. if (m_sdk_versions.size() > 1) { - if (versions != NULL && num_versions > 0) { + if (versions != nullptr && num_versions > 0) { for (size_t i = 0; i < num_versions; ++i) { if (i < m_sdk_versions.size()) versions[i] = m_sdk_versions[i]; Index: source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp =================================================================== --- source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp +++ source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp @@ -596,7 +596,7 @@ ModuleSP module_sp(GetModule()); if (module_sp) { std::lock_guard guard(module_sp->GetMutex()); - if (m_symtab_up == NULL) { + if (m_symtab_up == nullptr) { SectionList *sect_list = GetSectionList(); m_symtab_up.reset(new Symtab(this)); std::lock_guard guard(m_symtab_up->GetMutex()); @@ -627,7 +627,7 @@ for (uint32_t i = 0; i < num_syms; ++i) { coff_symbol_t symbol; const uint32_t symbol_offset = offset; - const char *symbol_name_cstr = NULL; + const char *symbol_name_cstr = nullptr; // If the first 4 bytes of the symbol string are zero, then they // are followed by a 4-byte string table offset. Else these // 8 bytes contain the symbol name @@ -642,7 +642,7 @@ // bytes offset += sizeof(symbol.name) - 4; // Skip remaining symbol_name_cstr = symtab_data.PeekCStr(symbol_offset); - if (symbol_name_cstr == NULL) + if (symbol_name_cstr == nullptr) break; symbol_name.assign(symbol_name_cstr, sizeof(symbol.name)); } @@ -1006,10 +1006,10 @@ SectionList *sections = GetSectionList(); if (sections) - sections->Dump(s, NULL, true, UINT32_MAX); + sections->Dump(s, nullptr, true, UINT32_MAX); if (m_symtab_up) - m_symtab_up->Dump(s, NULL, eSortOrderNone); + m_symtab_up->Dump(s, nullptr, eSortOrderNone); if (m_dos_header.e_magic) DumpDOSHeader(s, m_dos_header); Index: source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp =================================================================== --- source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp +++ source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp @@ -59,7 +59,7 @@ if (os_up.get() && os_up->IsValid()) return os_up.release(); } - return NULL; + return nullptr; } ConstString OperatingSystemPython::GetPluginNameStatic() { @@ -75,7 +75,7 @@ OperatingSystemPython::OperatingSystemPython(lldb_private::Process *process, const FileSpec &python_module_path) : OperatingSystem(process), m_thread_list_valobj_sp(), m_register_info_up(), - m_interpreter(NULL), m_python_object_sp() { + m_interpreter(nullptr), m_python_object_sp() { if (!process) return; TargetSP target_sp = process->CalculateTarget(); @@ -115,9 +115,9 @@ OperatingSystemPython::~OperatingSystemPython() {} DynamicRegisterInfo *OperatingSystemPython::GetDynamicRegisterInfo() { - if (m_register_info_up == NULL) { + if (m_register_info_up == nullptr) { if (!m_interpreter || !m_python_object_sp) - return NULL; + return nullptr; Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OS)); if (log) @@ -128,7 +128,7 @@ StructuredData::DictionarySP dictionary = m_interpreter->OSPlugin_RegisterInfo(m_python_object_sp); if (!dictionary) - return NULL; + return nullptr; m_register_info_up.reset(new DynamicRegisterInfo( *dictionary, m_process->GetTarget().GetArchitecture())); @@ -198,9 +198,9 @@ StructuredData::ObjectSP thread_dict_obj = threads_list->GetItemAtIndex(i); if (auto thread_dict = thread_dict_obj->GetAsDictionary()) { - ThreadSP thread_sp( - CreateThreadFromThreadInfo(*thread_dict, core_thread_list, - old_thread_list, core_used_map, NULL)); + ThreadSP thread_sp(CreateThreadFromThreadInfo( + *thread_dict, core_thread_list, old_thread_list, core_used_map, + nullptr)); if (thread_sp) new_thread_list.AddThread(thread_sp); } Index: source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp =================================================================== --- source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp +++ source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp @@ -262,7 +262,7 @@ Status &error) { lldb::ProcessSP process_sp; if (IsHost()) { - if (target == NULL) { + if (target == nullptr) { TargetSP new_target_sp; ArchSpec emptyArchSpec; @@ -279,7 +279,7 @@ // even when debugging locally we are debugging remotely! Just like the // darwin plugin. process_sp = target->CreateProcess( - attach_info.GetListenerForProcess(debugger), "gdb-remote", NULL); + attach_info.GetListenerForProcess(debugger), "gdb-remote", nullptr); if (process_sp) error = process_sp->Attach(attach_info); Index: source/Plugins/Platform/Linux/PlatformLinux.cpp =================================================================== --- source/Plugins/Platform/Linux/PlatformLinux.cpp +++ source/Plugins/Platform/Linux/PlatformLinux.cpp @@ -237,7 +237,7 @@ // Figure out what shell we're planning on using. const char *shell_name = strrchr(shell_string.c_str(), '/'); - if (shell_name == NULL) + if (shell_name == nullptr) shell_name = shell_string.c_str(); else shell_name++; @@ -372,7 +372,7 @@ // Handle the hijacking of process events. if (listener_sp) { const StateType state = process_sp->WaitForProcessToStop( - llvm::None, NULL, false, listener_sp); + llvm::None, nullptr, false, listener_sp); LLDB_LOG(log, "pid {0} state {0}", process_sp->GetID(), state); } Index: source/Plugins/Platform/MacOSX/PlatformDarwin.cpp =================================================================== --- source/Plugins/Platform/MacOSX/PlatformDarwin.cpp +++ source/Plugins/Platform/MacOSX/PlatformDarwin.cpp @@ -374,7 +374,7 @@ new_module_spec.GetFileSpec() = bundle_directory; if (Host::ResolveExecutableInBundle(new_module_spec.GetFileSpec())) { Status new_error(Platform::GetSharedModule( - new_module_spec, process, module_sp, NULL, old_module_sp_ptr, + new_module_spec, process, module_sp, nullptr, old_module_sp_ptr, did_create_ptr)); if (module_sp) @@ -401,7 +401,7 @@ ModuleSpec new_module_spec(module_spec); new_module_spec.GetFileSpec() = new_file_spec; Status new_error(Platform::GetSharedModule( - new_module_spec, process, module_sp, NULL, + new_module_spec, process, module_sp, nullptr, old_module_sp_ptr, did_create_ptr)); if (module_sp) { @@ -1171,7 +1171,7 @@ std::string command_output; Status error = Host::RunShellCommand("/usr/bin/xcode-select --print-path", - NULL, // current working directory + nullptr, // current working directory &exit_status, &signo, &command_output, std::chrono::seconds(2), // short timeout false); // don't run in a shell @@ -1212,7 +1212,7 @@ assert(m_developer_directory.empty() == false); if (m_developer_directory[0]) return m_developer_directory.c_str(); - return NULL; + return nullptr; } BreakpointSP PlatformDarwin::SetThreadCreationBreakpoint(Target &target) { @@ -1233,7 +1233,7 @@ bool internal = true; bool hardware = false; LazyBool skip_prologue = eLazyBoolNo; - bp_sp = target.CreateBreakpoint(&bp_modules, NULL, g_bp_names, + bp_sp = target.CreateBreakpoint(&bp_modules, nullptr, g_bp_names, llvm::array_lengthof(g_bp_names), eFunctionNameTypeFull, eLanguageTypeUnknown, 0, skip_prologue, internal, hardware); @@ -1250,7 +1250,7 @@ std::string shell_string = shell.GetPath(); const char *shell_name = strrchr(shell_string.c_str(), '/'); - if (shell_name == NULL) + if (shell_name == nullptr) shell_name = shell_string.c_str(); else shell_name++; @@ -1341,7 +1341,7 @@ const char *command = "/usr/bin/xcode-select -p"; lldb_private::Status error = Host::RunShellCommand( command, // shell command to run - NULL, // current working directory + nullptr, // current working directory &status, // Put the exit status of the process in here &signo, // Put the signal that caused the process to exit in here &output, // Get the output from the command and place it in this @@ -1742,7 +1742,7 @@ ModuleSpec new_module_spec(module_spec); new_module_spec.GetFileSpec() = path_to_try; Status new_error(Platform::GetSharedModule( - new_module_spec, process, module_sp, NULL, old_module_sp_ptr, + new_module_spec, process, module_sp, nullptr, old_module_sp_ptr, did_create_ptr)); if (module_sp) { Index: source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp =================================================================== --- source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp +++ source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp @@ -183,7 +183,7 @@ const char *command = "xcrun -sdk macosx --show-sdk-path"; lldb_private::Status error = RunShellCommand( command, // shell command to run - NULL, // current working directory + nullptr, // current working directory &status, // Put the exit status of the process in here &signo, // Put the signal that caused the process to exit in // here @@ -309,7 +309,7 @@ if (module_spec.GetArchitecture().GetCore() == ArchSpec::eCore_x86_64_x86_64h) { ObjectFile *objfile = module_sp->GetObjectFile(); - if (objfile == NULL) { + if (objfile == nullptr) { // We didn't find an x86_64h slice, fall back to a x86_64 slice ModuleSpec module_spec_x86_64(module_spec); module_spec_x86_64.GetArchitecture() = ArchSpec("x86_64-apple-macosx"); Index: source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.cpp =================================================================== --- source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.cpp +++ source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.cpp @@ -81,7 +81,7 @@ if (resolved_module_spec.GetArchitecture().IsValid() || resolved_module_spec.GetUUID().IsValid()) { error = ModuleList::GetSharedModule(resolved_module_spec, exe_module_sp, - NULL, NULL, NULL); + nullptr, nullptr, nullptr); if (exe_module_sp && exe_module_sp->GetObjectFile()) return error; @@ -95,7 +95,7 @@ idx, resolved_module_spec.GetArchitecture()); ++idx) { error = ModuleList::GetSharedModule(resolved_module_spec, exe_module_sp, - NULL, NULL, NULL); + nullptr, nullptr, nullptr); // Did we find an executable using one of the if (error.Success()) { if (exe_module_sp && exe_module_sp->GetObjectFile()) @@ -308,12 +308,12 @@ return &m_sdk_directory_infos[i]; } } - return NULL; + return nullptr; } const PlatformRemoteDarwinDevice::SDKDirectoryInfo * PlatformRemoteDarwinDevice::GetSDKDirectoryForLatestOSVersion() { - const PlatformRemoteDarwinDevice::SDKDirectoryInfo *result = NULL; + const PlatformRemoteDarwinDevice::SDKDirectoryInfo *result = nullptr; if (UpdateSDKDirectoryInfosIfNeeded()) { auto max = std::max_element( m_sdk_directory_infos.begin(), m_sdk_directory_infos.end(), @@ -344,7 +344,7 @@ assert(m_device_support_directory.empty() == false); if (m_device_support_directory[0]) return m_device_support_directory.c_str(); - return NULL; + return nullptr; } const char *PlatformRemoteDarwinDevice::GetDeviceSupportDirectoryForOSVersion() { @@ -354,7 +354,7 @@ if (m_device_support_directory_for_os_version.empty()) { const PlatformRemoteDarwinDevice::SDKDirectoryInfo *sdk_dir_info = GetSDKDirectoryForCurrentOSVersion(); - if (sdk_dir_info == NULL) + if (sdk_dir_info == nullptr) sdk_dir_info = GetSDKDirectoryForLatestOSVersion(); if (sdk_dir_info) { char path[PATH_MAX]; @@ -374,7 +374,7 @@ assert(m_device_support_directory_for_os_version.empty() == false); if (m_device_support_directory_for_os_version[0]) return m_device_support_directory_for_os_version.c_str(); - return NULL; + return nullptr; } uint32_t PlatformRemoteDarwinDevice::FindFileInAllSDKs(const char *platform_file_path, @@ -523,7 +523,7 @@ if (GetFileInSDK(platform_file_path, connected_sdk_idx, platform_module_spec.GetFileSpec())) { module_sp.reset(); - error = ResolveExecutable(platform_module_spec, module_sp, NULL); + error = ResolveExecutable(platform_module_spec, module_sp, nullptr); if (module_sp) { m_last_module_sdk_idx = connected_sdk_idx; error.Clear(); @@ -540,7 +540,7 @@ if (GetFileInSDK(platform_file_path, m_last_module_sdk_idx, platform_module_spec.GetFileSpec())) { module_sp.reset(); - error = ResolveExecutable(platform_module_spec, module_sp, NULL); + error = ResolveExecutable(platform_module_spec, module_sp, nullptr); if (module_sp) { error.Clear(); return error; @@ -562,7 +562,7 @@ if (GetFileInSDK(platform_file_path, current_sdk_idx, platform_module_spec.GetFileSpec())) { module_sp.reset(); - error = ResolveExecutable(platform_module_spec, module_sp, NULL); + error = ResolveExecutable(platform_module_spec, module_sp, nullptr); if (module_sp) { m_last_module_sdk_idx = current_sdk_idx; error.Clear(); @@ -583,7 +583,7 @@ platform_module_spec.GetFileSpec())) { // printf ("sdk[%u]: '%s'\n", sdk_idx, local_file.GetPath().c_str()); - error = ResolveExecutable(platform_module_spec, module_sp, NULL); + error = ResolveExecutable(platform_module_spec, module_sp, nullptr); if (module_sp) { // Remember the index of the last SDK that we found a file in in case // the wrong SDK was selected. @@ -648,7 +648,7 @@ uint32_t PlatformRemoteDarwinDevice::GetSDKIndexBySDKDirectoryInfo( const SDKDirectoryInfo *sdk_info) { - if (sdk_info == NULL) { + if (sdk_info == nullptr) { return UINT32_MAX; } Index: source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp =================================================================== --- source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp +++ source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp @@ -206,7 +206,7 @@ // Figure out what shell we're planning on using. const char *shell_name = strrchr(shell_string.c_str(), '/'); - if (shell_name == NULL) + if (shell_name == nullptr) shell_name = shell_string.c_str(); else shell_name++; @@ -322,7 +322,7 @@ // Handle the hijacking of process events. if (listener_sp) { const StateType state = process_sp->WaitForProcessToStop( - llvm::None, NULL, false, listener_sp); + llvm::None, nullptr, false, listener_sp); LLDB_LOG(log, "pid {0} state {0}", process_sp->GetID(), state); } Index: source/Plugins/Platform/POSIX/PlatformPOSIX.cpp =================================================================== --- source/Plugins/Platform/POSIX/PlatformPOSIX.cpp +++ source/Plugins/Platform/POSIX/PlatformPOSIX.cpp @@ -223,8 +223,8 @@ command.Printf(":%d", gid); command.Printf("%s", path); int status; - platform->RunShellCommand(command.GetData(), NULL, &status, NULL, NULL, - std::chrono::seconds(10)); + platform->RunShellCommand(command.GetData(), nullptr, &status, nullptr, + nullptr, std::chrono::seconds(10)); return status; } @@ -248,7 +248,7 @@ StreamString command; command.Printf("cp %s %s", src_path.c_str(), dst_path.c_str()); int status; - RunShellCommand(command.GetData(), NULL, &status, NULL, NULL, + RunShellCommand(command.GetData(), nullptr, &status, nullptr, nullptr, std::chrono::seconds(10)); if (status != 0) return Status("unable to perform copy"); @@ -279,8 +279,8 @@ if (log) log->Printf("[PutFile] Running command: %s\n", command.GetData()); int retcode; - Host::RunShellCommand(command.GetData(), NULL, &retcode, NULL, NULL, - std::chrono::minutes(1)); + Host::RunShellCommand(command.GetData(), nullptr, &retcode, nullptr, + nullptr, std::chrono::minutes(1)); if (retcode == 0) { // Don't chown a local file for a remote system // if (chown_file(this,dst_path.c_str(),uid,gid) != 0) @@ -315,7 +315,7 @@ StreamString cp_command; cp_command.Printf("cp %s %s", src_path.c_str(), dst_path.c_str()); int status; - RunShellCommand(cp_command.GetData(), NULL, &status, NULL, NULL, + RunShellCommand(cp_command.GetData(), nullptr, &status, nullptr, nullptr, std::chrono::seconds(10)); if (status != 0) return Status("unable to perform copy"); @@ -337,8 +337,8 @@ if (log) log->Printf("[GetFile] Running command: %s\n", command.GetData()); int retcode; - Host::RunShellCommand(command.GetData(), NULL, &retcode, NULL, NULL, - std::chrono::minutes(1)); + Host::RunShellCommand(command.GetData(), nullptr, &retcode, nullptr, + nullptr, std::chrono::minutes(1)); if (retcode == 0) return Status(); // If we are here, rsync has failed - let's try the slow way before @@ -509,11 +509,11 @@ Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM)); if (IsHost()) { - if (target == NULL) { + if (target == nullptr) { TargetSP new_target_sp; error = debugger.GetTargetList().CreateTarget( - debugger, "", "", eLoadDependentsNo, NULL, new_target_sp); + debugger, "", "", eLoadDependentsNo, nullptr, new_target_sp); target = new_target_sp.get(); if (log) log->Printf("PlatformPOSIX::%s created new target", __FUNCTION__); @@ -537,7 +537,7 @@ process_sp = target->CreateProcess(attach_info.GetListenerForProcess(debugger), - attach_info.GetProcessPluginName(), NULL); + attach_info.GetProcessPluginName(), nullptr); if (process_sp) { ListenerSP listener_sp = attach_info.GetHijackListener(); Index: source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp =================================================================== --- source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp +++ source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp @@ -109,7 +109,8 @@ if (resolved_module_spec.GetArchitecture().IsValid() || resolved_module_spec.GetUUID().IsValid()) { error = ModuleList::GetSharedModule(resolved_module_spec, exe_module_sp, - module_search_paths_ptr, NULL, NULL); + module_search_paths_ptr, nullptr, + nullptr); if (exe_module_sp && exe_module_sp->GetObjectFile()) return error; @@ -123,7 +124,8 @@ idx, resolved_module_spec.GetArchitecture()); ++idx) { error = ModuleList::GetSharedModule(resolved_module_spec, exe_module_sp, - module_search_paths_ptr, NULL, NULL); + module_search_paths_ptr, nullptr, + nullptr); // Did we find an executable using one of the if (error.Success()) { if (exe_module_sp && exe_module_sp->GetObjectFile()) @@ -333,7 +335,7 @@ const char *PlatformRemoteGDBServer::GetHostname() { m_gdb_client.GetHostname(m_name); if (m_name.empty()) - return NULL; + return nullptr; return m_name.c_str(); } @@ -469,11 +471,11 @@ error.SetErrorStringWithFormat("unable to launch a GDB server on '%s'", GetHostname()); } else { - if (target == NULL) { + if (target == nullptr) { TargetSP new_target_sp; error = debugger.GetTargetList().CreateTarget( - debugger, "", "", eLoadDependentsNo, NULL, new_target_sp); + debugger, "", "", eLoadDependentsNo, nullptr, new_target_sp); target = new_target_sp.get(); } else error.Clear(); @@ -484,7 +486,7 @@ // The darwin always currently uses the GDB remote debugger plug-in // so even when debugging locally we are debugging remotely! process_sp = target->CreateProcess(launch_info.GetListener(), - "gdb-remote", NULL); + "gdb-remote", nullptr); if (process_sp) { error = process_sp->ConnectRemote(nullptr, connect_url.c_str()); @@ -555,11 +557,11 @@ error.SetErrorStringWithFormat("unable to launch a GDB server on '%s'", GetHostname()); } else { - if (target == NULL) { + if (target == nullptr) { TargetSP new_target_sp; error = debugger.GetTargetList().CreateTarget( - debugger, "", "", eLoadDependentsNo, NULL, new_target_sp); + debugger, "", "", eLoadDependentsNo, nullptr, new_target_sp); target = new_target_sp.get(); } else error.Clear(); @@ -569,8 +571,9 @@ // The darwin always currently uses the GDB remote debugger plug-in // so even when debugging locally we are debugging remotely! - process_sp = target->CreateProcess( - attach_info.GetListenerForProcess(debugger), "gdb-remote", NULL); + process_sp = + target->CreateProcess(attach_info.GetListenerForProcess(debugger), + "gdb-remote", nullptr); if (process_sp) { error = process_sp->ConnectRemote(nullptr, connect_url.c_str()); if (error.Success()) { Index: source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.cpp =================================================================== --- source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.cpp +++ source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.cpp @@ -29,13 +29,13 @@ unsigned int *__eax, unsigned int *__ebx, unsigned int *__ecx, unsigned int *__edx) { - unsigned int __max_leaf = __get_cpuid_max(__leaf & 0x80000000, 0); + unsigned int __max_leaf = __get_cpuid_max(__leaf & 0x80000000, nullptr); - if (__max_leaf == 0 || __max_leaf < __leaf) - return 0; + if (__max_leaf == 0 || __max_leaf < __leaf) + return 0; - __cpuid_count(__leaf, __subleaf, *__eax, *__ebx, *__ecx, *__edx); - return 1; + __cpuid_count(__leaf, __subleaf, *__eax, *__ebx, *__ecx, *__edx); + return 1; } using namespace lldb_private; Index: source/Plugins/Process/Linux/ProcessorTrace.cpp =================================================================== --- source/Plugins/Process/Linux/ProcessorTrace.cpp +++ source/Plugins/Process/Linux/ProcessorTrace.cpp @@ -117,7 +117,7 @@ errno = 0; auto base = - mmap(NULL, (metabufsize + page_size), PROT_WRITE, MAP_SHARED, fd, 0); + mmap(nullptr, (metabufsize + page_size), PROT_WRITE, MAP_SHARED, fd, 0); if (base == MAP_FAILED) { LLDB_LOG(log, "mmap base error {0}", errno); @@ -133,7 +133,7 @@ m_mmap_meta->aux_size = bufsize; errno = 0; - auto mmap_aux = mmap(NULL, bufsize, PROT_READ, MAP_SHARED, fd, + auto mmap_aux = mmap(nullptr, bufsize, PROT_READ, MAP_SHARED, fd, static_cast(m_mmap_meta->aux_offset)); if (mmap_aux == MAP_FAILED) { Index: source/Plugins/Process/POSIX/ProcessMessage.cpp =================================================================== --- source/Plugins/Process/POSIX/ProcessMessage.cpp +++ source/Plugins/Process/POSIX/ProcessMessage.cpp @@ -20,7 +20,7 @@ chcar str[8]; sprintf(str, "%d", reason); #else - const char *str = NULL; + const char *str = nullptr; switch (kind) { case eInvalidMessage: Index: source/Plugins/Process/Utility/DynamicRegisterInfo.cpp =================================================================== --- source/Plugins/Process/Utility/DynamicRegisterInfo.cpp +++ source/Plugins/Process/Utility/DynamicRegisterInfo.cpp @@ -67,7 +67,7 @@ for (uint32_t i = 0; i < num_sets; ++i) { ConstString set_name; if (sets->GetItemAtIndexAsString(i, set_name) && !set_name.IsEmpty()) { - m_sets.push_back({ set_name.AsCString(), NULL, 0, NULL }); + m_sets.push_back({set_name.AsCString(), nullptr, 0, nullptr}); } else { Clear(); printf("error: register sets must have valid names\n"); @@ -302,7 +302,7 @@ llvm::StringRef format_str; if (reg_info_dict->GetValueForKeyAsString("format", format_str, nullptr)) { if (OptionArgParser::ToFormat(format_str.str().c_str(), reg_info.format, - NULL) + nullptr) .Fail()) { Clear(); printf("error: invalid 'format' value in register dictionary\n"); @@ -414,7 +414,7 @@ const uint32_t reg_num = m_regs.size(); reg_info.name = reg_name.AsCString(); assert(reg_info.name); - reg_info.alt_name = reg_alt_name.AsCString(NULL); + reg_info.alt_name = reg_alt_name.AsCString(nullptr); uint32_t i; if (reg_info.value_regs) { for (i = 0; reg_info.value_regs[i] != LLDB_INVALID_REGNUM; ++i) @@ -480,7 +480,7 @@ if (m_value_regs_map.find(i) != m_value_regs_map.end()) m_regs[i].value_regs = m_value_regs_map[i].data(); else - m_regs[i].value_regs = NULL; + m_regs[i].value_regs = nullptr; } // Expand all invalidation dependencies @@ -529,7 +529,7 @@ if (m_invalidate_regs_map.find(i) != m_invalidate_regs_map.end()) m_regs[i].invalidate_regs = m_invalidate_regs_map[i].data(); else - m_regs[i].invalidate_regs = NULL; + m_regs[i].invalidate_regs = nullptr; } // Check if we need to automatically set the generic registers in case they @@ -639,19 +639,19 @@ DynamicRegisterInfo::GetRegisterInfoAtIndex(uint32_t i) const { if (i < m_regs.size()) return &m_regs[i]; - return NULL; + return nullptr; } RegisterInfo *DynamicRegisterInfo::GetRegisterInfoAtIndex(uint32_t i) { if (i < m_regs.size()) return &m_regs[i]; - return NULL; + return nullptr; } const RegisterSet *DynamicRegisterInfo::GetRegisterSet(uint32_t i) const { if (i < m_sets.size()) return &m_sets[i]; - return NULL; + return nullptr; } uint32_t DynamicRegisterInfo::GetRegisterSetIndexByName(ConstString &set_name, @@ -664,7 +664,7 @@ m_set_names.push_back(set_name); m_set_reg_nums.resize(m_set_reg_nums.size() + 1); - RegisterSet new_set = {set_name.AsCString(), NULL, 0, NULL}; + RegisterSet new_set = {set_name.AsCString(), nullptr, 0, nullptr}; m_sets.push_back(new_set); return m_sets.size() - 1; } @@ -754,5 +754,5 @@ return ®_info; } } - return NULL; + return nullptr; } Index: source/Plugins/Process/Utility/HistoryThread.cpp =================================================================== --- source/Plugins/Process/Utility/HistoryThread.cpp +++ source/Plugins/Process/Utility/HistoryThread.cpp @@ -66,7 +66,7 @@ // FIXME do not throw away the lock after we acquire it.. std::unique_lock lock(m_framelist_mutex); lock.unlock(); - if (m_framelist.get() == NULL) { + if (m_framelist.get() == nullptr) { m_framelist = std::make_shared(*this, StackFrameListSP(), true); } Index: source/Plugins/Process/Utility/InferiorCallPOSIX.cpp =================================================================== --- source/Plugins/Process/Utility/InferiorCallPOSIX.cpp +++ source/Plugins/Process/Utility/InferiorCallPOSIX.cpp @@ -38,7 +38,7 @@ unsigned flags, addr_t fd, addr_t offset) { Thread *thread = process->GetThreadList().GetExpressionExecutionThread().get(); - if (thread == NULL) + if (thread == nullptr) return false; const bool append = true; @@ -126,7 +126,7 @@ addr_t length) { Thread *thread = process->GetThreadList().GetExpressionExecutionThread().get(); - if (thread == NULL) + if (thread == nullptr) return false; const bool append = true; @@ -188,7 +188,7 @@ addr_t &returned_func, bool trap_exceptions) { Thread *thread = process->GetThreadList().GetExpressionExecutionThread().get(); - if (thread == NULL || address == NULL) + if (thread == nullptr || address == nullptr) return false; EvaluateExpressionOptions options; Index: source/Plugins/Process/Utility/RegisterContextDarwin_arm.cpp =================================================================== --- source/Plugins/Process/Utility/RegisterContextDarwin_arm.cpp +++ source/Plugins/Process/Utility/RegisterContextDarwin_arm.cpp @@ -198,7 +198,7 @@ // =============== =============== ========================= // ===================== ============= {"r0", - NULL, + nullptr, 4, GPR_OFFSET(0), eEncodingUint, @@ -209,7 +209,7 @@ nullptr, 0}, {"r1", - NULL, + nullptr, 4, GPR_OFFSET(1), eEncodingUint, @@ -220,7 +220,7 @@ nullptr, 0}, {"r2", - NULL, + nullptr, 4, GPR_OFFSET(2), eEncodingUint, @@ -231,7 +231,7 @@ nullptr, 0}, {"r3", - NULL, + nullptr, 4, GPR_OFFSET(3), eEncodingUint, @@ -242,7 +242,7 @@ nullptr, 0}, {"r4", - NULL, + nullptr, 4, GPR_OFFSET(4), eEncodingUint, @@ -253,7 +253,7 @@ nullptr, 0}, {"r5", - NULL, + nullptr, 4, GPR_OFFSET(5), eEncodingUint, @@ -264,7 +264,7 @@ nullptr, 0}, {"r6", - NULL, + nullptr, 4, GPR_OFFSET(6), eEncodingUint, @@ -275,7 +275,7 @@ nullptr, 0}, {"r7", - NULL, + nullptr, 4, GPR_OFFSET(7), eEncodingUint, @@ -287,7 +287,7 @@ nullptr, 0}, {"r8", - NULL, + nullptr, 4, GPR_OFFSET(8), eEncodingUint, @@ -298,7 +298,7 @@ nullptr, 0}, {"r9", - NULL, + nullptr, 4, GPR_OFFSET(9), eEncodingUint, @@ -309,7 +309,7 @@ nullptr, 0}, {"r10", - NULL, + nullptr, 4, GPR_OFFSET(10), eEncodingUint, @@ -321,7 +321,7 @@ nullptr, 0}, {"r11", - NULL, + nullptr, 4, GPR_OFFSET(11), eEncodingUint, @@ -333,7 +333,7 @@ nullptr, 0}, {"r12", - NULL, + nullptr, 4, GPR_OFFSET(12), eEncodingUint, @@ -394,7 +394,7 @@ 0}, {"s0", - NULL, + nullptr, 4, FPU_OFFSET(0), eEncodingIEEE754, @@ -406,7 +406,7 @@ nullptr, 0}, {"s1", - NULL, + nullptr, 4, FPU_OFFSET(1), eEncodingIEEE754, @@ -418,7 +418,7 @@ nullptr, 0}, {"s2", - NULL, + nullptr, 4, FPU_OFFSET(2), eEncodingIEEE754, @@ -430,7 +430,7 @@ nullptr, 0}, {"s3", - NULL, + nullptr, 4, FPU_OFFSET(3), eEncodingIEEE754, @@ -442,7 +442,7 @@ nullptr, 0}, {"s4", - NULL, + nullptr, 4, FPU_OFFSET(4), eEncodingIEEE754, @@ -454,7 +454,7 @@ nullptr, 0}, {"s5", - NULL, + nullptr, 4, FPU_OFFSET(5), eEncodingIEEE754, @@ -466,7 +466,7 @@ nullptr, 0}, {"s6", - NULL, + nullptr, 4, FPU_OFFSET(6), eEncodingIEEE754, @@ -478,7 +478,7 @@ nullptr, 0}, {"s7", - NULL, + nullptr, 4, FPU_OFFSET(7), eEncodingIEEE754, @@ -490,7 +490,7 @@ nullptr, 0}, {"s8", - NULL, + nullptr, 4, FPU_OFFSET(8), eEncodingIEEE754, @@ -502,7 +502,7 @@ nullptr, 0}, {"s9", - NULL, + nullptr, 4, FPU_OFFSET(9), eEncodingIEEE754, @@ -514,7 +514,7 @@ nullptr, 0}, {"s10", - NULL, + nullptr, 4, FPU_OFFSET(10), eEncodingIEEE754, @@ -526,7 +526,7 @@ nullptr, 0}, {"s11", - NULL, + nullptr, 4, FPU_OFFSET(11), eEncodingIEEE754, @@ -538,7 +538,7 @@ nullptr, 0}, {"s12", - NULL, + nullptr, 4, FPU_OFFSET(12), eEncodingIEEE754, @@ -550,7 +550,7 @@ nullptr, 0}, {"s13", - NULL, + nullptr, 4, FPU_OFFSET(13), eEncodingIEEE754, @@ -562,7 +562,7 @@ nullptr, 0}, {"s14", - NULL, + nullptr, 4, FPU_OFFSET(14), eEncodingIEEE754, @@ -574,7 +574,7 @@ nullptr, 0}, {"s15", - NULL, + nullptr, 4, FPU_OFFSET(15), eEncodingIEEE754, @@ -586,7 +586,7 @@ nullptr, 0}, {"s16", - NULL, + nullptr, 4, FPU_OFFSET(16), eEncodingIEEE754, @@ -598,7 +598,7 @@ nullptr, 0}, {"s17", - NULL, + nullptr, 4, FPU_OFFSET(17), eEncodingIEEE754, @@ -610,7 +610,7 @@ nullptr, 0}, {"s18", - NULL, + nullptr, 4, FPU_OFFSET(18), eEncodingIEEE754, @@ -622,7 +622,7 @@ nullptr, 0}, {"s19", - NULL, + nullptr, 4, FPU_OFFSET(19), eEncodingIEEE754, @@ -634,7 +634,7 @@ nullptr, 0}, {"s20", - NULL, + nullptr, 4, FPU_OFFSET(20), eEncodingIEEE754, @@ -646,7 +646,7 @@ nullptr, 0}, {"s21", - NULL, + nullptr, 4, FPU_OFFSET(21), eEncodingIEEE754, @@ -658,7 +658,7 @@ nullptr, 0}, {"s22", - NULL, + nullptr, 4, FPU_OFFSET(22), eEncodingIEEE754, @@ -670,7 +670,7 @@ nullptr, 0}, {"s23", - NULL, + nullptr, 4, FPU_OFFSET(23), eEncodingIEEE754, @@ -682,7 +682,7 @@ nullptr, 0}, {"s24", - NULL, + nullptr, 4, FPU_OFFSET(24), eEncodingIEEE754, @@ -694,7 +694,7 @@ nullptr, 0}, {"s25", - NULL, + nullptr, 4, FPU_OFFSET(25), eEncodingIEEE754, @@ -706,7 +706,7 @@ nullptr, 0}, {"s26", - NULL, + nullptr, 4, FPU_OFFSET(26), eEncodingIEEE754, @@ -718,7 +718,7 @@ nullptr, 0}, {"s27", - NULL, + nullptr, 4, FPU_OFFSET(27), eEncodingIEEE754, @@ -730,7 +730,7 @@ nullptr, 0}, {"s28", - NULL, + nullptr, 4, FPU_OFFSET(28), eEncodingIEEE754, @@ -742,7 +742,7 @@ nullptr, 0}, {"s29", - NULL, + nullptr, 4, FPU_OFFSET(29), eEncodingIEEE754, @@ -754,7 +754,7 @@ nullptr, 0}, {"s30", - NULL, + nullptr, 4, FPU_OFFSET(30), eEncodingIEEE754, @@ -766,7 +766,7 @@ nullptr, 0}, {"s31", - NULL, + nullptr, 4, FPU_OFFSET(31), eEncodingIEEE754, @@ -778,7 +778,7 @@ nullptr, 0}, {"fpscr", - NULL, + nullptr, 4, FPU_OFFSET(32), eEncodingUint, @@ -791,7 +791,7 @@ 0}, {"exception", - NULL, + nullptr, 4, EXC_OFFSET(0), eEncodingUint, @@ -803,7 +803,7 @@ nullptr, 0}, {"fsr", - NULL, + nullptr, 4, EXC_OFFSET(1), eEncodingUint, @@ -815,7 +815,7 @@ nullptr, 0}, {"far", - NULL, + nullptr, 4, EXC_OFFSET(2), eEncodingUint, @@ -944,7 +944,7 @@ assert(k_num_register_infos == k_num_registers); if (reg < k_num_registers) return &g_register_infos[reg]; - return NULL; + return nullptr; } size_t RegisterContextDarwin_arm::GetRegisterInfosCount() { @@ -979,7 +979,7 @@ const RegisterSet *RegisterContextDarwin_arm::GetRegisterSet(size_t reg_set) { if (reg_set < k_num_regsets) return &g_reg_sets[reg_set]; - return NULL; + return nullptr; } // Register information definitions for 32 bit i386. Index: source/Plugins/Process/Utility/RegisterContextDarwin_arm64.cpp =================================================================== --- source/Plugins/Process/Utility/RegisterContextDarwin_arm64.cpp +++ source/Plugins/Process/Utility/RegisterContextDarwin_arm64.cpp @@ -122,7 +122,7 @@ assert(k_num_register_infos == k_num_registers); if (reg < k_num_registers) return &g_register_infos_arm64_le[reg]; - return NULL; + return nullptr; } size_t RegisterContextDarwin_arm64::GetRegisterInfosCount() { @@ -157,7 +157,7 @@ const RegisterSet *RegisterContextDarwin_arm64::GetRegisterSet(size_t reg_set) { if (reg_set < k_num_regsets) return &g_reg_sets[reg_set]; - return NULL; + return nullptr; } // Register information definitions for arm64 Index: source/Plugins/Process/Utility/RegisterContextDarwin_i386.cpp =================================================================== --- source/Plugins/Process/Utility/RegisterContextDarwin_i386.cpp +++ source/Plugins/Process/Utility/RegisterContextDarwin_i386.cpp @@ -176,42 +176,42 @@ // =============================== ======================= // =================== ========================= ================== // ================= - {DEFINE_GPR(eax, NULL), + {DEFINE_GPR(eax, nullptr), {ehframe_eax, dwarf_eax, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gpr_eax}, nullptr, nullptr, nullptr, 0}, - {DEFINE_GPR(ebx, NULL), + {DEFINE_GPR(ebx, nullptr), {ehframe_ebx, dwarf_ebx, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gpr_ebx}, nullptr, nullptr, nullptr, 0}, - {DEFINE_GPR(ecx, NULL), + {DEFINE_GPR(ecx, nullptr), {ehframe_ecx, dwarf_ecx, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gpr_ecx}, nullptr, nullptr, nullptr, 0}, - {DEFINE_GPR(edx, NULL), + {DEFINE_GPR(edx, nullptr), {ehframe_edx, dwarf_edx, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gpr_edx}, nullptr, nullptr, nullptr, 0}, - {DEFINE_GPR(edi, NULL), + {DEFINE_GPR(edi, nullptr), {ehframe_edi, dwarf_edi, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gpr_edi}, nullptr, nullptr, nullptr, 0}, - {DEFINE_GPR(esi, NULL), + {DEFINE_GPR(esi, nullptr), {ehframe_esi, dwarf_esi, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gpr_esi}, nullptr, @@ -232,7 +232,7 @@ nullptr, nullptr, 0}, - {DEFINE_GPR(ss, NULL), + {DEFINE_GPR(ss, nullptr), {LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gpr_ss}, nullptr, @@ -253,35 +253,35 @@ nullptr, nullptr, 0}, - {DEFINE_GPR(cs, NULL), + {DEFINE_GPR(cs, nullptr), {LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gpr_cs}, nullptr, nullptr, nullptr, 0}, - {DEFINE_GPR(ds, NULL), + {DEFINE_GPR(ds, nullptr), {LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gpr_ds}, nullptr, nullptr, nullptr, 0}, - {DEFINE_GPR(es, NULL), + {DEFINE_GPR(es, nullptr), {LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gpr_es}, nullptr, nullptr, nullptr, 0}, - {DEFINE_GPR(fs, NULL), + {DEFINE_GPR(fs, nullptr), {LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gpr_fs}, nullptr, nullptr, nullptr, 0}, - {DEFINE_GPR(gs, NULL), + {DEFINE_GPR(gs, nullptr), {LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gpr_gs}, nullptr, @@ -427,7 +427,7 @@ assert(k_num_register_infos == k_num_registers); if (reg < k_num_registers) return &g_register_infos[reg]; - return NULL; + return nullptr; } size_t RegisterContextDarwin_i386::GetRegisterInfosCount() { @@ -479,7 +479,7 @@ const RegisterSet *RegisterContextDarwin_i386::GetRegisterSet(size_t reg_set) { if (reg_set < k_num_regsets) return &g_reg_sets[reg_set]; - return NULL; + return nullptr; } // Register information definitions for 32 bit i386. Index: source/Plugins/Process/Utility/RegisterContextDarwin_x86_64.cpp =================================================================== --- source/Plugins/Process/Utility/RegisterContextDarwin_x86_64.cpp +++ source/Plugins/Process/Utility/RegisterContextDarwin_x86_64.cpp @@ -195,42 +195,42 @@ // =============================== ====================== // =================== ========================== ==================== // =================== - {DEFINE_GPR(rax, NULL), + {DEFINE_GPR(rax, nullptr), {ehframe_dwarf_gpr_rax, ehframe_dwarf_gpr_rax, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gpr_rax}, nullptr, nullptr, nullptr, 0}, - {DEFINE_GPR(rbx, NULL), + {DEFINE_GPR(rbx, nullptr), {ehframe_dwarf_gpr_rbx, ehframe_dwarf_gpr_rbx, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gpr_rbx}, nullptr, nullptr, nullptr, 0}, - {DEFINE_GPR(rcx, NULL), + {DEFINE_GPR(rcx, nullptr), {ehframe_dwarf_gpr_rcx, ehframe_dwarf_gpr_rcx, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gpr_rcx}, nullptr, nullptr, nullptr, 0}, - {DEFINE_GPR(rdx, NULL), + {DEFINE_GPR(rdx, nullptr), {ehframe_dwarf_gpr_rdx, ehframe_dwarf_gpr_rdx, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gpr_rdx}, nullptr, nullptr, nullptr, 0}, - {DEFINE_GPR(rdi, NULL), + {DEFINE_GPR(rdi, nullptr), {ehframe_dwarf_gpr_rdi, ehframe_dwarf_gpr_rdi, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gpr_rdi}, nullptr, nullptr, nullptr, 0}, - {DEFINE_GPR(rsi, NULL), + {DEFINE_GPR(rsi, nullptr), {ehframe_dwarf_gpr_rsi, ehframe_dwarf_gpr_rsi, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gpr_rsi}, nullptr, @@ -251,56 +251,56 @@ nullptr, nullptr, 0}, - {DEFINE_GPR(r8, NULL), + {DEFINE_GPR(r8, nullptr), {ehframe_dwarf_gpr_r8, ehframe_dwarf_gpr_r8, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gpr_r8}, nullptr, nullptr, nullptr, 0}, - {DEFINE_GPR(r9, NULL), + {DEFINE_GPR(r9, nullptr), {ehframe_dwarf_gpr_r9, ehframe_dwarf_gpr_r9, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gpr_r9}, nullptr, nullptr, nullptr, 0}, - {DEFINE_GPR(r10, NULL), + {DEFINE_GPR(r10, nullptr), {ehframe_dwarf_gpr_r10, ehframe_dwarf_gpr_r10, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gpr_r10}, nullptr, nullptr, nullptr, 0}, - {DEFINE_GPR(r11, NULL), + {DEFINE_GPR(r11, nullptr), {ehframe_dwarf_gpr_r11, ehframe_dwarf_gpr_r11, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gpr_r11}, nullptr, nullptr, nullptr, 0}, - {DEFINE_GPR(r12, NULL), + {DEFINE_GPR(r12, nullptr), {ehframe_dwarf_gpr_r12, ehframe_dwarf_gpr_r12, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gpr_r12}, nullptr, nullptr, nullptr, 0}, - {DEFINE_GPR(r13, NULL), + {DEFINE_GPR(r13, nullptr), {ehframe_dwarf_gpr_r13, ehframe_dwarf_gpr_r13, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gpr_r13}, nullptr, nullptr, nullptr, 0}, - {DEFINE_GPR(r14, NULL), + {DEFINE_GPR(r14, nullptr), {ehframe_dwarf_gpr_r14, ehframe_dwarf_gpr_r14, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gpr_r14}, nullptr, nullptr, nullptr, 0}, - {DEFINE_GPR(r15, NULL), + {DEFINE_GPR(r15, nullptr), {ehframe_dwarf_gpr_r15, ehframe_dwarf_gpr_r15, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gpr_r15}, nullptr, @@ -321,21 +321,21 @@ nullptr, nullptr, 0}, - {DEFINE_GPR(cs, NULL), + {DEFINE_GPR(cs, nullptr), {LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gpr_cs}, nullptr, nullptr, nullptr, 0}, - {DEFINE_GPR(fs, NULL), + {DEFINE_GPR(fs, nullptr), {LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gpr_fs}, nullptr, nullptr, nullptr, 0}, - {DEFINE_GPR(gs, NULL), + {DEFINE_GPR(gs, nullptr), {LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gpr_gs}, nullptr, @@ -489,7 +489,7 @@ assert(k_num_register_infos == k_num_registers); if (reg < k_num_registers) return &g_register_infos[reg]; - return NULL; + return nullptr; } size_t RegisterContextDarwin_x86_64::GetRegisterInfosCount() { @@ -541,7 +541,7 @@ RegisterContextDarwin_x86_64::GetRegisterSet(size_t reg_set) { if (reg_set < k_num_regsets) return &g_reg_sets[reg_set]; - return NULL; + return nullptr; } int RegisterContextDarwin_x86_64::GetSetForNativeRegNum(int reg_num) { Index: source/Plugins/Process/Utility/RegisterContextDummy.cpp =================================================================== --- source/Plugins/Process/Utility/RegisterContextDummy.cpp +++ source/Plugins/Process/Utility/RegisterContextDummy.cpp @@ -49,8 +49,8 @@ m_pc_reg_info.byte_size = address_byte_size; m_pc_reg_info.encoding = eEncodingUint; m_pc_reg_info.format = eFormatPointer; - m_pc_reg_info.invalidate_regs = NULL; - m_pc_reg_info.value_regs = NULL; + m_pc_reg_info.invalidate_regs = nullptr; + m_pc_reg_info.value_regs = nullptr; m_pc_reg_info.kinds[eRegisterKindEHFrame] = LLDB_INVALID_REGNUM; m_pc_reg_info.kinds[eRegisterKindDWARF] = LLDB_INVALID_REGNUM; m_pc_reg_info.kinds[eRegisterKindGeneric] = LLDB_REGNUM_GENERIC_PC; @@ -71,7 +71,7 @@ const lldb_private::RegisterInfo * RegisterContextDummy::GetRegisterInfoAtIndex(size_t reg) { if (reg) - return NULL; + return nullptr; return &m_pc_reg_info; } @@ -80,7 +80,7 @@ const lldb_private::RegisterSet * RegisterContextDummy::GetRegisterSet(size_t reg_set) { if (reg_set) - return NULL; + return nullptr; return &m_reg_set0; } Index: source/Plugins/Process/Utility/RegisterContextFreeBSD_i386.cpp =================================================================== --- source/Plugins/Process/Utility/RegisterContextFreeBSD_i386.cpp +++ source/Plugins/Process/Utility/RegisterContextFreeBSD_i386.cpp @@ -70,7 +70,7 @@ return g_register_infos_i386; default: assert(false && "Unhandled target architecture."); - return NULL; + return nullptr; } } Index: source/Plugins/Process/Utility/RegisterContextFreeBSD_powerpc.cpp =================================================================== --- source/Plugins/Process/Utility/RegisterContextFreeBSD_powerpc.cpp +++ source/Plugins/Process/Utility/RegisterContextFreeBSD_powerpc.cpp @@ -188,7 +188,7 @@ const RegisterInfo *RegisterContextFreeBSD_powerpc::GetRegisterInfo() const { // assert (m_target_arch.GetCore() == ArchSpec::eCore_powerpc); llvm_unreachable("Abstract class!"); - return NULL; + return nullptr; } uint32_t RegisterContextFreeBSD_powerpc::GetRegisterCount() const { return 0; } Index: source/Plugins/Process/Utility/RegisterContextHistory.cpp =================================================================== --- source/Plugins/Process/Utility/RegisterContextHistory.cpp +++ source/Plugins/Process/Utility/RegisterContextHistory.cpp @@ -50,8 +50,8 @@ m_pc_reg_info.byte_size = address_byte_size; m_pc_reg_info.encoding = eEncodingUint; m_pc_reg_info.format = eFormatPointer; - m_pc_reg_info.invalidate_regs = NULL; - m_pc_reg_info.value_regs = NULL; + m_pc_reg_info.invalidate_regs = nullptr; + m_pc_reg_info.value_regs = nullptr; m_pc_reg_info.kinds[eRegisterKindEHFrame] = LLDB_INVALID_REGNUM; m_pc_reg_info.kinds[eRegisterKindDWARF] = LLDB_INVALID_REGNUM; m_pc_reg_info.kinds[eRegisterKindGeneric] = LLDB_REGNUM_GENERIC_PC; @@ -72,7 +72,7 @@ const lldb_private::RegisterInfo * RegisterContextHistory::GetRegisterInfoAtIndex(size_t reg) { if (reg) - return NULL; + return nullptr; return &m_pc_reg_info; } @@ -81,7 +81,7 @@ const lldb_private::RegisterSet * RegisterContextHistory::GetRegisterSet(size_t reg_set) { if (reg_set) - return NULL; + return nullptr; return &m_reg_set0; } Index: source/Plugins/Process/Utility/RegisterContextLLDB.cpp =================================================================== --- source/Plugins/Process/Utility/RegisterContextLLDB.cpp +++ source/Plugins/Process/Utility/RegisterContextLLDB.cpp @@ -113,7 +113,7 @@ ExecutionContext exe_ctx(m_thread.shared_from_this()); RegisterContextSP reg_ctx_sp = m_thread.GetRegisterContext(); - if (reg_ctx_sp.get() == NULL) { + if (reg_ctx_sp.get() == nullptr) { m_frame_type = eNotAValidFrame; UnwindLogMsg("frame does not have a register context"); return; @@ -664,7 +664,7 @@ ModuleSP pc_module_sp(m_current_pc.GetModule()); if (!m_current_pc.IsValid() || !pc_module_sp || - pc_module_sp->GetObjectFile() == NULL) + pc_module_sp->GetObjectFile() == nullptr) return unwind_plan_sp; if (IsFrameZero()) @@ -715,7 +715,7 @@ UnwindPlanSP arch_default_unwind_plan_sp; ExecutionContext exe_ctx(m_thread.shared_from_this()); Process *process = exe_ctx.GetProcessPtr(); - ABI *abi = process ? process->GetABI().get() : NULL; + ABI *abi = process ? process->GetABI().get() : nullptr; if (abi) { arch_default_unwind_plan_sp = std::make_shared(lldb::eRegisterKindGeneric); @@ -743,7 +743,7 @@ // This is for jumping to memory regions without any information available. if ((!m_sym_ctx_valid || - (m_sym_ctx.function == NULL && m_sym_ctx.symbol == NULL)) && + (m_sym_ctx.function == nullptr && m_sym_ctx.symbol == nullptr)) && behaves_like_zeroth_frame && m_current_pc.IsValid()) { uint32_t permissions; addr_t current_pc_addr = @@ -765,7 +765,7 @@ // No Module for the current pc, try using the architecture default unwind. ModuleSP pc_module_sp(m_current_pc.GetModule()); if (!m_current_pc.IsValid() || !pc_module_sp || - pc_module_sp->GetObjectFile() == NULL) { + pc_module_sp->GetObjectFile() == nullptr) { m_frame_type = eNormalFrame; return arch_default_unwind_plan_sp; } @@ -1349,7 +1349,7 @@ // register, we may be able to fall back to some ABI-defined default. For // example, some ABIs allow to determine the caller's SP via the CFA. Also, // the ABI may set volatile registers to the undefined state. - ABI *abi = process ? process->GetABI().get() : NULL; + ABI *abi = process ? process->GetABI().get() : nullptr; if (abi) { const RegisterInfo *reg_info = GetRegisterInfoAtIndex(regnum.GetAsKind(eRegisterKindLLDB)); @@ -1702,10 +1702,10 @@ } bool RegisterContextLLDB::ForceSwitchToFallbackUnwindPlan() { - if (m_fallback_unwind_plan_sp.get() == NULL) + if (m_fallback_unwind_plan_sp.get() == nullptr) return false; - if (m_full_unwind_plan_sp.get() == NULL) + if (m_full_unwind_plan_sp.get() == nullptr) return false; if (m_full_unwind_plan_sp.get() == m_fallback_unwind_plan_sp.get() || @@ -2067,7 +2067,7 @@ va_start(args, fmt); char *logmsg; - if (vasprintf(&logmsg, fmt, args) == -1 || logmsg == NULL) { + if (vasprintf(&logmsg, fmt, args) == -1 || logmsg == nullptr) { if (logmsg) free(logmsg); va_end(args); @@ -2088,7 +2088,7 @@ va_start(args, fmt); char *logmsg; - if (vasprintf(&logmsg, fmt, args) == -1 || logmsg == NULL) { + if (vasprintf(&logmsg, fmt, args) == -1 || logmsg == nullptr) { if (logmsg) free(logmsg); va_end(args); Index: source/Plugins/Process/Utility/RegisterContextLinux_i386.cpp =================================================================== --- source/Plugins/Process/Utility/RegisterContextLinux_i386.cpp +++ source/Plugins/Process/Utility/RegisterContextLinux_i386.cpp @@ -90,8 +90,8 @@ const ArchSpec &target_arch) : RegisterInfoInterface(target_arch) { RegisterInfo orig_ax = {"orig_eax", - NULL, - sizeof(((GPR *)NULL)->orig_eax), + nullptr, + sizeof(((GPR *)nullptr)->orig_eax), (LLVM_EXTENSION offsetof(GPR, orig_eax)), eEncodingUint, eFormatHex, @@ -114,7 +114,7 @@ return g_register_infos_i386; default: assert(false && "Unhandled target architecture."); - return NULL; + return nullptr; } } Index: source/Plugins/Process/Utility/RegisterContextLinux_mips.cpp =================================================================== --- source/Plugins/Process/Utility/RegisterContextLinux_mips.cpp +++ source/Plugins/Process/Utility/RegisterContextLinux_mips.cpp @@ -116,7 +116,7 @@ return g_register_infos_mips; default: assert(false && "Unhandled target architecture."); - return NULL; + return nullptr; } } Index: source/Plugins/Process/Utility/RegisterContextLinux_x86_64.cpp =================================================================== --- source/Plugins/Process/Utility/RegisterContextLinux_x86_64.cpp +++ source/Plugins/Process/Utility/RegisterContextLinux_x86_64.cpp @@ -157,8 +157,8 @@ m_register_info_count(GetRegisterInfoCount(target_arch)), m_user_register_count(GetUserRegisterInfoCount(target_arch)) { RegisterInfo orig_ax = {"orig_rax", - NULL, - sizeof(((GPR *)NULL)->orig_rax), + nullptr, + sizeof(((GPR *)nullptr)->orig_rax), (LLVM_EXTENSION offsetof(GPR, orig_rax)), eEncodingUint, eFormatHex, Index: source/Plugins/Process/Utility/RegisterContextOpenBSD_i386.cpp =================================================================== --- source/Plugins/Process/Utility/RegisterContextOpenBSD_i386.cpp +++ source/Plugins/Process/Utility/RegisterContextOpenBSD_i386.cpp @@ -67,7 +67,7 @@ return g_register_infos_i386; default: assert(false && "Unhandled target architecture."); - return NULL; + return nullptr; } } Index: source/Plugins/Process/Utility/RegisterContextPOSIX_arm.cpp =================================================================== --- source/Plugins/Process/Utility/RegisterContextPOSIX_arm.cpp +++ source/Plugins/Process/Utility/RegisterContextPOSIX_arm.cpp @@ -146,7 +146,7 @@ if (reg < m_reg_info.num_registers) return &GetRegisterInfo()[reg]; else - return NULL; + return nullptr; } size_t RegisterContextPOSIX_arm::GetRegisterSetCount() { @@ -167,10 +167,10 @@ return &g_reg_sets_arm[set]; default: assert(false && "Unhandled target architecture."); - return NULL; + return nullptr; } } - return NULL; + return nullptr; } const char *RegisterContextPOSIX_arm::GetRegisterName(unsigned reg) { Index: source/Plugins/Process/Utility/RegisterContextPOSIX_arm64.cpp =================================================================== --- source/Plugins/Process/Utility/RegisterContextPOSIX_arm64.cpp +++ source/Plugins/Process/Utility/RegisterContextPOSIX_arm64.cpp @@ -166,7 +166,7 @@ if (reg < m_reg_info.num_registers) return &GetRegisterInfo()[reg]; else - return NULL; + return nullptr; } size_t RegisterContextPOSIX_arm64::GetRegisterSetCount() { @@ -187,10 +187,10 @@ return &g_reg_sets_arm64[set]; default: assert(false && "Unhandled target architecture."); - return NULL; + return nullptr; } } - return NULL; + return nullptr; } const char *RegisterContextPOSIX_arm64::GetRegisterName(unsigned reg) { Index: source/Plugins/Process/Utility/RegisterContextPOSIX_mips64.cpp =================================================================== --- source/Plugins/Process/Utility/RegisterContextPOSIX_mips64.cpp +++ source/Plugins/Process/Utility/RegisterContextPOSIX_mips64.cpp @@ -96,7 +96,7 @@ if (reg < m_num_registers) return &GetRegisterInfo()[reg]; else - return NULL; + return nullptr; } size_t RegisterContextPOSIX_mips64::GetRegisterSetCount() { Index: source/Plugins/Process/Utility/RegisterContextPOSIX_powerpc.cpp =================================================================== --- source/Plugins/Process/Utility/RegisterContextPOSIX_powerpc.cpp +++ source/Plugins/Process/Utility/RegisterContextPOSIX_powerpc.cpp @@ -133,7 +133,7 @@ if (reg < k_num_registers_powerpc) return &GetRegisterInfo()[reg]; else - return NULL; + return nullptr; } size_t RegisterContextPOSIX_powerpc::GetRegisterSetCount() { @@ -150,7 +150,7 @@ if (IsRegisterSetAvailable(set)) return &g_reg_sets_powerpc[set]; else - return NULL; + return nullptr; } const char *RegisterContextPOSIX_powerpc::GetRegisterName(unsigned reg) { Index: source/Plugins/Process/Utility/RegisterContextPOSIX_ppc64le.cpp =================================================================== --- source/Plugins/Process/Utility/RegisterContextPOSIX_ppc64le.cpp +++ source/Plugins/Process/Utility/RegisterContextPOSIX_ppc64le.cpp @@ -151,7 +151,7 @@ if (reg < k_num_registers_ppc64le) return &GetRegisterInfo()[reg]; else - return NULL; + return nullptr; } size_t RegisterContextPOSIX_ppc64le::GetRegisterSetCount() { @@ -168,7 +168,7 @@ if (IsRegisterSetAvailable(set)) return &g_reg_sets_ppc64le[set]; else - return NULL; + return nullptr; } const char *RegisterContextPOSIX_ppc64le::GetRegisterName(unsigned reg) { Index: source/Plugins/Process/Utility/RegisterContextPOSIX_s390x.cpp =================================================================== --- source/Plugins/Process/Utility/RegisterContextPOSIX_s390x.cpp +++ source/Plugins/Process/Utility/RegisterContextPOSIX_s390x.cpp @@ -113,7 +113,7 @@ if (reg < m_reg_info.num_registers) return &GetRegisterInfo()[reg]; else - return NULL; + return nullptr; } size_t RegisterContextPOSIX_s390x::GetRegisterCount() { @@ -156,10 +156,10 @@ return &g_reg_sets_s390x[set]; default: assert(false && "Unhandled target architecture."); - return NULL; + return nullptr; } } - return NULL; + return nullptr; } lldb::ByteOrder RegisterContextPOSIX_s390x::GetByteOrder() { Index: source/Plugins/Process/Utility/RegisterContextPOSIX_x86.cpp =================================================================== --- source/Plugins/Process/Utility/RegisterContextPOSIX_x86.cpp +++ source/Plugins/Process/Utility/RegisterContextPOSIX_x86.cpp @@ -423,7 +423,7 @@ if (reg < m_reg_info.num_registers) return &GetRegisterInfo()[reg]; else - return NULL; + return nullptr; } size_t RegisterContextPOSIX_x86::GetRegisterSetCount() { @@ -445,10 +445,10 @@ return &g_reg_sets_x86_64[set]; default: assert(false && "Unhandled target architecture."); - return NULL; + return nullptr; } } - return NULL; + return nullptr; } const char *RegisterContextPOSIX_x86::GetRegisterName(unsigned reg) { Index: source/Plugins/Process/Utility/RegisterContextThreadMemory.cpp =================================================================== --- source/Plugins/Process/Utility/RegisterContextThreadMemory.cpp +++ source/Plugins/Process/Utility/RegisterContextThreadMemory.cpp @@ -73,7 +73,7 @@ UpdateRegisterContext(); if (m_reg_ctx_sp) return m_reg_ctx_sp->GetRegisterInfoAtIndex(reg); - return NULL; + return nullptr; } size_t RegisterContextThreadMemory::GetRegisterSetCount() { @@ -87,7 +87,7 @@ UpdateRegisterContext(); if (m_reg_ctx_sp) return m_reg_ctx_sp->GetRegisterSet(reg_set); - return NULL; + return nullptr; } bool RegisterContextThreadMemory::ReadRegister(const RegisterInfo *reg_info, Index: source/Plugins/Process/Utility/RegisterInfoPOSIX_arm.cpp =================================================================== --- source/Plugins/Process/Utility/RegisterInfoPOSIX_arm.cpp +++ source/Plugins/Process/Utility/RegisterInfoPOSIX_arm.cpp @@ -55,7 +55,7 @@ return g_register_infos_arm; default: assert(false && "Unhandled target architecture."); - return NULL; + return nullptr; } } Index: source/Plugins/Process/Utility/RegisterInfoPOSIX_arm64.cpp =================================================================== --- source/Plugins/Process/Utility/RegisterInfoPOSIX_arm64.cpp +++ source/Plugins/Process/Utility/RegisterInfoPOSIX_arm64.cpp @@ -60,7 +60,7 @@ return g_register_infos_arm64_le; default: assert(false && "Unhandled target architecture."); - return NULL; + return nullptr; } } Index: source/Plugins/Process/Utility/RegisterInfoPOSIX_ppc64le.cpp =================================================================== --- source/Plugins/Process/Utility/RegisterInfoPOSIX_ppc64le.cpp +++ source/Plugins/Process/Utility/RegisterInfoPOSIX_ppc64le.cpp @@ -27,7 +27,7 @@ return g_register_infos_ppc64le; default: assert(false && "Unhandled target architecture."); - return NULL; + return nullptr; } } Index: source/Plugins/Process/Utility/StopInfoMachException.cpp =================================================================== --- source/Plugins/Process/Utility/StopInfoMachException.cpp +++ source/Plugins/Process/Utility/StopInfoMachException.cpp @@ -37,11 +37,11 @@ target ? target->GetArchitecture().GetMachine() : llvm::Triple::UnknownArch; - const char *exc_desc = NULL; + const char *exc_desc = nullptr; const char *code_label = "code"; - const char *code_desc = NULL; + const char *code_desc = nullptr; const char *subcode_label = "subcode"; - const char *subcode_desc = NULL; + const char *subcode_desc = nullptr; #if defined(__APPLE__) char code_desc_buf[32]; @@ -593,7 +593,7 @@ // the thread ID so we must always report the breakpoint regardless // of the thread. if (bp_site_sp->ValidForThisThread(&thread) || - thread.GetProcess()->GetOperatingSystem() != NULL) + thread.GetProcess()->GetOperatingSystem() != nullptr) return StopInfo::CreateStopReasonWithBreakpointSiteID( thread, bp_site_sp->GetID()); else if (is_trace_if_actual_breakpoint_missing) Index: source/Plugins/Process/Utility/UnwindLLDB.cpp =================================================================== --- source/Plugins/Process/Utility/UnwindLLDB.cpp +++ source/Plugins/Process/Utility/UnwindLLDB.cpp @@ -50,7 +50,7 @@ return 0; ProcessSP process_sp(m_thread.GetProcess()); - ABI *abi = process_sp ? process_sp->GetABI().get() : NULL; + ABI *abi = process_sp ? process_sp->GetABI().get() : nullptr; while (AddOneMoreFrame(abi)) { #if DEBUG_FRAME_SPEED @@ -73,13 +73,13 @@ return true; ProcessSP process_sp(m_thread.GetProcess()); - ABI *abi = process_sp ? process_sp->GetABI().get() : NULL; + ABI *abi = process_sp ? process_sp->GetABI().get() : nullptr; // First, set up the 0th (initial) frame CursorSP first_cursor_sp(new Cursor()); RegisterContextLLDBSP reg_ctx_sp(new RegisterContextLLDB( m_thread, RegisterContextLLDBSP(), first_cursor_sp->sctx, 0, *this)); - if (reg_ctx_sp.get() == NULL) + if (reg_ctx_sp.get() == nullptr) goto unwind_done; if (!reg_ctx_sp->IsValid()) @@ -147,7 +147,7 @@ return nullptr; } - if (reg_ctx_sp.get() == NULL) { + if (reg_ctx_sp.get() == nullptr) { // If the RegisterContextLLDB has a fallback UnwindPlan, it will switch to // that and return true. Subsequent calls to TryFallbackUnwindPlan() will // return false. @@ -402,7 +402,7 @@ } ProcessSP process_sp(m_thread.GetProcess()); - ABI *abi = process_sp ? process_sp->GetABI().get() : NULL; + ABI *abi = process_sp ? process_sp->GetABI().get() : nullptr; while (idx >= m_frames.size() && AddOneMoreFrame(abi)) ; @@ -430,7 +430,7 @@ } ProcessSP process_sp(m_thread.GetProcess()); - ABI *abi = process_sp ? process_sp->GetABI().get() : NULL; + ABI *abi = process_sp ? process_sp->GetABI().get() : nullptr; while (idx >= m_frames.size()) { if (!AddOneMoreFrame(abi)) Index: source/Plugins/Process/Utility/UnwindMacOSXFrameBackchain.cpp =================================================================== --- source/Plugins/Process/Utility/UnwindMacOSXFrameBackchain.cpp +++ source/Plugins/Process/Utility/UnwindMacOSXFrameBackchain.cpp @@ -79,7 +79,7 @@ StackFrame *first_frame = exe_ctx.GetFramePtr(); Process *process = exe_ctx.GetProcessPtr(); - if (process == NULL) + if (process == nullptr) return 0; struct Frame_i386 { @@ -121,7 +121,7 @@ SymbolContext first_frame_sc( first_frame->GetSymbolContext(resolve_scope)); - const AddressRange *addr_range_ptr = NULL; + const AddressRange *addr_range_ptr = nullptr; AddressRange range; if (first_frame_sc.function) addr_range_ptr = &first_frame_sc.function->GetAddressRange(); @@ -169,7 +169,7 @@ m_cursors.clear(); Process *process = exe_ctx.GetProcessPtr(); - if (process == NULL) + if (process == nullptr) return 0; StackFrame *first_frame = exe_ctx.GetFramePtr(); @@ -212,7 +212,7 @@ SymbolContext first_frame_sc( first_frame->GetSymbolContext(resolve_scope)); - const AddressRange *addr_range_ptr = NULL; + const AddressRange *addr_range_ptr = nullptr; AddressRange range; if (first_frame_sc.function) addr_range_ptr = &first_frame_sc.function->GetAddressRange(); Index: source/Plugins/Process/elf-core/ProcessElfCore.cpp =================================================================== --- source/Plugins/Process/elf-core/ProcessElfCore.cpp +++ source/Plugins/Process/elf-core/ProcessElfCore.cpp @@ -80,7 +80,7 @@ if (!m_core_module_sp && FileSystem::Instance().Exists(m_core_file)) { ModuleSpec core_module_spec(m_core_file, target_sp->GetArchitecture()); Status error(ModuleList::GetSharedModule(core_module_spec, m_core_module_sp, - NULL, NULL, NULL)); + nullptr, nullptr, nullptr)); if (m_core_module_sp) { ObjectFile *core_objfile = m_core_module_sp->GetObjectFile(); if (core_objfile && core_objfile->GetType() == ObjectFile::eTypeCoreFile) @@ -149,7 +149,7 @@ } ObjectFileELF *core = (ObjectFileELF *)(m_core_module_sp->GetObjectFile()); - if (core == NULL) { + if (core == nullptr) { error.SetErrorString("invalid core object file"); return error; } @@ -247,7 +247,7 @@ } lldb_private::DynamicLoader *ProcessElfCore::GetDynamicLoader() { - if (m_dyld_up.get() == NULL) + if (m_dyld_up.get() == nullptr) m_dyld_up.reset(DynamicLoader::FindPlugin( this, DynamicLoaderPOSIXDYLD::GetPluginNameStatic().GetCString())); return m_dyld_up.get(); @@ -327,13 +327,13 @@ Status &error) { ObjectFile *core_objfile = m_core_module_sp->GetObjectFile(); - if (core_objfile == NULL) + if (core_objfile == nullptr) return 0; // Get the address range const VMRangeToFileOffset::Entry *address_range = m_core_aranges.FindEntryThatContains(addr); - if (address_range == NULL || address_range->GetRangeEnd() < addr) { + if (address_range == nullptr || address_range->GetRangeEnd() < addr) { error.SetErrorStringWithFormat("core file does not contain 0x%" PRIx64, addr); return 0; Index: source/Plugins/Process/elf-core/ThreadElfCore.h =================================================================== --- source/Plugins/Process/elf-core/ThreadElfCore.h +++ source/Plugins/Process/elf-core/ThreadElfCore.h @@ -149,7 +149,7 @@ const char *GetName() override { if (m_thread_name.empty()) - return NULL; + return nullptr; return m_thread_name.c_str(); } Index: source/Plugins/Process/gdb-remote/GDBRemoteClientBase.cpp =================================================================== --- source/Plugins/Process/gdb-remote/GDBRemoteClientBase.cpp +++ source/Plugins/Process/gdb-remote/GDBRemoteClientBase.cpp @@ -285,7 +285,7 @@ void GDBRemoteClientBase::OnRunPacketSent(bool first) { if (first) - BroadcastEvent(eBroadcastBitRunPacketSent, NULL); + BroadcastEvent(eBroadcastBitRunPacketSent, nullptr); } /////////////////////////////////////// @@ -365,7 +365,7 @@ // packet. Let's interrupt it. const char ctrl_c = '\x03'; ConnectionStatus status = eConnectionStatusSuccess; - size_t bytes_written = m_comm.Write(&ctrl_c, 1, status, NULL); + size_t bytes_written = m_comm.Write(&ctrl_c, 1, status, nullptr); if (bytes_written == 0) { --m_comm.m_async_count; if (log) Index: source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp =================================================================== --- source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp +++ source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp @@ -98,7 +98,7 @@ Log *log(ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PACKETS)); ConnectionStatus status = eConnectionStatusSuccess; char ch = '+'; - const size_t bytes_written = Write(&ch, 1, status, NULL); + const size_t bytes_written = Write(&ch, 1, status, nullptr); if (log) log->Printf("<%4" PRIu64 "> send packet: %c", (uint64_t)bytes_written, ch); m_history.AddPacket(ch, GDBRemoteCommunicationHistory::ePacketTypeSend, @@ -110,7 +110,7 @@ Log *log(ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PACKETS)); ConnectionStatus status = eConnectionStatusSuccess; char ch = '-'; - const size_t bytes_written = Write(&ch, 1, status, NULL); + const size_t bytes_written = Write(&ch, 1, status, nullptr); if (log) log->Printf("<%4" PRIu64 "> send packet: %c", (uint64_t)bytes_written, ch); m_history.AddPacket(ch, GDBRemoteCommunicationHistory::ePacketTypeSend, @@ -138,7 +138,7 @@ ConnectionStatus status = eConnectionStatusSuccess; const char *packet_data = packet.data(); const size_t packet_length = packet.size(); - size_t bytes_written = Write(packet_data, packet_length, status, NULL); + size_t bytes_written = Write(packet_data, packet_length, status, nullptr); if (log) { size_t binary_start_offset = 0; if (strncmp(packet_data, "$vFile:pwrite:", strlen("$vFile:pwrite:")) == @@ -274,7 +274,7 @@ Log *log(ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PACKETS)); // Check for a packet from our cache first without trying any reading... - if (CheckForPacket(NULL, 0, packet) != PacketType::Invalid) + if (CheckForPacket(nullptr, 0, packet) != PacketType::Invalid) return PacketResult::Success; bool timed_out = false; @@ -470,7 +470,7 @@ content_length = hash_mark_idx - content_start; std::string bufsize_str(m_bytes.data() + 2, i - 2 - 1); errno = 0; - decompressed_bufsize = ::strtoul(bufsize_str.c_str(), NULL, 10); + decompressed_bufsize = ::strtoul(bufsize_str.c_str(), nullptr, 10); if (errno != 0 || decompressed_bufsize == ULONG_MAX) { m_bytes.erase(0, size_of_first_packet); return false; @@ -483,7 +483,7 @@ packet_checksum_cstr[0] = m_bytes[checksum_idx]; packet_checksum_cstr[1] = m_bytes[checksum_idx + 1]; packet_checksum_cstr[2] = '\0'; - long packet_checksum = strtol(packet_checksum_cstr, NULL, 16); + long packet_checksum = strtol(packet_checksum_cstr, nullptr, 16); long actual_checksum = CalculcateChecksum( llvm::StringRef(m_bytes).substr(1, hash_mark_idx - 1)); @@ -848,7 +848,7 @@ ::isxdigit(m_bytes[checksum_idx + 1])) { if (GetSendAcks()) { const char *packet_checksum_cstr = &m_bytes[checksum_idx]; - char packet_checksum = strtol(packet_checksum_cstr, NULL, 16); + char packet_checksum = strtol(packet_checksum_cstr, nullptr, 16); char actual_checksum = CalculcateChecksum( llvm::StringRef(m_bytes).slice(content_start, content_end)); success = packet_checksum == actual_checksum; @@ -923,9 +923,9 @@ // Do the listen on another thread so we can continue on... if (connection->Connect(comm->m_listen_url.c_str(), &error) != eConnectionStatusSuccess) - comm->SetConnection(NULL); + comm->SetConnection(nullptr); } - return NULL; + return nullptr; } Status GDBRemoteCommunication::StartDebugserverProcess( Index: source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp =================================================================== --- source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp +++ source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp @@ -386,14 +386,14 @@ std::vector supported_compressions; compressions += sizeof("SupportedCompressions=") - 1; const char *end_of_compressions = strchr(compressions, ';'); - if (end_of_compressions == NULL) { + if (end_of_compressions == nullptr) { end_of_compressions = strchr(compressions, '\0'); } const char *current_compression = compressions; while (current_compression < end_of_compressions) { const char *next_compression_name = strchr(current_compression, ','); const char *end_of_this_word = next_compression_name; - if (next_compression_name == NULL || + if (next_compression_name == nullptr || end_of_compressions < next_compression_name) { end_of_this_word = end_of_compressions; } @@ -775,7 +775,7 @@ std::vector argv; FileSpec exe_file = launch_info.GetExecutableFile(); std::string exe_path; - const char *arg = NULL; + const char *arg = nullptr; const Args &launch_args = launch_info.GetArguments(); if (exe_file) exe_path = exe_file.GetPath(false); @@ -786,7 +786,7 @@ } if (!exe_path.empty()) { argv.push_back(exe_path.c_str()); - for (uint32_t i = 1; (arg = launch_args.GetArgumentAtIndex(i)) != NULL; + for (uint32_t i = 1; (arg = launch_args.GetArgumentAtIndex(i)) != nullptr; ++i) { if (arg) argv.push_back(arg); @@ -1094,7 +1094,7 @@ if (!m_gdb_server_name.empty()) return m_gdb_server_name.c_str(); } - return NULL; + return nullptr; } uint32_t GDBRemoteCommunicationClient::GetGDBServerProgramVersion() { Index: source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp =================================================================== --- source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp +++ source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp @@ -98,7 +98,7 @@ bool GDBRemoteRegisterContext::PrivateSetRegisterValue( uint32_t reg, llvm::ArrayRef data) { const RegisterInfo *reg_info = GetRegisterInfoAtIndex(reg); - if (reg_info == NULL) + if (reg_info == nullptr) return false; // Invalidate if needed @@ -122,7 +122,7 @@ bool GDBRemoteRegisterContext::PrivateSetRegisterValue(uint32_t reg, uint64_t new_reg_val) { const RegisterInfo *reg_info = GetRegisterInfoAtIndex(reg); - if (reg_info == NULL) + if (reg_info == nullptr) return false; // Early in process startup, we can get a thread that has an invalid byte @@ -148,7 +148,7 @@ uint8_t *dst = const_cast( m_reg_data.PeekData(reg_info->byte_offset, reg_info->byte_size)); - if (dst == NULL) + if (dst == nullptr) return false; if (data.CopyByteOrderedData(0, // src offset @@ -183,7 +183,7 @@ Process *process = exe_ctx.GetProcessPtr(); Thread *thread = exe_ctx.GetThreadPtr(); - if (process == NULL || thread == NULL) + if (process == nullptr || thread == nullptr) return false; GDBRemoteCommunicationClient &gdb_comm( @@ -228,7 +228,7 @@ // We have a valid primordial register as our constituent. Grab the // corresponding register info. const RegisterInfo *prim_reg_info = GetRegisterInfoAtIndex(prim_reg); - if (prim_reg_info == NULL) + if (prim_reg_info == nullptr) success = false; else { // Read the containing register if it hasn't already been read @@ -301,7 +301,7 @@ Process *process = exe_ctx.GetProcessPtr(); Thread *thread = exe_ctx.GetThreadPtr(); - if (process == NULL || thread == NULL) + if (process == nullptr || thread == nullptr) return false; GDBRemoteCommunicationClient &gdb_comm( @@ -319,7 +319,7 @@ uint8_t *dst = const_cast( m_reg_data.PeekData(reg_info->byte_offset, reg_info->byte_size)); - if (dst == NULL) + if (dst == nullptr) return false; if (data.CopyByteOrderedData(data_offset, // src offset @@ -361,7 +361,7 @@ // We have a valid primordial register as our constituent. Grab the // corresponding register info. const RegisterInfo *value_reg_info = GetRegisterInfoAtIndex(reg); - if (value_reg_info == NULL) + if (value_reg_info == nullptr) success = false; else success = SetPrimordialRegister(value_reg_info, gdb_comm); @@ -409,7 +409,7 @@ Process *process = exe_ctx.GetProcessPtr(); Thread *thread = exe_ctx.GetThreadPtr(); - if (process == NULL || thread == NULL) + if (process == nullptr || thread == nullptr) return false; GDBRemoteCommunicationClient &gdb_comm( @@ -434,7 +434,7 @@ Process *process = exe_ctx.GetProcessPtr(); Thread *thread = exe_ctx.GetThreadPtr(); - if (process == NULL || thread == NULL) + if (process == nullptr || thread == nullptr) return false; GDBRemoteCommunicationClient &gdb_comm( @@ -452,7 +452,7 @@ Process *process = exe_ctx.GetProcessPtr(); Thread *thread = exe_ctx.GetThreadPtr(); - if (process == NULL || thread == NULL) + if (process == nullptr || thread == nullptr) return false; GDBRemoteCommunicationClient &gdb_comm( @@ -474,7 +474,8 @@ // individually and store them as binary data in a buffer. const RegisterInfo *reg_info; - for (uint32_t i = 0; (reg_info = GetRegisterInfoAtIndex(i)) != NULL; i++) { + for (uint32_t i = 0; (reg_info = GetRegisterInfoAtIndex(i)) != nullptr; + i++) { if (reg_info ->value_regs) // skip registers that are slices of real registers continue; @@ -508,14 +509,14 @@ bool GDBRemoteRegisterContext::WriteAllRegisterValues( const lldb::DataBufferSP &data_sp) { - if (!data_sp || data_sp->GetBytes() == NULL || data_sp->GetByteSize() == 0) + if (!data_sp || data_sp->GetBytes() == nullptr || data_sp->GetByteSize() == 0) return false; ExecutionContext exe_ctx(CalculateThread()); Process *process = exe_ctx.GetProcessPtr(); Thread *thread = exe_ctx.GetThreadPtr(); - if (process == NULL || thread == NULL) + if (process == nullptr || thread == nullptr) return false; GDBRemoteCommunicationClient &gdb_comm( @@ -557,9 +558,9 @@ uint64_t size_by_highest_offset = 0; for (uint32_t reg_idx = 0; - (reg_info = GetRegisterInfoAtIndex(reg_idx)) != NULL; ++reg_idx) { + (reg_info = GetRegisterInfoAtIndex(reg_idx)) != nullptr; ++reg_idx) { size_including_slice_registers += reg_info->byte_size; - if (reg_info->value_regs == NULL) + if (reg_info->value_regs == nullptr) size_not_including_slice_registers += reg_info->byte_size; if (reg_info->byte_offset >= size_by_highest_offset) size_by_highest_offset = reg_info->byte_offset + reg_info->byte_size; @@ -591,7 +592,7 @@ // keep track of the size of each reg & compute offset based on that. uint32_t running_byte_offset = 0; for (uint32_t reg_idx = 0; - (reg_info = GetRegisterInfoAtIndex(reg_idx)) != NULL; + (reg_info = GetRegisterInfoAtIndex(reg_idx)) != nullptr; ++reg_idx, running_byte_offset += reg_info->byte_size) { // Skip composite aka slice registers (e.g. eax is a slice of rax). if (reg_info->value_regs) @@ -637,7 +638,7 @@ } uint32_t num_restored = 0; const RegisterInfo *reg_info; - for (uint32_t i = 0; (reg_info = GetRegisterInfoAtIndex(i)) != NULL; + for (uint32_t i = 0; (reg_info = GetRegisterInfoAtIndex(i)) != nullptr; i++) { if (reg_info->value_regs) // skip registers that are slices of real // registers Index: source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp =================================================================== --- source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp +++ source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp @@ -114,12 +114,12 @@ {"packet-timeout", OptionValue::eTypeUInt64, true, 5 #if defined(__has_feature) #if __has_feature(address_sanitizer) - * 2 + * 2 #endif #endif - , NULL, {}, + , nullptr, {}, "Specify the default packet timeout in seconds."}, - {"target-definition-file", OptionValue::eTypeFileSpec, true, 0, NULL, {}, + {"target-definition-file", OptionValue::eTypeFileSpec, true, 0, nullptr, {}, "The file that provides the description for remote target registers."}}; enum { ePropertyPacketTimeout, ePropertyTargetDefinitionFile }; @@ -140,17 +140,17 @@ uint64_t GetPacketTimeout() { const uint32_t idx = ePropertyPacketTimeout; return m_collection_sp->GetPropertyAtIndexAsUInt64( - NULL, idx, g_properties[idx].default_uint_value); + nullptr, idx, g_properties[idx].default_uint_value); } bool SetPacketTimeout(uint64_t timeout) { const uint32_t idx = ePropertyPacketTimeout; - return m_collection_sp->SetPropertyAtIndexAsUInt64(NULL, idx, timeout); + return m_collection_sp->SetPropertyAtIndexAsUInt64(nullptr, idx, timeout); } FileSpec GetTargetDefinitionFile() const { const uint32_t idx = ePropertyTargetDefinitionFile; - return m_collection_sp->GetPropertyAtIndexAsFileSpec(NULL, idx); + return m_collection_sp->GetPropertyAtIndexAsFileSpec(nullptr, idx); } }; @@ -252,7 +252,7 @@ ListenerSP listener_sp, const FileSpec *crash_file_path) { lldb::ProcessSP process_sp; - if (crash_file_path == NULL) + if (crash_file_path == nullptr) process_sp = std::make_shared(target_sp, listener_sp); return process_sp; } @@ -294,7 +294,7 @@ : Process(target_sp, listener_sp), m_debugserver_pid(LLDB_INVALID_PROCESS_ID), m_last_stop_packet_mutex(), m_register_info(), - m_async_broadcaster(NULL, "lldb.process.gdb-remote.async-broadcaster"), + m_async_broadcaster(nullptr, "lldb.process.gdb-remote.async-broadcaster"), m_async_listener_sp( Listener::MakeListener("lldb.process.gdb-remote.async-listener")), m_async_thread_state_mutex(), m_thread_ids(), m_thread_pcs(), @@ -547,8 +547,8 @@ std::vector invalidate_regs; std::vector dwarf_opcode_bytes; RegisterInfo reg_info = { - NULL, // Name - NULL, // Alt name + nullptr, // Name + nullptr, // Alt name 0, // byte size reg_offset, // offset eEncodingUint, // encoding @@ -560,10 +560,10 @@ reg_num, // process plugin reg num reg_num // native register number }, - NULL, - NULL, - NULL, // Dwarf expression opcode bytes pointer - 0 // Dwarf expression opcode bytes length + nullptr, + nullptr, + nullptr, // Dwarf expression opcode bytes pointer + 0 // Dwarf expression opcode bytes length }; while (response.GetNameColonValue(name, value)) { @@ -583,7 +583,7 @@ reg_info.encoding = encoding; } else if (name.equals("format")) { Format format = eFormatInvalid; - if (OptionArgParser::ToFormat(value.str().c_str(), format, NULL) + if (OptionArgParser::ToFormat(value.str().c_str(), format, nullptr) .Success()) reg_info.format = format; else { @@ -888,8 +888,8 @@ // since 'O' packets can really slow down debugging if the inferior // does a lot of output. if ((!stdin_file_spec || !stdout_file_spec || !stderr_file_spec) && - pty.OpenFirstAvailableMaster(O_RDWR | O_NOCTTY, NULL, 0)) { - FileSpec slave_name{pty.GetSlaveName(NULL, 0)}; + pty.OpenFirstAvailableMaster(O_RDWR | O_NOCTTY, nullptr, 0)) { + FileSpec slave_name{pty.GetSlaveName(nullptr, 0)}; if (!stdin_file_spec) stdin_file_spec = slave_name; @@ -933,7 +933,7 @@ GetTarget().GetArchitecture().GetArchitectureName()); const char *launch_event_data = launch_info.GetLaunchEventData(); - if (launch_event_data != NULL && *launch_event_data != '\0') + if (launch_event_data != nullptr && *launch_event_data != '\0') m_gdb_comm.SendLaunchEventDataPacket(launch_event_data); if (working_dir) { @@ -1847,7 +1847,7 @@ gdb_thread->PrivateSetRegisterValue(pair.first, buffer_sp->GetData()); } - thread_sp->SetName(thread_name.empty() ? NULL : thread_name.c_str()); + thread_sp->SetName(thread_name.empty() ? nullptr : thread_name.c_str()); gdb_thread->SetThreadDispatchQAddr(thread_dispatch_qaddr); // Check if the GDB server was able to provide the queue name, kind and @@ -3126,7 +3126,7 @@ Status &error) { if (m_stdio_communication.IsConnected()) { ConnectionStatus status; - m_stdio_communication.Write(src, src_len, status, NULL); + m_stdio_communication.Write(src, src_len, status, nullptr); } else if (m_stdin_forward) { m_gdb_comm.SendStdinNotification(src, src_len); } @@ -3135,7 +3135,7 @@ Status ProcessGDBRemote::EnableBreakpointSite(BreakpointSite *bp_site) { Status error; - assert(bp_site != NULL); + assert(bp_site != nullptr); // Get logging info Log *log(ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_BREAKPOINTS)); @@ -3261,7 +3261,7 @@ Status ProcessGDBRemote::DisableBreakpointSite(BreakpointSite *bp_site) { Status error; - assert(bp_site != NULL); + assert(bp_site != nullptr); addr_t addr = bp_site->GetLoadAddress(); user_id_t site_id = bp_site->GetID(); Log *log(ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_BREAKPOINTS)); @@ -3672,9 +3672,9 @@ // Create a thread that watches our internal state and controls which // events make it to clients (into the DCProcess event queue). - m_async_thread = - ThreadLauncher::LaunchThread("", - ProcessGDBRemote::AsyncThread, this, NULL); + m_async_thread = ThreadLauncher::LaunchThread( + "", ProcessGDBRemote::AsyncThread, this, + nullptr); } else if (log) log->Printf("ProcessGDBRemote::%s () - Called when Async thread was " "already running.", @@ -3768,7 +3768,7 @@ ") got eBroadcastBitAsyncContinue: %s", __FUNCTION__, arg, process->GetID(), continue_cstr); - if (::strstr(continue_cstr, "vAttach") == NULL) + if (::strstr(continue_cstr, "vAttach") == nullptr) process->SetPrivateState(eStateRunning); StringExtractorGDBRemote response; @@ -3834,11 +3834,11 @@ // the "E87" error code from debugserver -- this indicates that // the process is not debuggable. Return a slightly more // helpful error message about why the attach failed. - if (::strstr(continue_cstr, "vAttach") != NULL && + if (::strstr(continue_cstr, "vAttach") != nullptr && response.GetError() == 0x87) { process->SetExitStatus(-1, "cannot attach to process due to " "System Integrity Protection"); - } else if (::strstr(continue_cstr, "vAttach") != NULL && + } else if (::strstr(continue_cstr, "vAttach") != nullptr && response.GetStatus().Fail()) { process->SetExitStatus(-1, response.GetStatus().AsCString()); } else { @@ -3913,7 +3913,7 @@ ") thread exiting...", __FUNCTION__, arg, process->GetID()); - return NULL; + return nullptr; } // uint32_t @@ -4009,7 +4009,7 @@ } } } - return m_thread_create_bp_sp.get() != NULL; + return m_thread_create_bp_sp.get() != nullptr; } bool ProcessGDBRemote::StopNoticingNewThreads() { @@ -4024,8 +4024,8 @@ } DynamicLoader *ProcessGDBRemote::GetDynamicLoader() { - if (m_dyld_up.get() == NULL) - m_dyld_up.reset(DynamicLoader::FindPlugin(this, NULL)); + if (m_dyld_up.get() == nullptr) + m_dyld_up.reset(DynamicLoader::FindPlugin(this, nullptr)); return m_dyld_up.get(); } @@ -4366,8 +4366,8 @@ bool encoding_set = false; bool format_set = false; RegisterInfo reg_info = { - NULL, // Name - NULL, // Alt name + nullptr, // Name + nullptr, // Alt name 0, // byte size reg_offset, // offset eEncodingUint, // encoding @@ -4379,10 +4379,10 @@ cur_reg_num, // process plugin reg num cur_reg_num // native register number }, - NULL, - NULL, - NULL, // Dwarf Expression opcode bytes pointer - 0 // Dwarf Expression opcode bytes length + nullptr, + nullptr, + nullptr, // Dwarf Expression opcode bytes pointer + 0 // Dwarf Expression opcode bytes length }; reg_node.ForEachAttribute([&target_info, &gdb_group, &gdb_type, @@ -4416,7 +4416,8 @@ } else if (name == "format") { format_set = true; Format format = eFormatInvalid; - if (OptionArgParser::ToFormat(value.data(), format, NULL).Success()) + if (OptionArgParser::ToFormat(value.data(), format, nullptr) + .Success()) reg_info.format = format; else if (value == "vector-sint8") reg_info.format = eFormatVectorOfSInt8; @@ -5133,7 +5134,7 @@ "Tests packet speeds of various sizes to determine " "the performance characteristics of the GDB remote " "connection. ", - NULL), + nullptr), m_option_group(), m_num_packets(LLDB_OPT_SET_1, false, "count", 'c', 0, eArgTypeCount, "The number of packets to send of each varying size " @@ -5207,7 +5208,7 @@ public: CommandObjectProcessGDBRemotePacketHistory(CommandInterpreter &interpreter) : CommandObjectParsed(interpreter, "process plugin packet history", - "Dumps the packet history buffer. ", NULL) {} + "Dumps the packet history buffer. ", nullptr) {} ~CommandObjectProcessGDBRemotePacketHistory() override {} @@ -5238,7 +5239,7 @@ : CommandObjectParsed( interpreter, "process plugin packet xfer-size", "Maximum size that lldb will try to read/write one one chunk.", - NULL) {} + nullptr) {} ~CommandObjectProcessGDBRemotePacketXferSize() override {} @@ -5258,7 +5259,7 @@ if (process) { const char *packet_size = command.GetArgumentAtIndex(0); errno = 0; - uint64_t user_specified_max = strtoul(packet_size, NULL, 10); + uint64_t user_specified_max = strtoul(packet_size, nullptr, 10); if (errno == 0 && user_specified_max != 0) { process->SetUserSpecifiedMaxMemoryTransferSize(user_specified_max); result.SetStatus(eReturnStatusSuccessFinishResult); @@ -5280,7 +5281,7 @@ "The packet header and footer will automatically " "be added to the packet prior to sending and " "stripped from the result.", - NULL) {} + nullptr) {} ~CommandObjectProcessGDBRemotePacketSend() override {} @@ -5308,7 +5309,7 @@ output_strm.Printf(" packet: %s\n", packet_cstr); std::string &response_str = response.GetStringRef(); - if (strstr(packet_cstr, "qGetProfileData") != NULL) { + if (strstr(packet_cstr, "qGetProfileData") != nullptr) { response_str = process->HarmonizeThreadIdsForProfileData(response); } @@ -5376,7 +5377,7 @@ CommandObjectProcessGDBRemotePacket(CommandInterpreter &interpreter) : CommandObjectMultiword(interpreter, "process plugin packet", "Commands that deal with GDB remote packets.", - NULL) { + nullptr) { LoadSubCommand( "history", CommandObjectSP( Index: source/Plugins/Process/mach-core/ProcessMachCore.cpp =================================================================== --- source/Plugins/Process/mach-core/ProcessMachCore.cpp +++ source/Plugins/Process/mach-core/ProcessMachCore.cpp @@ -93,7 +93,7 @@ // ModuleSpecList::FindMatchingModuleSpec enforces a strict arch mach. ModuleSpec core_module_spec(m_core_file); Status error(ModuleList::GetSharedModule(core_module_spec, m_core_module_sp, - NULL, NULL, NULL)); + nullptr, nullptr, nullptr)); if (m_core_module_sp) { ObjectFile *core_objfile = m_core_module_sp->GetObjectFile(); @@ -196,7 +196,7 @@ } ObjectFile *core_objfile = m_core_module_sp->GetObjectFile(); - if (core_objfile == NULL) { + if (core_objfile == nullptr) { error.SetErrorString("invalid core object file"); return error; } @@ -209,7 +209,7 @@ } SectionList *section_list = core_objfile->GetSectionList(); - if (section_list == NULL) { + if (section_list == nullptr) { error.SetErrorString("core file has no sections"); return error; } @@ -308,7 +308,7 @@ size_t p = corefile_identifier.find("stext=") + strlen("stext="); if (corefile_identifier[p] == '0' && corefile_identifier[p + 1] == 'x') { errno = 0; - addr = ::strtoul(corefile_identifier.c_str() + p, NULL, 16); + addr = ::strtoul(corefile_identifier.c_str() + p, nullptr, 16); if (errno != 0 || addr == 0) addr = LLDB_INVALID_ADDRESS; } @@ -447,10 +447,10 @@ } lldb_private::DynamicLoader *ProcessMachCore::GetDynamicLoader() { - if (m_dyld_up.get() == NULL) + if (m_dyld_up.get() == nullptr) m_dyld_up.reset(DynamicLoader::FindPlugin( - this, - m_dyld_plugin_name.IsEmpty() ? NULL : m_dyld_plugin_name.GetCString())); + this, m_dyld_plugin_name.IsEmpty() ? nullptr + : m_dyld_plugin_name.GetCString())); return m_dyld_up.get(); } Index: source/Plugins/Process/minidump/ProcessMinidump.cpp =================================================================== --- source/Plugins/Process/minidump/ProcessMinidump.cpp +++ source/Plugins/Process/minidump/ProcessMinidump.cpp @@ -600,10 +600,9 @@ return DumpFacebook() || m_fb_logcat.GetOptionValue().GetCurrentValue(); } public: - CommandObjectProcessMinidumpDump(CommandInterpreter &interpreter) : CommandObjectParsed(interpreter, "process plugin dump", - "Dump information from the minidump file.", NULL), + "Dump information from the minidump file.", nullptr), m_option_group(), INIT_BOOL(m_dump_all, "all", 'a', "Dump the everything in the minidump."), Index: source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp =================================================================== --- source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp +++ source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp @@ -1943,7 +1943,7 @@ Locker py_lock(this, Locker::AcquireLock | Locker::InitSession | Locker::NoSTDIN); should_step = LLDBSWIGPythonCallThreadPlan( - generic->GetValue(), "should_step", NULL, script_error); + generic->GetValue(), "should_step", nullptr, script_error); if (script_error) should_step = true; } Index: source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp =================================================================== --- source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp +++ source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp @@ -185,7 +185,7 @@ SymbolFileDWARF *dwarf = die.GetDWARF(); TypeSP type_sp(new Type( die.GetID(), dwarf, dwo_type_sp->GetName(), dwo_type_sp->GetByteSize(), - NULL, LLDB_INVALID_UID, Type::eEncodingInvalid, + nullptr, LLDB_INVALID_UID, Type::eEncodingInvalid, &dwo_type_sp->GetDeclaration(), type, Type::eResolveStateForward)); dwarf->GetTypeList()->Insert(type_sp); @@ -461,7 +461,7 @@ sc.comp_unit->GetLanguage() == eLanguageTypeObjC_plus_plus); if (translation_unit_is_objc) { - if (type_name_cstr != NULL) { + if (type_name_cstr != nullptr) { static ConstString g_objc_type_name_id("id"); static ConstString g_objc_type_name_Class("Class"); static ConstString g_objc_type_name_selector("SEL"); @@ -1907,7 +1907,7 @@ m_property_setter_name(property_setter_name), m_property_getter_name(property_getter_name), m_property_attributes(property_attributes) { - if (metadata != NULL) { + if (metadata != nullptr) { m_metadata_up.reset(new ClangASTMetadata()); *m_metadata_up = *metadata; } @@ -2442,7 +2442,7 @@ DWARFAttributes attributes; const size_t num_child_attributes = die.GetAttributes(attributes); if (num_child_attributes > 0) { - const char *name = NULL; + const char *name = nullptr; bool got_value = false; int64_t enum_value = 0; Declaration decl; @@ -2545,8 +2545,8 @@ Function *DWARFASTParserClang::ParseFunctionFromDWARF(CompileUnit &comp_unit, const DWARFDIE &die) { DWARFRangeList func_ranges; - const char *name = NULL; - const char *mangled = NULL; + const char *name = nullptr; + const char *mangled = nullptr; int decl_file = 0; int decl_line = 0; int decl_column = 0; @@ -2558,7 +2558,7 @@ const dw_tag_t tag = die.Tag(); if (tag != DW_TAG_subprogram) - return NULL; + return nullptr; if (die.GetDIENamesAndRanges(name, mangled, func_ranges, decl_file, decl_line, decl_column, call_file, call_line, call_column, @@ -2633,7 +2633,7 @@ // Supply the type _only_ if it has already been parsed Type *func_type = dwarf->GetDIEToType().lookup(die.GetDIE()); - assert(func_type == NULL || func_type != DIE_IS_BEING_PARSED); + assert(func_type == nullptr || func_type != DIE_IS_BEING_PARSED); if (dwarf->FixupAddress(func_range.GetBaseAddress())) { const user_id_t func_user_id = die.GetID(); @@ -2643,7 +2643,7 @@ func_user_id, func_name, func_type, func_range); // first address range - if (func_sp.get() != NULL) { + if (func_sp.get() != nullptr) { if (frame_base.IsValid()) func_sp->GetFrameBaseExpression() = frame_base; comp_unit.AddFunction(func_sp); @@ -2652,7 +2652,7 @@ } } } - return NULL; + return nullptr; } bool DWARFASTParserClang::ParseChildMembers( @@ -2693,10 +2693,10 @@ if (num_attributes > 0) { Declaration decl; // DWARFExpression location; - const char *name = NULL; - const char *prop_name = NULL; - const char *prop_getter_name = NULL; - const char *prop_setter_name = NULL; + const char *name = nullptr; + const char *prop_name = nullptr; + const char *prop_getter_name = nullptr; + const char *prop_setter_name = nullptr; uint32_t prop_attributes = 0; bool is_artificial = false; @@ -2758,7 +2758,8 @@ module_sp, debug_info_data, die.GetCU(), block_offset, block_length, eRegisterKindDWARF, &initialValue, nullptr, memberOffset, nullptr)) { - member_byte_offset = memberOffset.ResolveValue(NULL).UInt(); + member_byte_offset = + memberOffset.ResolveValue(nullptr).UInt(); } } else { // With DWARF 3 and later, if the value is an integer constant, @@ -2874,7 +2875,7 @@ if (!is_artificial) { Type *member_type = die.ResolveTypeUID(DIERef(encoding_form)); - clang::FieldDecl *field_decl = NULL; + clang::FieldDecl *field_decl = nullptr; if (tag == DW_TAG_member) { if (member_type) { if (accessibility == eAccessNone) @@ -3133,12 +3134,12 @@ } } - if (prop_name != NULL && member_type) { - clang::ObjCIvarDecl *ivar_decl = NULL; + if (prop_name != nullptr && member_type) { + clang::ObjCIvarDecl *ivar_decl = nullptr; if (field_decl) { ivar_decl = clang::dyn_cast(field_decl); - assert(ivar_decl != NULL); + assert(ivar_decl != nullptr); } ClangASTMetadata metadata; @@ -3209,7 +3210,8 @@ block_offset, block_length, eRegisterKindDWARF, &initialValue, nullptr, memberOffset, nullptr)) { - member_byte_offset = memberOffset.ResolveValue(NULL).UInt(); + member_byte_offset = + memberOffset.ResolveValue(nullptr).UInt(); } } else { // With DWARF 3 and later, if the value is an integer constant, @@ -3237,7 +3239,7 @@ } Type *base_class_type = die.ResolveTypeUID(DIERef(encoding_form)); - if (base_class_type == NULL) { + if (base_class_type == nullptr) { module_sp->ReportError("0x%8.8x: DW_TAG_inheritance failed to " "resolve the base class at 0x%8.8x" " from enclosing type 0x%8.8x. \nPlease file " @@ -3314,7 +3316,7 @@ DWARFAttributes attributes; const size_t num_attributes = die.GetAttributes(attributes); if (num_attributes > 0) { - const char *name = NULL; + const char *name = nullptr; Declaration decl; DWARFFormValue param_type_die_form; bool is_artificial = false; @@ -3371,7 +3373,7 @@ // Often times compilers omit the "this" name for the // specification DIEs, so we can't rely upon the name being in // the formal parameter DIE... - (name == NULL || ::strcmp(name, "this") == 0)) { + (name == nullptr || ::strcmp(name, "this") == 0)) { Type *this_type = die.ResolveTypeUID(DIERef(param_type_die_form)); if (this_type) { uint32_t encoding_mask = this_type->GetEncodingMask(); Index: source/Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.cpp =================================================================== --- source/Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.cpp +++ source/Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.cpp @@ -66,7 +66,7 @@ if (idx < m_decls.size()) return &m_decls[idx]; } - return NULL; + return nullptr; } @@ -137,7 +137,7 @@ if (pos != m_abbrevCollMap.end()) return &(pos->second); - return NULL; + return nullptr; } // DWARFDebugAbbrev::GetUnsupportedForms() Index: source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.cpp =================================================================== --- source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.cpp +++ source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.cpp @@ -68,7 +68,7 @@ } void DWARFDebugAranges::Dump(Log *log) const { - if (log == NULL) + if (log == nullptr) return; const size_t num_entries = m_aranges.GetSize(); Index: source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h =================================================================== --- source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h +++ source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h @@ -41,8 +41,8 @@ size_t GetNumUnits(); DWARFUnit *GetUnitAtIndex(lldb::user_id_t idx); - DWARFUnit *GetUnitAtOffset(DIERef::Section section, - dw_offset_t cu_offset, uint32_t *idx_ptr = NULL); + DWARFUnit *GetUnitAtOffset(DIERef::Section section, dw_offset_t cu_offset, + uint32_t *idx_ptr = nullptr); DWARFUnit *GetUnitContainingDIEOffset(DIERef::Section section, dw_offset_t die_offset); DWARFUnit *GetUnit(const DIERef &die_ref); Index: source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp =================================================================== --- source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp +++ source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp @@ -30,7 +30,7 @@ // Constructor DWARFDebugInfo::DWARFDebugInfo(lldb_private::DWARFContext &context) - : m_dwarf2Data(NULL), m_context(context), m_units(), m_cu_aranges_up() {} + : m_dwarf2Data(nullptr), m_context(context), m_units(), m_cu_aranges_up() {} // SetDwarfData void DWARFDebugInfo::SetDwarfData(SymbolFileDWARF *dwarf2Data) { @@ -114,7 +114,7 @@ } DWARFUnit *DWARFDebugInfo::GetUnitAtIndex(user_id_t idx) { - DWARFUnit *cu = NULL; + DWARFUnit *cu = nullptr; if (idx < GetNumUnits()) cu = m_units[idx].get(); return cu; Index: source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h =================================================================== --- source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h +++ source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h @@ -143,12 +143,11 @@ lldb::offset_t *offset_ptr, lldb_private::Stream &s, dw_attr_t attr, DWARFFormValue &form_value); - bool - GetDIENamesAndRanges(const DWARFUnit *cu, const char *&name, - const char *&mangled, DWARFRangeList &rangeList, - int &decl_file, int &decl_line, int &decl_column, - int &call_file, int &call_line, int &call_column, - lldb_private::DWARFExpression *frame_base = NULL) const; + bool GetDIENamesAndRanges( + const DWARFUnit *cu, const char *&name, const char *&mangled, + DWARFRangeList &rangeList, int &decl_file, int &decl_line, + int &decl_column, int &call_file, int &call_line, int &call_column, + lldb_private::DWARFExpression *frame_base = nullptr) const; const DWARFAbbreviationDeclaration * GetAbbreviationDeclarationPtr(const DWARFUnit *cu, @@ -167,27 +166,27 @@ // We know we are kept in a vector of contiguous entries, so we know // our parent will be some index behind "this". DWARFDebugInfoEntry *GetParent() { - return m_parent_idx > 0 ? this - m_parent_idx : NULL; + return m_parent_idx > 0 ? this - m_parent_idx : nullptr; } const DWARFDebugInfoEntry *GetParent() const { - return m_parent_idx > 0 ? this - m_parent_idx : NULL; + return m_parent_idx > 0 ? this - m_parent_idx : nullptr; } // We know we are kept in a vector of contiguous entries, so we know // our sibling will be some index after "this". DWARFDebugInfoEntry *GetSibling() { - return m_sibling_idx > 0 ? this + m_sibling_idx : NULL; + return m_sibling_idx > 0 ? this + m_sibling_idx : nullptr; } const DWARFDebugInfoEntry *GetSibling() const { - return m_sibling_idx > 0 ? this + m_sibling_idx : NULL; + return m_sibling_idx > 0 ? this + m_sibling_idx : nullptr; } // We know we are kept in a vector of contiguous entries, so we know // we don't need to store our child pointer, if we have a child it will // be the next entry in the list... DWARFDebugInfoEntry *GetFirstChild() { - return HasChildren() ? this + 1 : NULL; + return HasChildren() ? this + 1 : nullptr; } const DWARFDebugInfoEntry *GetFirstChild() const { - return HasChildren() ? this + 1 : NULL; + return HasChildren() ? this + 1 : nullptr; } std::vector GetDeclContextDIEs(DWARFUnit *cu) const; Index: source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp =================================================================== --- source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp +++ source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp @@ -51,7 +51,7 @@ const DWARFAbbreviationDeclaration *abbrevDecl = cu->GetAbbreviations()->GetAbbreviationDeclaration(m_abbr_idx); - if (abbrevDecl == NULL) { + if (abbrevDecl == nullptr) { cu->GetSymbolFileDWARF()->GetObjectFile()->GetModule()->ReportError( "{0x%8.8x}: invalid abbreviation code %u, please file a bug and " "attach the file at the start of this error message", @@ -451,13 +451,13 @@ } break; case DW_AT_name: - if (name == NULL) + if (name == nullptr) name = form_value.AsCString(); break; case DW_AT_MIPS_linkage_name: case DW_AT_linkage_name: - if (mangled == NULL) + if (mangled == nullptr) mangled = form_value.AsCString(); break; @@ -551,7 +551,7 @@ frame_base->SetLocationListSlide(lowest_range_pc - cu->GetBaseAddress()); } - if (ranges.IsEmpty() || name == NULL || mangled == NULL) { + if (ranges.IsEmpty() || name == nullptr || mangled == nullptr) { for (const DIERef &die_ref : die_refs) { if (die_ref.die_offset != DW_INVALID_OFFSET) { DWARFDIE die = dwarf2Data->GetDIE(die_ref); @@ -1223,7 +1223,7 @@ storage.append(name); } if (storage.empty()) - return NULL; + return nullptr; return storage.c_str(); } @@ -1385,13 +1385,14 @@ switch (m_tag) { case DW_TAG_compile_unit: // File case DW_TAG_partial_unit: // File - check_children = ((function_die != NULL) || (block_die != NULL)); + check_children = + ((function_die != nullptr) || (block_die != nullptr)); break; case DW_TAG_subprogram: // Function if (function_die) *function_die = this; - check_children = (block_die != NULL); + check_children = (block_die != nullptr); break; case DW_TAG_inlined_subroutine: // Inlined Function @@ -1411,9 +1412,9 @@ // Compile units may not have a valid high/low pc when there // are address gaps in subroutines so we must always search // if there is no valid high and low PC. - check_children = (m_tag == DW_TAG_compile_unit || - m_tag == DW_TAG_partial_unit) && - ((function_die != NULL) || (block_die != NULL)); + check_children = + (m_tag == DW_TAG_compile_unit || m_tag == DW_TAG_partial_unit) && + ((function_die != nullptr) || (block_die != nullptr)); } } else { DWARFFormValue form_value; @@ -1430,13 +1431,14 @@ switch (m_tag) { case DW_TAG_compile_unit: // File case DW_TAG_partial_unit: // File - check_children = ((function_die != NULL) || (block_die != NULL)); + check_children = + ((function_die != nullptr) || (block_die != nullptr)); break; case DW_TAG_subprogram: // Function if (function_die) *function_die = this; - check_children = (block_die != NULL); + check_children = (block_die != nullptr); break; case DW_TAG_inlined_subroutine: // Inlined Function @@ -1500,7 +1502,7 @@ } } offset = DW_INVALID_OFFSET; - return NULL; + return nullptr; } bool DWARFDebugInfoEntry::OffsetLessThan(const DWARFDebugInfoEntry &a, Index: source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp =================================================================== --- source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp +++ source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp @@ -38,7 +38,7 @@ while (debug_line_data.ValidOffset(offset)) { const lldb::offset_t debug_line_offset = offset; - if (line_table_sp.get() == NULL) + if (line_table_sp.get() == nullptr) break; if (ParseStatementTable(debug_line_data, &offset, line_table_sp.get(), nullptr)) { Index: source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.cpp =================================================================== --- source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.cpp +++ source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.cpp @@ -105,7 +105,7 @@ dw_addr_t begin_addr = begin + base_addr; dw_addr_t end_addr = end + base_addr; - s.AddressRange(begin_addr, end_addr, sizeof(dw_addr_t), NULL); + s.AddressRange(begin_addr, end_addr, sizeof(dw_addr_t), nullptr); } } } Index: source/Plugins/SymbolFile/DWARF/DWARFDeclContext.h =================================================================== --- source/Plugins/SymbolFile/DWARF/DWARFDeclContext.h +++ source/Plugins/SymbolFile/DWARF/DWARFDeclContext.h @@ -23,7 +23,7 @@ class DWARFDeclContext { public: struct Entry { - Entry() : tag(0), name(NULL) {} + Entry() : tag(0), name(nullptr) {} Entry(dw_tag_t t, const char *n) : tag(t), name(n) {} bool NameMatches(const Entry &rhs) const { Index: source/Plugins/SymbolFile/DWARF/DWARFDeclContext.cpp =================================================================== --- source/Plugins/SymbolFile/DWARF/DWARFDeclContext.cpp +++ source/Plugins/SymbolFile/DWARF/DWARFDeclContext.cpp @@ -29,7 +29,7 @@ for (pos = begin; pos != end; ++pos) { if (pos != begin) m_qualified_name.append("::"); - if (pos->name == NULL) { + if (pos->name == nullptr) { if (pos->tag == DW_TAG_namespace) m_qualified_name.append("(anonymous namespace)"); else if (pos->tag == DW_TAG_class_type) @@ -47,7 +47,7 @@ } } if (m_qualified_name.empty()) - return NULL; + return nullptr; return m_qualified_name.c_str(); } Index: source/Plugins/SymbolFile/DWARF/DWARFFormValue.h =================================================================== --- source/Plugins/SymbolFile/DWARF/DWARFFormValue.h +++ source/Plugins/SymbolFile/DWARF/DWARFFormValue.h @@ -19,7 +19,7 @@ class DWARFFormValue { public: typedef struct ValueTypeTag { - ValueTypeTag() : value(), data(NULL) { value.uval = 0; } + ValueTypeTag() : value(), data(nullptr) { value.uval = 0; } union { uint64_t uval; Index: source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp =================================================================== --- source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp +++ source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp @@ -120,7 +120,7 @@ bool indirect = false; bool is_block = false; - m_value.data = NULL; + m_value.data = nullptr; uint8_t ref_addr_size; // Read the value for the form into value and follow and DW_FORM_indirect // instances we run into @@ -223,7 +223,7 @@ if (is_block) { m_value.data = data.PeekData(*offset_ptr, m_value.value.uval); - if (m_value.data != NULL) { + if (m_value.data != nullptr) { *offset_ptr += m_value.value.uval; } } @@ -687,7 +687,7 @@ return 0; else if (a_string && b_string) return strcmp(a_string, b_string); - else if (a_string == NULL) + else if (a_string == nullptr) return -1; // A string is NULL, and B is valid else return 1; // A string valid, and B is NULL Index: source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp =================================================================== --- source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp +++ source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp @@ -502,7 +502,7 @@ if (die) { const char *producer_cstr = - die->GetAttributeValueAsString(this, DW_AT_producer, NULL); + die->GetAttributeValueAsString(this, DW_AT_producer, nullptr); if (producer_cstr) { RegularExpression llvm_gcc_regex( llvm::StringRef("^4\\.[012]\\.[01] \\(Based on Apple " @@ -653,7 +653,7 @@ return; llvm::StringRef comp_dir = removeHostnameFromPathname( - die->GetAttributeValueAsString(this, DW_AT_comp_dir, NULL)); + die->GetAttributeValueAsString(this, DW_AT_comp_dir, nullptr)); if (!comp_dir.empty()) { FileSpec::Style comp_dir_style = FileSpec::GuessPathStyle(comp_dir).getValueOr(FileSpec::Style::native); @@ -661,7 +661,8 @@ } else { // Try to detect the style based on the DW_AT_name attribute, but just store // the detected style in the m_comp_dir field. - const char *name = die->GetAttributeValueAsString(this, DW_AT_name, NULL); + const char *name = + die->GetAttributeValueAsString(this, DW_AT_name, nullptr); m_comp_dir = FileSpec( "", FileSpec::GuessPathStyle(name).getValueOr(FileSpec::Style::native)); } @@ -674,7 +675,7 @@ dw_offset_t DWARFUnit::GetBaseObjOffset() const { return m_base_obj_offset; } const DWARFDebugAranges &DWARFUnit::GetFunctionAranges() { - if (m_func_aranges_up == NULL) { + if (m_func_aranges_up == nullptr) { m_func_aranges_up.reset(new DWARFDebugAranges()); const DWARFDebugInfoEntry *die = DIEPtr(); if (die) Index: source/Plugins/SymbolFile/DWARF/HashedNameToDIE.cpp =================================================================== --- source/Plugins/SymbolFile/DWARF/HashedNameToDIE.cpp +++ source/Plugins/SymbolFile/DWARF/HashedNameToDIE.cpp @@ -264,7 +264,7 @@ return false; for (size_t i = 0; i < num_atoms; ++i) { - DWARFFormValue form_value(NULL, header_data.atoms[i].form); + DWARFFormValue form_value(nullptr, header_data.atoms[i].form); if (!form_value.ExtractValue(data, offset_ptr)) return false; @@ -341,7 +341,7 @@ // There definitely should be a string for this string offset, if there // isn't, there is something wrong, return and error const char *strp_cstr = m_string_table.PeekCStr(pair.key); - if (strp_cstr == NULL) { + if (strp_cstr == nullptr) { *hash_data_offset_ptr = UINT32_MAX; return eResultError; } @@ -408,7 +408,7 @@ // There definitely should be a string for this string offset, if there // isn't, there is something wrong, return and error const char *strp_cstr = m_string_table.PeekCStr(pair.key); - if (strp_cstr == NULL) + if (strp_cstr == nullptr) return eResultError; const uint32_t count = m_data.GetU32(hash_data_offset_ptr); Index: source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp =================================================================== --- source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp +++ source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp @@ -141,8 +141,8 @@ } DWARFAttributes attributes; - const char *name = NULL; - const char *mangled_cstr = NULL; + const char *name = nullptr; + const char *mangled_cstr = nullptr; bool is_declaration = false; // bool is_artificial = false; bool has_address = false; @@ -194,7 +194,7 @@ has_location_or_const_value = true; if (tag == DW_TAG_variable) { const DWARFDebugInfoEntry *parent_die = die.GetParent(); - while (parent_die != NULL) { + while (parent_die != nullptr) { switch (parent_die->Tag()) { case DW_TAG_subprogram: case DW_TAG_lexical_block: @@ -219,13 +219,13 @@ // } // } // } - parent_die = NULL; // Terminate the while loop. + parent_die = nullptr; // Terminate the while loop. break; case DW_TAG_compile_unit: case DW_TAG_partial_unit: is_global_or_static_variable = true; - parent_die = NULL; // Terminate the while loop. + parent_die = nullptr; // Terminate the while loop. break; default: Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h =================================================================== --- source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h +++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h @@ -364,7 +364,7 @@ const DWARFDIE &orig_die, const lldb::addr_t func_low_pc, bool parse_siblings, bool parse_children, - lldb_private::VariableList *cc_variable_list = NULL); + lldb_private::VariableList *cc_variable_list = nullptr); bool ClassOrStructIsVirtual(const DWARFDIE &die); Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp =================================================================== --- source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -292,14 +292,14 @@ ASSERT_MODULE_LOCK(this); TypeSet type_set; - CompileUnit *comp_unit = NULL; - DWARFUnit *dwarf_cu = NULL; + CompileUnit *comp_unit = nullptr; + DWARFUnit *dwarf_cu = nullptr; if (sc_scope) comp_unit = sc_scope->CalculateSymbolContextCompileUnit(); if (comp_unit) { dwarf_cu = GetDWARFCompileUnit(comp_unit); - if (dwarf_cu == 0) + if (dwarf_cu == nullptr) return 0; GetTypes(dwarf_cu->DIE(), dwarf_cu->GetOffset(), dwarf_cu->GetNextUnitOffset(), type_mask, type_set); @@ -355,7 +355,7 @@ UserID(0x7fffffff00000000), // Used by SymbolFileDWARFDebugMap to // when this class parses .o files to // contain the .o file index/ID - m_debug_map_module_wp(), m_debug_map_symfile(NULL), + m_debug_map_module_wp(), m_debug_map_symfile(nullptr), m_context(objfile->GetModule()->GetSectionList(), dwo_section_list), m_data_debug_loc(), m_data_debug_ranges(), m_data_debug_rnglists(), m_abbr(), m_info(), m_line(), m_fetched_external_modules(false), @@ -433,10 +433,10 @@ uint32_t SymbolFileDWARF::CalculateAbilities() { uint32_t abilities = 0; - if (m_obj_file != NULL) { - const Section *section = NULL; + if (m_obj_file != nullptr) { + const Section *section = nullptr; const SectionList *section_list = m_obj_file->GetSectionList(); - if (section_list == NULL) + if (section_list == nullptr) return 0; uint64_t debug_abbrev_file_size = 0; @@ -450,7 +450,7 @@ section = section_list->FindSectionByType(eSectionTypeDWARFDebugInfo, true).get(); - if (section != NULL) { + if (section != nullptr) { debug_info_file_size = section->GetFileSize(); section = @@ -587,7 +587,7 @@ } DWARFDebugInfo *SymbolFileDWARF::DebugInfo() { - if (m_info == NULL) { + if (m_info == nullptr) { static Timer::Category func_cat(LLVM_PRETTY_FUNCTION); Timer scoped_timer(func_cat, "%s this = %p", LLVM_PRETTY_FUNCTION, static_cast(this)); @@ -612,15 +612,15 @@ if (info) { // The compile unit ID is the index of the DWARF unit. DWARFUnit *dwarf_cu = info->GetUnitAtIndex(comp_unit->GetID()); - if (dwarf_cu && dwarf_cu->GetUserData() == NULL) + if (dwarf_cu && dwarf_cu->GetUserData() == nullptr) dwarf_cu->SetUserData(comp_unit); return dwarf_cu; } - return NULL; + return nullptr; } DWARFDebugRangesBase *SymbolFileDWARF::DebugRanges() { - if (m_ranges == NULL) { + if (m_ranges == nullptr) { static Timer::Category func_cat(LLVM_PRETTY_FUNCTION); Timer scoped_timer(func_cat, "%s this = %p", LLVM_PRETTY_FUNCTION, static_cast(this)); @@ -905,7 +905,7 @@ bool SymbolFileDWARF::ParseLineTable(CompileUnit &comp_unit) { ASSERT_MODULE_LOCK(this); - if (comp_unit.GetLineTable() != NULL) + if (comp_unit.GetLineTable() != nullptr) return true; DWARFUnit *dwarf_cu = GetDWARFCompileUnit(&comp_unit); @@ -1022,7 +1022,7 @@ case DW_TAG_inlined_subroutine: case DW_TAG_subprogram: case DW_TAG_lexical_block: { - Block *block = NULL; + Block *block = nullptr; if (tag == DW_TAG_subprogram) { // Skip any DW_TAG_subprogram DIEs that are inside of a normal or // inlined functions. These will be parsed on their own as separate @@ -1038,8 +1038,8 @@ block = block_sp.get(); } DWARFRangeList ranges; - const char *name = NULL; - const char *mangled_name = NULL; + const char *name = nullptr; + const char *mangled_name = nullptr; int decl_file = 0; int decl_line = 0; @@ -1087,7 +1087,7 @@ block->FinalizeRanges(); if (tag != DW_TAG_subprogram && - (name != NULL || mangled_name != NULL)) { + (name != nullptr || mangled_name != nullptr)) { std::unique_ptr decl_up; if (decl_file != 0 || decl_line != 0 || decl_column != 0) decl_up.reset(new Declaration( @@ -1312,7 +1312,7 @@ } return ResolveType(die); } - return NULL; + return nullptr; } // This function is used when SymbolFileDWARFDebugMap owns a bunch of @@ -1409,7 +1409,7 @@ SymbolFileDWARF::GetCompUnitForDWARFCompUnit(DWARFUnit *dwarf_cu, uint32_t cu_idx) { // Check if the symbol vendor already knows about this compile unit? - if (dwarf_cu->GetUserData() == NULL) { + if (dwarf_cu->GetUserData() == nullptr) { // The symbol vendor doesn't know about this compile unit, we need to parse // and add it to the symbol vendor object. return ParseCompileUnit(dwarf_cu, cu_idx).get(); @@ -1432,7 +1432,7 @@ sc.comp_unit = GetCompUnitForDWARFCompUnit(die.GetCU(), UINT32_MAX); sc.function = sc.comp_unit->FindFunctionByUID(die.GetID()).get(); - if (sc.function == NULL) + if (sc.function == nullptr) sc.function = ParseFunction(*sc.comp_unit, die); if (sc.function) { @@ -1573,7 +1573,7 @@ } Status error = ModuleList::GetSharedModule( - dwo_module_spec, module_sp, NULL, NULL, NULL); + dwo_module_spec, module_sp, nullptr, nullptr, nullptr); if (!module_sp) { GetObjectFile()->GetModule()->ReportWarning( "0x%8.8x: unable to locate module needed for external types: " @@ -1703,7 +1703,7 @@ if (function_die) { sc.function = sc.comp_unit->FindFunctionByUID(function_die.GetID()).get(); - if (sc.function == NULL) + if (sc.function == nullptr) sc.function = ParseFunction(*sc.comp_unit, function_die); if (sc.function && (resolve_scope & eSymbolContextBlock)) @@ -1718,7 +1718,7 @@ force_check_line_table = true; } - if (sc.function != NULL) { + if (sc.function != nullptr) { resolved |= eSymbolContextFunction; if (resolve_scope & eSymbolContextBlock) { @@ -1737,7 +1737,7 @@ if ((resolve_scope & eSymbolContextLineEntry) || force_check_line_table) { LineTable *line_table = sc.comp_unit->GetLineTable(); - if (line_table != NULL) { + if (line_table != nullptr) { // And address that makes it into this function should be in // terms of this debug file if there is no debug map, or it // will be an address in the .o file which needs to be fixed up @@ -1761,7 +1761,7 @@ // only happen when there aren't other functions from other // compile units in these gaps. This helps keep the size of the // aranges down. - sc.comp_unit = NULL; + sc.comp_unit = nullptr; resolved &= ~eSymbolContextCompUnit; } } else { @@ -1787,14 +1787,15 @@ DWARFDebugInfo *debug_info = DebugInfo(); if (debug_info) { uint32_t cu_idx; - DWARFUnit *dwarf_cu = NULL; + DWARFUnit *dwarf_cu = nullptr; - for (cu_idx = 0; (dwarf_cu = debug_info->GetUnitAtIndex(cu_idx)) != NULL; + for (cu_idx = 0; + (dwarf_cu = debug_info->GetUnitAtIndex(cu_idx)) != nullptr; ++cu_idx) { CompileUnit *dc_cu = GetCompUnitForDWARFCompUnit(dwarf_cu, cu_idx); const bool full_match = (bool)file_spec.GetDirectory(); bool file_spec_matches_cu_file_spec = - dc_cu != NULL && FileSpec::Equal(file_spec, *dc_cu, full_match); + dc_cu != nullptr && FileSpec::Equal(file_spec, *dc_cu, full_match); if (check_inlines || file_spec_matches_cu_file_spec) { SymbolContext sc(m_obj_file->GetModule()); sc.comp_unit = GetCompUnitForDWARFCompUnit(dwarf_cu, cu_idx); @@ -1813,7 +1814,7 @@ if (line != 0) { LineTable *line_table = sc.comp_unit->GetLineTable(); - if (line_table != NULL && line != 0) { + if (line_table != nullptr && line != 0) { // We will have already looked up the file index if we are // searching for inline entries. if (!check_inlines) @@ -1827,8 +1828,8 @@ found_line = sc.line_entry.line; while (line_idx != UINT32_MAX) { - sc.function = NULL; - sc.block = NULL; + sc.function = nullptr; + sc.block = nullptr; if (resolve_scope & (eSymbolContextFunction | eSymbolContextBlock)) { const lldb::addr_t file_vm_addr = @@ -1842,7 +1843,7 @@ sc.comp_unit ->FindFunctionByUID(function_die.GetID()) .get(); - if (sc.function == NULL) + if (sc.function == nullptr) sc.function = ParseFunction(*sc.comp_unit, function_die); @@ -1852,7 +1853,7 @@ function_die.LookupDeepestBlock(file_vm_addr); } - if (sc.function != NULL) { + if (sc.function != nullptr) { Block &block = sc.function->GetBlock(true); if (block_die) @@ -1947,7 +1948,7 @@ return 0; DWARFDebugInfo *info = DebugInfo(); - if (info == NULL) + if (info == nullptr) return 0; // Remember how many variables are in the list before we search. @@ -2050,7 +2051,7 @@ } DWARFDebugInfo *info = DebugInfo(); - if (info == NULL) + if (info == nullptr) return 0; // Remember how many variables are in the list before we search. @@ -2120,12 +2121,12 @@ if (inlined_die) { Block &function_block = sc.function->GetBlock(true); sc.block = function_block.FindBlockByID(inlined_die.GetID()); - if (sc.block == NULL) + if (sc.block == nullptr) sc.block = function_block.FindBlockByID(inlined_die.GetOffset()); - if (sc.block == NULL || !sc.block->GetStartAddress(addr)) + if (sc.block == nullptr || !sc.block->GetStartAddress(addr)) addr.Clear(); } else { - sc.block = NULL; + sc.block = nullptr; addr = sc.function->GetAddressRange().GetBaseAddress(); } @@ -2196,7 +2197,7 @@ const uint32_t original_size = sc_list.GetSize(); DWARFDebugInfo *info = DebugInfo(); - if (info == NULL) + if (info == nullptr) return 0; llvm::DenseSet resolved_dies; @@ -2319,7 +2320,7 @@ searched_symbol_files.insert(this); DWARFDebugInfo *info = DebugInfo(); - if (info == NULL) + if (info == nullptr) return 0; Log *log(LogChannelDWARF::GetLogIfAll(DWARF_LOG_LOOKUPS)); @@ -2513,7 +2514,7 @@ TypeSP type_sp; if (die) { Type *type_ptr = GetDIEToType().lookup(die.GetDIE()); - if (type_ptr == NULL) { + if (type_ptr == nullptr) { CompileUnit *lldb_cu = GetCompUnitForDWARFCompUnit(die.GetCU()); assert(lldb_cu); SymbolContext sc(lldb_cu); @@ -2528,7 +2529,7 @@ !GetFunction(DWARFDIE(die.GetCU(), parent_die), sc)) sc = sc_backup; - type_sp = ParseType(sc, die, NULL); + type_sp = ParseType(sc, die, nullptr); } else if (type_ptr != DIE_IS_BEING_PARSED) { // Grab the existing type from the master types lists type_sp = type_ptr->shared_from_this(); @@ -2591,7 +2592,7 @@ Symbol * SymbolFileDWARF::GetObjCClassSymbol(ConstString objc_class_name) { - Symbol *objc_class_symbol = NULL; + Symbol *objc_class_symbol = nullptr; if (m_obj_file) { Symtab *symtab = m_obj_file->GetSymtab(); if (symtab) { @@ -3026,9 +3027,9 @@ size_t SymbolFileDWARF::ParseVariablesForContext(const SymbolContext &sc) { ASSERT_MODULE_LOCK(this); - if (sc.comp_unit != NULL) { + if (sc.comp_unit != nullptr) { DWARFDebugInfo *info = DebugInfo(); - if (info == NULL) + if (info == nullptr) return 0; if (sc.function) { @@ -3047,13 +3048,13 @@ } else if (sc.comp_unit) { DWARFUnit *dwarf_cu = info->GetUnitAtIndex(sc.comp_unit->GetID()); - if (dwarf_cu == NULL) + if (dwarf_cu == nullptr) return 0; uint32_t vars_added = 0; VariableListSP variables(sc.comp_unit->GetVariableList(false)); - if (variables.get() == NULL) { + if (variables.get() == nullptr) { variables = std::make_shared(); sc.comp_unit->SetVariableList(variables); @@ -3105,8 +3106,8 @@ const size_t num_attributes = die.GetAttributes(attributes); DWARFDIE spec_die; if (num_attributes > 0) { - const char *name = NULL; - const char *mangled = NULL; + const char *name = nullptr; + const char *mangled = nullptr; Declaration decl; uint32_t i; DWARFFormValue type_die_form; @@ -3288,7 +3289,7 @@ ValueType scope = eValueTypeInvalid; const DWARFDIE sc_parent_die = GetParentSymbolContextDIE(die); - SymbolContextScope *symbol_context_scope = NULL; + SymbolContextScope *symbol_context_scope = nullptr; bool has_explicit_mangled = mangled != nullptr; if (!mangled) { @@ -3334,7 +3335,7 @@ if (op_error) { StreamString strm; location.DumpLocationForAddress(&strm, eDescriptionLevelFull, 0, 0, - NULL); + nullptr); GetObjectFile()->GetModule()->ReportError( "0x%8.8x: %s has an invalid location: %s", die.GetOffset(), die.GetTagAsCString(), strm.GetData()); @@ -3437,7 +3438,7 @@ } } - if (symbol_context_scope == NULL) { + if (symbol_context_scope == nullptr) { switch (parent_tag) { case DW_TAG_subprogram: case DW_TAG_inlined_subroutine: @@ -3445,7 +3446,7 @@ if (sc.function) { symbol_context_scope = sc.function->GetBlock(true).FindBlockByID( sc_parent_die.GetID()); - if (symbol_context_scope == NULL) + if (symbol_context_scope == nullptr) symbol_context_scope = sc.function; } break; @@ -3557,15 +3558,15 @@ // We haven't already parsed it, lets do that now. if ((tag == DW_TAG_variable) || (tag == DW_TAG_constant) || (tag == DW_TAG_formal_parameter && sc.function)) { - if (variable_list_sp.get() == NULL) { + if (variable_list_sp.get() == nullptr) { DWARFDIE sc_parent_die = GetParentSymbolContextDIE(orig_die); dw_tag_t parent_tag = sc_parent_die.Tag(); switch (parent_tag) { case DW_TAG_compile_unit: case DW_TAG_partial_unit: - if (sc.comp_unit != NULL) { + if (sc.comp_unit != nullptr) { variable_list_sp = sc.comp_unit->GetVariableList(false); - if (variable_list_sp.get() == NULL) { + if (variable_list_sp.get() == nullptr) { variable_list_sp = std::make_shared(); } } else { @@ -3581,13 +3582,13 @@ case DW_TAG_subprogram: case DW_TAG_inlined_subroutine: case DW_TAG_lexical_block: - if (sc.function != NULL) { + if (sc.function != nullptr) { // Check to see if we already have parsed the variables for the // given scope Block *block = sc.function->GetBlock(true).FindBlockByID( sc_parent_die.GetID()); - if (block == NULL) { + if (block == nullptr) { // This must be a specification or abstract origin with a // concrete block counterpart in the current function. We need // to find the concrete block so we can correctly add the @@ -3601,10 +3602,10 @@ concrete_block_die.GetID()); } - if (block != NULL) { + if (block != nullptr) { const bool can_create = false; variable_list_sp = block->GetBlockVariableList(can_create); - if (variable_list_sp.get() == NULL) { + if (variable_list_sp.get() == nullptr) { variable_list_sp = std::make_shared(); block->SetVariableList(variable_list_sp); } @@ -3633,7 +3634,7 @@ } } - bool skip_children = (sc.function == NULL && tag == DW_TAG_subprogram); + bool skip_children = (sc.function == nullptr && tag == DW_TAG_subprogram); if (!skip_children && parse_children && die.HasChildren()) { vars_added += ParseVariables(sc, die.GetFirstChild(), func_low_pc, true, @@ -3718,7 +3719,7 @@ } SymbolFileDWARFDebugMap *SymbolFileDWARF::GetDebugMapSymfile() { - if (m_debug_map_symfile == NULL && !m_debug_map_module_wp.expired()) { + if (m_debug_map_symfile == nullptr && !m_debug_map_module_wp.expired()) { lldb::ModuleSP module_sp(m_debug_map_module_wp.lock()); if (module_sp) { SymbolVendor *sym_vendor = module_sp->GetSymbolVendor(); Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp =================================================================== --- source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp +++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp @@ -175,7 +175,7 @@ SymbolVendor * GetSymbolVendor(bool can_create = true, - lldb_private::Stream *feedback_strm = NULL) override { + lldb_private::Stream *feedback_strm = nullptr) override { // Scope for locker if (m_symfile_up.get() || !can_create) return m_symfile_up.get(); @@ -197,7 +197,7 @@ symbol_vendor->GetSymbolFile()); if (!oso_symfile) - return NULL; + return nullptr; ObjectFile *exe_objfile = exe_module_sp->GetObjectFile(); SymbolVendor *exe_sym_vendor = exe_module_sp->GetSymbolVendor(); @@ -213,7 +213,7 @@ } } } - return NULL; + return nullptr; } protected: @@ -368,12 +368,12 @@ oso_symbol->GetName().GetCString()); } } else { - if (oso_symbol == NULL) + if (oso_symbol == nullptr) m_obj_file->GetModule()->ReportError( "N_OSO symbol[%u] can't be found, please file a bug and attach " "the binary listed in this error", oso_idx); - else if (so_symbol == NULL) + else if (so_symbol == nullptr) m_obj_file->GetModule()->ReportError( "N_SO not found for N_OSO symbol[%u], please file a bug and " "attach the binary listed in this error", @@ -398,7 +398,7 @@ const uint32_t cu_count = GetNumCompileUnits(); if (oso_idx < cu_count) return GetModuleByCompUnitInfo(&m_compile_unit_infos[oso_idx]); - return NULL; + return nullptr; } Module *SymbolFileDWARFDebugMap::GetModuleByCompUnitInfo( @@ -428,7 +428,7 @@ ") since this executable was linked, file will be ignored", oso_file.GetPath().c_str(), llvm::to_string(oso_mod_time).c_str(), llvm::to_string(comp_unit_info->oso_mod_time).c_str()); - return NULL; + return nullptr; } } else { @@ -436,7 +436,7 @@ if (!ObjectFile::SplitArchivePathWithObject(oso_path, oso_file, oso_object, must_exist)) { - return NULL; + return nullptr; } } // Always create a new module for .o files. Why? Because we use the debug @@ -462,7 +462,7 @@ } if (comp_unit_info->oso_sp) return comp_unit_info->oso_sp->module_sp.get(); - return NULL; + return nullptr; } bool SymbolFileDWARFDebugMap::GetFileSpecForSO(uint32_t oso_idx, @@ -480,7 +480,7 @@ Module *oso_module = GetModuleByOSOIndex(oso_idx); if (oso_module) return oso_module->GetObjectFile(); - return NULL; + return nullptr; } SymbolFileDWARF * @@ -493,7 +493,7 @@ CompileUnitInfo *comp_unit_info = GetCompUnitInfo(comp_unit); if (comp_unit_info) return GetSymbolFileByCompUnitInfo(comp_unit_info); - return NULL; + return nullptr; } ObjectFile *SymbolFileDWARFDebugMap::GetObjectFileByCompUnitInfo( @@ -501,7 +501,7 @@ Module *oso_module = GetModuleByCompUnitInfo(comp_unit_info); if (oso_module) return oso_module->GetObjectFile(); - return NULL; + return nullptr; } uint32_t SymbolFileDWARFDebugMap::GetCompUnitInfoIndex( @@ -521,7 +521,7 @@ unsigned size = m_compile_unit_infos.size(); if (oso_idx < size) return GetSymbolFileByCompUnitInfo(&m_compile_unit_infos[oso_idx]); - return NULL; + return nullptr; } SymbolFileDWARF * @@ -529,7 +529,7 @@ if (sym_file && sym_file->GetPluginName() == SymbolFileDWARF::GetPluginNameStatic()) return (SymbolFileDWARF *)sym_file; - return NULL; + return nullptr; } SymbolFileDWARF *SymbolFileDWARFDebugMap::GetSymbolFileByCompUnitInfo( @@ -540,7 +540,7 @@ if (sym_vendor) return GetSymbolFileAsSymbolFileDWARF(sym_vendor->GetSymbolFile()); } - return NULL; + return nullptr; } uint32_t SymbolFileDWARFDebugMap::CalculateAbilities() { @@ -609,7 +609,7 @@ if (comp_unit == m_compile_unit_infos[i].compile_unit_sp.get()) return &m_compile_unit_infos[i]; } - return NULL; + return nullptr; } size_t SymbolFileDWARFDebugMap::GetCompUnitInfosForModule( @@ -706,7 +706,7 @@ SymbolFileDWARF *oso_dwarf = GetSymbolFileByOSOIndex(oso_idx); if (oso_dwarf) return oso_dwarf->ResolveTypeUID(type_uid); - return NULL; + return nullptr; } llvm::Optional @@ -750,7 +750,7 @@ sc.symbol = symtab->SymbolAtIndex(debug_map_entry->data.GetExeSymbolIndex()); - if (sc.symbol != NULL) { + if (sc.symbol != nullptr) { resolved_flags |= eSymbolContextSymbol; uint32_t oso_idx = 0; @@ -930,7 +930,7 @@ SymbolFileDWARFDebugMap::GetCompileUnitInfoForSymbolWithIndex( uint32_t symbol_idx, uint32_t *oso_idx_ptr) { const uint32_t oso_index_count = m_compile_unit_infos.size(); - CompileUnitInfo *comp_unit_info = NULL; + CompileUnitInfo *comp_unit_info = nullptr; if (oso_index_count) { comp_unit_info = (CompileUnitInfo *)bsearch( &symbol_idx, &m_compile_unit_infos[0], m_compile_unit_infos.size(), @@ -939,7 +939,7 @@ } if (oso_idx_ptr) { - if (comp_unit_info != NULL) + if (comp_unit_info != nullptr) *oso_idx_ptr = comp_unit_info - &m_compile_unit_infos[0]; else *oso_idx_ptr = UINT32_MAX; @@ -951,7 +951,7 @@ SymbolFileDWARFDebugMap::GetCompileUnitInfoForSymbolWithID( user_id_t symbol_id, uint32_t *oso_idx_ptr) { const uint32_t oso_index_count = m_compile_unit_infos.size(); - CompileUnitInfo *comp_unit_info = NULL; + CompileUnitInfo *comp_unit_info = nullptr; if (oso_index_count) { comp_unit_info = (CompileUnitInfo *)::bsearch( &symbol_id, &m_compile_unit_infos[0], m_compile_unit_infos.size(), @@ -960,7 +960,7 @@ } if (oso_idx_ptr) { - if (comp_unit_info != NULL) + if (comp_unit_info != nullptr) *oso_idx_ptr = comp_unit_info - &m_compile_unit_infos[0]; else *oso_idx_ptr = UINT32_MAX; @@ -1058,7 +1058,7 @@ type_mask); uint32_t initial_size = type_list.GetSize(); - SymbolFileDWARF *oso_dwarf = NULL; + SymbolFileDWARF *oso_dwarf = nullptr; if (sc_scope) { SymbolContext sc; sc_scope->CalculateSymbolContext(&sc); @@ -1103,7 +1103,7 @@ m_supports_DW_AT_APPLE_objc_complete_type = eLazyBoolNo; ForEachSymbolFile([&](SymbolFileDWARF *oso_dwarf) -> bool { if (skip_dwarf_oso != oso_dwarf && - oso_dwarf->Supports_DW_AT_APPLE_objc_complete_type(NULL)) { + oso_dwarf->Supports_DW_AT_APPLE_objc_complete_type(nullptr)) { m_supports_DW_AT_APPLE_objc_complete_type = eLazyBoolYes; return true; } @@ -1122,7 +1122,7 @@ // contain the implementation definition since it will be scoped inside the // N_SO and we can then locate the SymbolFileDWARF that corresponds to that // N_SO. - SymbolFileDWARF *oso_dwarf = NULL; + SymbolFileDWARF *oso_dwarf = nullptr; TypeSP type_sp; ObjectFile *module_objfile = m_obj_file->GetModule()->GetObjectFile(); if (module_objfile) { @@ -1143,7 +1143,7 @@ if (source_file_symbol_idx != UINT32_MAX) { CompileUnitInfo *compile_unit_info = GetCompileUnitInfoForSymbolWithIndex(source_file_symbol_idx, - NULL); + nullptr); if (compile_unit_info) { oso_dwarf = GetSymbolFileByCompUnitInfo(compile_unit_info); if (oso_dwarf) { @@ -1268,7 +1268,7 @@ } } } - return NULL; + return nullptr; } void SymbolFileDWARFDebugMap::SetCompileUnit(SymbolFileDWARF *oso_dwarf, @@ -1414,7 +1414,7 @@ CompileUnitInfo *cu_info = GetCompileUnitInfo(oso_dwarf); if (cu_info) return line_table->LinkLineTable(cu_info->GetFileRangeMap(this)); - return NULL; + return nullptr; } size_t Index: source/Plugins/SymbolFile/DWARF/UniqueDWARFASTType.cpp =================================================================== --- source/Plugins/SymbolFile/DWARF/UniqueDWARFASTType.cpp +++ source/Plugins/SymbolFile/DWARF/UniqueDWARFASTType.cpp @@ -39,12 +39,12 @@ case DW_TAG_namespace: { const char *parent_arg_die_name = parent_arg_die.GetName(); if (parent_arg_die_name == - NULL) // Anonymous (i.e. no-name) struct + nullptr) // Anonymous (i.e. no-name) struct { match = false; } else { const char *parent_pos_die_name = parent_pos_die.GetName(); - if (parent_pos_die_name == NULL || + if (parent_pos_die_name == nullptr || ((parent_arg_die_name != parent_pos_die_name) && strcmp(parent_arg_die_name, parent_pos_die_name))) match = false; Index: source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp =================================================================== --- source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp +++ source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp @@ -139,8 +139,8 @@ size_t num_added = 0; // We must at least have a valid compile unit const Symtab *symtab = m_obj_file->GetSymtab(); - const Symbol *curr_symbol = NULL; - const Symbol *next_symbol = NULL; + const Symbol *curr_symbol = nullptr; + const Symbol *next_symbol = nullptr; // const char *prefix = m_obj_file->SymbolPrefix(); // if (prefix == NULL) // prefix == ""; @@ -188,10 +188,10 @@ LLDB_INVALID_UID, // We don't have any type info // for this function curr_symbol->GetMangled(), // Linker/mangled name - NULL, // no return type for a code symbol... + nullptr, // no return type for a code symbol... func_range)); // first address range - if (func_sp.get() != NULL) { + if (func_sp.get() != nullptr) { comp_unit.AddFunction(func_sp); ++num_added; } @@ -230,7 +230,7 @@ } Type *SymbolFileSymtab::ResolveTypeUID(lldb::user_id_t type_uid) { - return NULL; + return nullptr; } llvm::Optional @@ -246,7 +246,7 @@ uint32_t SymbolFileSymtab::ResolveSymbolContext(const Address &so_addr, SymbolContextItem resolve_scope, SymbolContext &sc) { - if (m_obj_file->GetSymtab() == NULL) + if (m_obj_file->GetSymtab() == nullptr) return 0; uint32_t resolved_flags = 0; Index: source/Plugins/SymbolVendor/ELF/SymbolVendorELF.cpp =================================================================== --- source/Plugins/SymbolVendor/ELF/SymbolVendorELF.cpp +++ source/Plugins/SymbolVendor/ELF/SymbolVendorELF.cpp @@ -59,20 +59,20 @@ SymbolVendorELF::CreateInstance(const lldb::ModuleSP &module_sp, lldb_private::Stream *feedback_strm) { if (!module_sp) - return NULL; + return nullptr; ObjectFile *obj_file = module_sp->GetObjectFile(); if (!obj_file) - return NULL; + return nullptr; static ConstString obj_file_elf("elf"); ConstString obj_name = obj_file->GetPluginName(); if (obj_name != obj_file_elf) - return NULL; + return nullptr; lldb_private::UUID uuid = obj_file->GetUUID(); if (!uuid) - return NULL; + return nullptr; // Get the .gnu_debuglink file (if specified). FileSpecList file_spec_list = obj_file->GetDebugSymbolFilePaths(); @@ -84,7 +84,7 @@ // If we have no debug symbol files, then nothing to do. if (file_spec_list.IsEmpty()) - return NULL; + return nullptr; static Timer::Category func_cat(LLVM_PRETTY_FUNCTION); Timer scoped_timer(func_cat, "SymbolVendorELF::CreateInstance (module = %s)", @@ -153,7 +153,7 @@ } } } - return NULL; + return nullptr; } // PluginInterface protocol Index: source/Plugins/SystemRuntime/MacOSX/AppleGetItemInfoHandler.cpp =================================================================== --- source/Plugins/SystemRuntime/MacOSX/AppleGetItemInfoHandler.cpp +++ source/Plugins/SystemRuntime/MacOSX/AppleGetItemInfoHandler.cpp @@ -143,7 +143,7 @@ // function: if (!m_get_item_info_impl_code) { - if (g_get_item_info_function_code != NULL) { + if (g_get_item_info_function_code != nullptr) { Status error; m_get_item_info_impl_code.reset( exe_ctx.GetTargetRef().GetUtilityFunctionForLanguage( Index: source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.cpp =================================================================== --- source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.cpp +++ source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.cpp @@ -147,7 +147,7 @@ // First stage is to make the ClangUtility to hold our injected function: if (!m_get_pending_items_impl_code) { - if (g_get_pending_items_function_code != NULL) { + if (g_get_pending_items_function_code != nullptr) { Status error; m_get_pending_items_impl_code.reset( exe_ctx.GetTargetRef().GetUtilityFunctionForLanguage( @@ -347,7 +347,7 @@ options.SetIsForUtilityExpr(true); thread.CalculateExecutionContext(exe_ctx); - if (get_pending_items_caller == NULL) { + if (get_pending_items_caller == nullptr) { error.SetErrorString("Unable to compile function to call " "__introspection_dispatch_queue_get_pending_items"); return return_value; Index: source/Plugins/SystemRuntime/MacOSX/AppleGetQueuesHandler.cpp =================================================================== --- source/Plugins/SystemRuntime/MacOSX/AppleGetQueuesHandler.cpp +++ source/Plugins/SystemRuntime/MacOSX/AppleGetQueuesHandler.cpp @@ -158,7 +158,7 @@ // First stage is to make the ClangUtility to hold our injected function: if (!m_get_queues_impl_code_up) { - if (g_get_current_queues_function_code != NULL) { + if (g_get_current_queues_function_code != nullptr) { Status error; m_get_queues_impl_code_up.reset( exe_ctx.GetTargetRef().GetUtilityFunctionForLanguage( @@ -335,7 +335,7 @@ FunctionCaller *get_queues_caller = m_get_queues_impl_code_up->GetFunctionCaller(); - if (get_queues_caller == NULL) { + if (get_queues_caller == nullptr) { error.SetErrorString( "Unable to get caller for call __introspection_dispatch_get_queues"); return return_value; Index: source/Plugins/SystemRuntime/MacOSX/AppleGetThreadItemInfoHandler.cpp =================================================================== --- source/Plugins/SystemRuntime/MacOSX/AppleGetThreadItemInfoHandler.cpp +++ source/Plugins/SystemRuntime/MacOSX/AppleGetThreadItemInfoHandler.cpp @@ -154,7 +154,7 @@ if (!m_get_thread_item_info_impl_code) { Status error; - if (g_get_thread_item_info_function_code != NULL) { + if (g_get_thread_item_info_function_code != nullptr) { m_get_thread_item_info_impl_code.reset( exe_ctx.GetTargetRef().GetUtilityFunctionForLanguage( g_get_thread_item_info_function_code, eLanguageTypeC, Index: source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp =================================================================== --- source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp +++ source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp @@ -70,7 +70,7 @@ if (create) return new SystemRuntimeMacOSX(process); - return NULL; + return nullptr; } // Constructor @@ -106,7 +106,7 @@ m_process->ClearBreakpointSiteByID(m_break_id); if (clear_process) - m_process = NULL; + m_process = nullptr; m_break_id = LLDB_INVALID_BREAK_ID; } @@ -266,7 +266,7 @@ static ConstString g_dispatch_queue_offsets_symbol_name( "dispatch_queue_offsets"); - const Symbol *dispatch_queue_offsets_symbol = NULL; + const Symbol *dispatch_queue_offsets_symbol = nullptr; // libdispatch symbols were in libSystem.B.dylib up through Mac OS X 10.6 // ("Snow Leopard") @@ -279,7 +279,7 @@ // libdispatch symbols are in their own dylib as of Mac OS X 10.7 ("Lion") // and later - if (dispatch_queue_offsets_symbol == NULL) { + if (dispatch_queue_offsets_symbol == nullptr) { ModuleSpec libdispatch_module_spec(FileSpec("libdispatch.dylib")); module_sp = m_process->GetTarget().GetImages().FindFirstModule( libdispatch_module_spec); @@ -322,7 +322,7 @@ static ConstString g_libpthread_layout_offsets_symbol_name( "pthread_layout_offsets"); - const Symbol *libpthread_layout_offsets_symbol = NULL; + const Symbol *libpthread_layout_offsets_symbol = nullptr; ModuleSpec libpthread_module_spec(FileSpec("libsystem_pthread.dylib")); ModuleSP module_sp(m_process->GetTarget().GetImages().FindFirstModule( @@ -370,7 +370,7 @@ static ConstString g_libdispatch_tsd_indexes_symbol_name( "dispatch_tsd_indexes"); - const Symbol *libdispatch_tsd_indexes_symbol = NULL; + const Symbol *libdispatch_tsd_indexes_symbol = nullptr; ModuleSpec libpthread_module_spec(FileSpec("libdispatch.dylib")); ModuleSP module_sp(m_process->GetTarget().GetImages().FindFirstModule( @@ -726,7 +726,8 @@ for (ThreadSP thread_sp : m_process->Threads()) { if (thread_sp->GetAssociatedWithLibdispatchQueue() != eLazyBoolNo) { if (thread_sp->GetQueueID() != LLDB_INVALID_QUEUE_ID) { - if (queue_list.FindQueueByID(thread_sp->GetQueueID()).get() == NULL) { + if (queue_list.FindQueueByID(thread_sp->GetQueueID()).get() == + nullptr) { QueueSP queue_sp(new Queue(m_process->shared_from_this(), thread_sp->GetQueueID(), thread_sp->GetQueueName())); @@ -933,7 +934,7 @@ offset = start_of_this_item + m_lib_backtrace_recording_info.queue_info_data_offset; const char *queue_label = extractor.GetCStr(&offset); - if (queue_label == NULL) + if (queue_label == nullptr) queue_label = ""; offset_t start_of_next_item = start_of_this_item + offset_to_next; Index: source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.h =================================================================== --- source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.h +++ source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.h @@ -65,7 +65,7 @@ UnwindAssemblyInstEmulation(const lldb_private::ArchSpec &arch, lldb_private::EmulateInstruction *inst_emulator) : UnwindAssembly(arch), m_inst_emulator_up(inst_emulator), - m_range_ptr(NULL), m_unwind_plan_ptr(NULL), m_curr_row(), + m_range_ptr(nullptr), m_unwind_plan_ptr(nullptr), m_curr_row(), m_cfa_reg_info(), m_fp_is_cfa(false), m_register_values(), m_pushed_regs(), m_curr_row_modified(false), m_forward_branch_offset(0) { Index: source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp =================================================================== --- source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp +++ source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp @@ -67,8 +67,8 @@ const bool prefer_file_cache = true; DisassemblerSP disasm_sp(Disassembler::DisassembleBytes( - m_arch, NULL, NULL, range.GetBaseAddress(), opcode_data, opcode_size, - 99999, prefer_file_cache)); + m_arch, nullptr, nullptr, range.GetBaseAddress(), opcode_data, + opcode_size, 99999, prefer_file_cache)); Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_UNWIND)); @@ -213,7 +213,7 @@ lldb_private::FormatEntity::Entry format; FormatEntity::Parse("${frame.pc}: ", format); inst->Dump(&strm, inst_list.GetMaxOpcocdeByteSize(), show_address, - show_bytes, NULL, NULL, NULL, &format, 0); + show_bytes, nullptr, nullptr, nullptr, &format, 0); log->PutString(strm.GetString()); } @@ -296,11 +296,11 @@ UnwindAssemblyInstEmulation::CreateInstance(const ArchSpec &arch) { std::unique_ptr inst_emulator_up( EmulateInstruction::FindPlugin(arch, eInstructionTypePrologueEpilogue, - NULL)); + nullptr)); // Make sure that all prologue instructions are handled if (inst_emulator_up) return new UnwindAssemblyInstEmulation(arch, inst_emulator_up.release()); - return NULL; + return nullptr; } // PluginInterface protocol in UnwindAssemblyParser_x86 Index: source/Plugins/UnwindAssembly/x86/UnwindAssembly-x86.cpp =================================================================== --- source/Plugins/UnwindAssembly/x86/UnwindAssembly-x86.cpp +++ source/Plugins/UnwindAssembly/x86/UnwindAssembly-x86.cpp @@ -239,7 +239,7 @@ const llvm::Triple::ArchType cpu = arch.GetMachine(); if (cpu == llvm::Triple::x86 || cpu == llvm::Triple::x86_64) return new UnwindAssembly_x86(arch); - return NULL; + return nullptr; } // PluginInterface protocol in UnwindAssemblyParser_x86 Index: source/Symbol/ClangASTContext.cpp =================================================================== --- source/Symbol/ClangASTContext.cpp +++ source/Symbol/ClangASTContext.cpp @@ -6894,7 +6894,7 @@ } else { child_is_deref_of_parent = true; const char *parent_name = - valobj ? valobj->GetName().GetCString() : NULL; + valobj ? valobj->GetName().GetCString() : nullptr; if (parent_name) { child_name.assign(1, '*'); child_name += parent_name; @@ -6975,7 +6975,7 @@ child_is_deref_of_parent = true; const char *parent_name = - valobj ? valobj->GetName().GetCString() : NULL; + valobj ? valobj->GetName().GetCString() : nullptr; if (parent_name) { child_name.assign(1, '*'); child_name += parent_name; @@ -7012,7 +7012,7 @@ language_flags); } else { const char *parent_name = - valobj ? valobj->GetName().GetCString() : NULL; + valobj ? valobj->GetName().GetCString() : nullptr; if (parent_name) { child_name.assign(1, '&'); child_name += parent_name; @@ -7842,7 +7842,7 @@ llvm::dyn_cast(ClangUtil::GetCanonicalQualType(type)); if (enutype) return enutype->getDecl(); - return NULL; + return nullptr; } clang::RecordDecl *ClangASTContext::GetAsRecordDecl(const CompilerType &type) { @@ -8261,7 +8261,7 @@ if (is_attr_used) cxx_method_decl->addAttr(clang::UsedAttr::CreateImplicit(*getASTContext())); - if (mangled_name != NULL) { + if (mangled_name != nullptr) { cxx_method_decl->addAttr( clang::AsmLabelAttr::CreateImplicit(*getASTContext(), mangled_name)); } @@ -9868,7 +9868,7 @@ template_basename.c_str(), tag_decl_kind, template_param_infos); } - return NULL; + return nullptr; } void ClangASTContext::CompleteTagDecl(void *baton, clang::TagDecl *decl) { Index: source/Symbol/ClangASTImporter.cpp =================================================================== --- source/Symbol/ClangASTImporter.cpp +++ source/Symbol/ClangASTImporter.cpp @@ -346,7 +346,7 @@ const clang::CXXRecordDecl *cxx_record_decl = qual_type->getAsCXXRecordDecl(); if (cxx_record_decl) { - if (ResolveDeclOrigin(cxx_record_decl, NULL, NULL)) + if (ResolveDeclOrigin(cxx_record_decl, nullptr, nullptr)) return true; } } break; @@ -355,7 +355,7 @@ clang::EnumDecl *enum_decl = llvm::cast(qual_type)->getDecl(); if (enum_decl) { - if (ResolveDeclOrigin(enum_decl, NULL, NULL)) + if (ResolveDeclOrigin(enum_decl, nullptr, nullptr)) return true; } } break; @@ -370,7 +370,7 @@ // We currently can't complete objective C types through the newly added // ASTContext because it only supports TagDecl objects right now... if (class_interface_decl) { - if (ResolveDeclOrigin(class_interface_decl, NULL, NULL)) + if (ResolveDeclOrigin(class_interface_decl, nullptr, nullptr)) return true; } } @@ -422,7 +422,7 @@ const clang::CXXRecordDecl *cxx_record_decl = qual_type->getAsCXXRecordDecl(); if (cxx_record_decl) { - if (ResolveDeclOrigin(cxx_record_decl, NULL, NULL)) + if (ResolveDeclOrigin(cxx_record_decl, nullptr, nullptr)) return CompleteAndFetchChildren(qual_type); } } break; @@ -431,7 +431,7 @@ clang::EnumDecl *enum_decl = llvm::cast(qual_type)->getDecl(); if (enum_decl) { - if (ResolveDeclOrigin(enum_decl, NULL, NULL)) + if (ResolveDeclOrigin(enum_decl, nullptr, nullptr)) return CompleteAndFetchChildren(qual_type); } } break; @@ -446,7 +446,7 @@ // We currently can't complete objective C types through the newly added // ASTContext because it only supports TagDecl objects right now... if (class_interface_decl) { - if (ResolveDeclOrigin(class_interface_decl, NULL, NULL)) + if (ResolveDeclOrigin(class_interface_decl, nullptr, nullptr)) return CompleteAndFetchChildren(qual_type); } } Index: source/Symbol/CompactUnwindInfo.cpp =================================================================== --- source/Symbol/CompactUnwindInfo.cpp +++ source/Symbol/CompactUnwindInfo.cpp @@ -186,7 +186,7 @@ if (log && log->GetVerbose()) { StreamString strm; addr.Dump( - &strm, NULL, + &strm, nullptr, Address::DumpStyle::DumpStyleResolvedDescriptionNoFunctionArguments, Address::DumpStyle::DumpStyleFileAddress, arch.GetAddressByteSize()); Index: source/Symbol/CompilerType.cpp =================================================================== --- source/Symbol/CompilerType.cpp +++ source/Symbol/CompilerType.cpp @@ -995,7 +995,7 @@ return false; auto byte_size = - GetByteSize(exe_ctx ? exe_ctx->GetBestExecutionContextScope() : NULL); + GetByteSize(exe_ctx ? exe_ctx->GetBestExecutionContextScope() : nullptr); if (!byte_size) return false; @@ -1040,7 +1040,7 @@ return false; auto byte_size = - GetByteSize(exe_ctx ? exe_ctx->GetBestExecutionContextScope() : NULL); + GetByteSize(exe_ctx ? exe_ctx->GetBestExecutionContextScope() : nullptr); if (!byte_size) return false; Index: source/Symbol/LocateSymbolFile.cpp =================================================================== --- source/Symbol/LocateSymbolFile.cpp +++ source/Symbol/LocateSymbolFile.cpp @@ -55,9 +55,10 @@ bool got_spec = module_specs.GetModuleSpecAtIndex(i, spec); UNUSED_IF_ASSERT_DISABLED(got_spec); assert(got_spec); - if ((uuid == NULL || (spec.GetUUIDPtr() && spec.GetUUID() == *uuid)) && - (arch == NULL || (spec.GetArchitecturePtr() && - spec.GetArchitecture().IsCompatibleMatch(*arch)))) { + if ((uuid == nullptr || (spec.GetUUIDPtr() && spec.GetUUID() == *uuid)) && + (arch == nullptr || + (spec.GetArchitecturePtr() && + spec.GetArchitecture().IsCompatibleMatch(*arch)))) { return true; } } Index: source/Symbol/SymbolContext.cpp =================================================================== --- source/Symbol/SymbolContext.cpp +++ source/Symbol/SymbolContext.cpp @@ -501,7 +501,7 @@ } #ifdef LLDB_CONFIGURATION_DEBUG else { - ObjectFile *objfile = NULL; + ObjectFile *objfile = nullptr; if (module_sp) { SymbolVendor *symbol_vendor = module_sp->GetSymbolVendor(); if (symbol_vendor) { Index: source/Symbol/Symtab.cpp =================================================================== --- source/Symbol/Symtab.cpp +++ source/Symbol/Symtab.cpp @@ -1149,5 +1149,5 @@ return symbol; } } - return NULL; + return nullptr; } Index: source/Symbol/Type.cpp =================================================================== --- source/Symbol/Type.cpp +++ source/Symbol/Type.cpp @@ -978,7 +978,7 @@ } return m_static_type.GetTypeSystem(); } - return NULL; + return nullptr; } bool TypeImpl::GetDescription(lldb_private::Stream &strm, Index: source/Target/CPPLanguageRuntime.cpp =================================================================== --- source/Target/CPPLanguageRuntime.cpp +++ source/Target/CPPLanguageRuntime.cpp @@ -214,7 +214,7 @@ return llvm::Regex::escape(first_template_parameter.str()) + R"(::operator\(\)\(.*\))"; - if (symbol != NULL && + if (symbol != nullptr && symbol->GetName().GetStringRef().contains("__invoke")) { llvm::StringRef symbol_name = symbol->GetName().GetStringRef(); Index: source/Target/Process.cpp =================================================================== --- source/Target/Process.cpp +++ source/Target/Process.cpp @@ -1425,7 +1425,7 @@ Status error = PrivateResume(); if (error.Success()) { StateType state = - WaitForProcessToStop(llvm::None, NULL, true, listener_sp, stream); + WaitForProcessToStop(llvm::None, nullptr, true, listener_sp, stream); const bool must_be_alive = false; // eStateExited is ok, so this must be false if (!StateIsStoppedState(state, must_be_alive)) @@ -3638,7 +3638,7 @@ } if (signal == eBroadcastInternalStateControlStop) { - thread_result_t result = NULL; + thread_result_t result = nullptr; m_private_state_thread.Join(&result); m_private_state_thread.Reset(); } @@ -3913,7 +3913,7 @@ // it was doing yet, so don't try to change it on the way out. if (!is_secondary_thread) m_public_run_lock.SetStopped(); - return NULL; + return nullptr; } // Process Event Data Index: source/Target/SectionLoadHistory.cpp =================================================================== --- source/Target/SectionLoadHistory.cpp +++ source/Target/SectionLoadHistory.cpp @@ -97,7 +97,7 @@ std::lock_guard guard(m_mutex); SectionLoadList *section_load_list = GetSectionLoadListForStopID(eStopIDNow, read_only); - assert(section_load_list != NULL); + assert(section_load_list != nullptr); return *section_load_list; } Index: source/Target/StopInfo.cpp =================================================================== --- source/Target/StopInfo.cpp +++ source/Target/StopInfo.cpp @@ -1196,7 +1196,7 @@ address_loc += (sizeof(address_string) - 1); - uint64_t address = strtoull(address_loc, 0, 0); + uint64_t address = strtoull(address_loc, nullptr, 0); if (crashing_address) { *crashing_address = address; } Index: source/Target/ThreadPlanShouldStopHere.cpp =================================================================== --- source/Target/ThreadPlanShouldStopHere.cpp +++ source/Target/ThreadPlanShouldStopHere.cpp @@ -130,7 +130,7 @@ "Queueing StepInRange plan to step through line 0 code."); return_plan_sp = current_plan->GetThread().QueueThreadPlanForStepInRange( - false, range, sc, NULL, eOnlyDuringStepping, status, + false, range, sc, nullptr, eOnlyDuringStepping, status, eLazyBoolCalculate, eLazyBoolNo); } } Index: tools/lldb-mi/MICmdCmdExec.cpp =================================================================== --- tools/lldb-mi/MICmdCmdExec.cpp +++ tools/lldb-mi/MICmdCmdExec.cpp @@ -983,13 +983,13 @@ } lldb::SBLaunchInfo sbLaunchInfo = sbTarget.GetLaunchInfo(); - sbLaunchInfo.SetArguments(NULL, false); + sbLaunchInfo.SetArguments(nullptr, false); CMIUtilString strArg; size_t nArgIndex = 0; while (pArgArguments->GetExpectedOption( strArg, nArgIndex)) { - const char *argv[2] = {strArg.c_str(), NULL}; + const char *argv[2] = {strArg.c_str(), nullptr}; sbLaunchInfo.SetArguments(argv, true); ++nArgIndex; } Index: tools/lldb-mi/MICmdCmdTarget.cpp =================================================================== --- tools/lldb-mi/MICmdCmdTarget.cpp +++ tools/lldb-mi/MICmdCmdTarget.cpp @@ -265,7 +265,7 @@ // If the current target is invalid, create one lldb::SBTarget target = rSessionInfo.GetTarget(); if (!target.IsValid()) { - target = rSessionInfo.GetDebugger().CreateTarget(NULL); + target = rSessionInfo.GetDebugger().CreateTarget(nullptr); if (!target.IsValid()) { SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_INVALID_TARGET_CURRENT), m_cmdData.strMiCmd.c_str())); Index: tools/lldb-mi/MICmnBase.cpp =================================================================== --- tools/lldb-mi/MICmnBase.cpp +++ tools/lldb-mi/MICmnBase.cpp @@ -32,7 +32,7 @@ // Return: None. // Throws: None. //-- -CMICmnBase::~CMICmnBase() { m_pLog = NULL; } +CMICmnBase::~CMICmnBase() { m_pLog = nullptr; } //++ // Details: Retrieve whether *this object has an error description set. Index: tools/lldb-mi/MICmnMIOutOfBandRecord.cpp =================================================================== --- tools/lldb-mi/MICmnMIOutOfBandRecord.cpp +++ tools/lldb-mi/MICmnMIOutOfBandRecord.cpp @@ -53,7 +53,7 @@ return ""; } assert(false && "unknown CMICmnMIOutofBandRecord::OutOfBand_e"); - return NULL; + return nullptr; } static const char * @@ -95,7 +95,7 @@ return "&"; } assert(false && "unknown CMICmnMIOutofBandRecord::OutOfBand_e"); - return NULL; + return nullptr; } //++ Index: tools/lldb-mi/MICmnMIResultRecord.cpp =================================================================== --- tools/lldb-mi/MICmnMIResultRecord.cpp +++ tools/lldb-mi/MICmnMIResultRecord.cpp @@ -34,7 +34,7 @@ return "exit"; } assert(false && "unknown CMICmnMIResultRecord::ResultClass_e"); - return NULL; + return nullptr; } //++ Index: tools/lldb-mi/MIDriver.cpp =================================================================== --- tools/lldb-mi/MIDriver.cpp +++ tools/lldb-mi/MIDriver.cpp @@ -51,7 +51,7 @@ //-- CMIDriver::CMIDriver() : m_bFallThruToOtherDriverEnabled(false), m_bDriverIsExiting(false), - m_handleMainThread(0), m_rStdin(CMICmnStreamStdin::Instance()), + m_handleMainThread(nullptr), m_rStdin(CMICmnStreamStdin::Instance()), m_rLldbDebugger(CMICmnLLDBDebugger::Instance()), m_rStdOut(CMICmnStreamStdout::Instance()), m_eCurrentDriverState(eDriverState_NotRunning), @@ -737,7 +737,7 @@ // available before *this driver has been initialized! Flaw? // Do not want to pass through driver to write to stdout - return NULL; + return nullptr; } //++ Index: tools/lldb-mi/MIDriverBase.cpp =================================================================== --- tools/lldb-mi/MIDriverBase.cpp +++ tools/lldb-mi/MIDriverBase.cpp @@ -30,7 +30,7 @@ // Return: None. // Throws: None. //-- -CMIDriverBase::~CMIDriverBase() { m_pDriverFallThru = NULL; } +CMIDriverBase::~CMIDriverBase() { m_pDriverFallThru = nullptr; } //++ // Details: This function allows *this driver to call on another driver to Index: tools/lldb-mi/MIDriverMgr.cpp =================================================================== --- tools/lldb-mi/MIDriverMgr.cpp +++ tools/lldb-mi/MIDriverMgr.cpp @@ -135,7 +135,7 @@ } m_mapDriverIdToDriver.clear(); - m_pDriverCurrent = NULL; + m_pDriverCurrent = nullptr; return MIstatus::success; } Index: tools/lldb-server/lldb-gdbserver.cpp =================================================================== --- tools/lldb-server/lldb-gdbserver.cpp +++ tools/lldb-server/lldb-gdbserver.cpp @@ -87,22 +87,22 @@ static struct option g_long_options[] = { {"debug", no_argument, &g_debug, 1}, {"verbose", no_argument, &g_verbose, 1}, - {"log-file", required_argument, NULL, 'l'}, - {"log-channels", required_argument, NULL, 'c'}, - {"attach", required_argument, NULL, 'a'}, - {"named-pipe", required_argument, NULL, 'N'}, - {"pipe", required_argument, NULL, 'U'}, - {"native-regs", no_argument, NULL, + {"log-file", required_argument, nullptr, 'l'}, + {"log-channels", required_argument, nullptr, 'c'}, + {"attach", required_argument, nullptr, 'a'}, + {"named-pipe", required_argument, nullptr, 'N'}, + {"pipe", required_argument, nullptr, 'U'}, + {"native-regs", no_argument, nullptr, 'r'}, // Specify to use the native registers instead of the gdb defaults // for the architecture. NOTE: this is a do-nothing arg as it's // behavior is default now. FIXME remove call from lldb-platform. - {"reverse-connect", no_argument, NULL, + {"reverse-connect", no_argument, nullptr, 'R'}, // Specifies that llgs attaches to the client address:port rather // than llgs listening for a connection from address on port. - {"setsid", no_argument, NULL, + {"setsid", no_argument, nullptr, 'S'}, // Call setsid() to make llgs run in its own session. - {"fd", required_argument, NULL, 'F'}, - {NULL, 0, NULL, 0}}; + {"fd", required_argument, nullptr, 'F'}, + {nullptr, 0, nullptr, 0}}; // Watch for signals static int g_sighup_received_count = 0; Index: tools/lldb-server/lldb-platform.cpp =================================================================== --- tools/lldb-server/lldb-platform.cpp +++ tools/lldb-server/lldb-platform.cpp @@ -48,16 +48,16 @@ static struct option g_long_options[] = { {"debug", no_argument, &g_debug, 1}, {"verbose", no_argument, &g_verbose, 1}, - {"log-file", required_argument, NULL, 'l'}, - {"log-channels", required_argument, NULL, 'c'}, - {"listen", required_argument, NULL, 'L'}, - {"port-offset", required_argument, NULL, 'p'}, - {"gdbserver-port", required_argument, NULL, 'P'}, - {"min-gdbserver-port", required_argument, NULL, 'm'}, - {"max-gdbserver-port", required_argument, NULL, 'M'}, - {"socket-file", required_argument, NULL, 'f'}, + {"log-file", required_argument, nullptr, 'l'}, + {"log-channels", required_argument, nullptr, 'c'}, + {"listen", required_argument, nullptr, 'L'}, + {"port-offset", required_argument, nullptr, 'p'}, + {"gdbserver-port", required_argument, nullptr, 'P'}, + {"min-gdbserver-port", required_argument, nullptr, 'm'}, + {"max-gdbserver-port", required_argument, nullptr, 'M'}, + {"socket-file", required_argument, nullptr, 'f'}, {"server", no_argument, &g_server, 1}, - {NULL, 0, NULL, 0}}; + {nullptr, 0, nullptr, 0}}; #if defined(__APPLE__) #define LOW_PORT (IPPORT_RESERVED) Index: unittests/Utility/StringExtractorTest.cpp =================================================================== --- unittests/Utility/StringExtractorTest.cpp +++ unittests/Utility/StringExtractorTest.cpp @@ -318,7 +318,7 @@ ASSERT_EQ(UINT64_MAX, ex.GetFilePos()); ASSERT_EQ(false, ex.Empty()); ASSERT_EQ(0u, ex.GetBytesLeft()); - ASSERT_EQ(0, ex.Peek()); + ASSERT_EQ(nullptr, ex.Peek()); } TEST_F(StringExtractorTest, GetHexBytes_Partial) { Index: unittests/tools/lldb-server/inferior/thread_inferior.cpp =================================================================== --- unittests/tools/lldb-server/inferior/thread_inferior.cpp +++ unittests/tools/lldb-server/inferior/thread_inferior.cpp @@ -28,7 +28,7 @@ } // Cause a break. - volatile char *p = NULL; + volatile char *p = nullptr; *p = 'a'; delay.store(false); Index: unittests/tools/lldb-server/tests/MessageObjects.cpp =================================================================== --- unittests/tools/lldb-server/tests/MessageObjects.cpp +++ unittests/tools/lldb-server/tests/MessageObjects.cpp @@ -154,10 +154,10 @@ LLDB_INVALID_REGNUM, // process plugin reg num LLDB_INVALID_REGNUM // native register number }, - NULL, - NULL, - NULL, // Dwarf expression opcode bytes pointer - 0 // Dwarf expression opcode bytes length + nullptr, + nullptr, + nullptr, // Dwarf expression opcode bytes pointer + 0 // Dwarf expression opcode bytes length }; Info.name = ConstString(Elements["name"]).GetCString(); if (!Info.name)