diff options
| author | Konrad Kleine <kkleine@redhat.com> | 2019-05-23 11:14:47 +0000 |
|---|---|---|
| committer | Konrad Kleine <kkleine@redhat.com> | 2019-05-23 11:14:47 +0000 |
| commit | 248a13057a4adbdb8d511b1458daf39d01a4b520 (patch) | |
| tree | 1209fb0822f0c14237eb9935e30da465014a6eda /lldb/source/Core | |
| parent | 32d976bac194d78656974e3e05bf52997a06f509 (diff) | |
| download | bcm5719-llvm-248a13057a4adbdb8d511b1458daf39d01a4b520.tar.gz bcm5719-llvm-248a13057a4adbdb8d511b1458daf39d01a4b520.zip | |
[lldb] NFC modernize codebase with modernize-use-nullptr
Summary:
NFC = [[ https://llvm.org/docs/Lexicon.html#nfc | Non functional change ]]
This commit is the result of modernizing the LLDB codebase by using
`nullptr` instread of `0` or `NULL`. See
https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-nullptr.html
for more information.
This is the command I ran and I to fix and format the code base:
```
run-clang-tidy.py \
-header-filter='.*' \
-checks='-*,modernize-use-nullptr' \
-fix ~/dev/llvm-project/lldb/.* \
-format \
-style LLVM \
-p ~/llvm-builds/debug-ninja-gcc
```
NOTE: There were also changes to `llvm/utils/unittest` but I did not
include them because I felt that maybe this library shall be updated in
isolation somehow.
NOTE: I know this is a rather large commit but it is a nobrainer in most
parts.
Reviewers: martong, espindola, shafik, #lldb, JDevlieghere
Reviewed By: JDevlieghere
Subscribers: arsenm, jvesely, nhaehnle, hiraditya, JDevlieghere, teemperor, rnkovacs, emaste, kubamracek, nemanjai, ki.stfu, javed.absar, arichardson, kbarton, jrtc27, MaskRay, atanasyan, dexonsmith, arphaman, jfb, jsji, jdoerfert, lldb-commits, llvm-commits
Tags: #lldb, #llvm
Differential Revision: https://reviews.llvm.org/D61847
llvm-svn: 361484
Diffstat (limited to 'lldb/source/Core')
| -rw-r--r-- | lldb/source/Core/Communication.cpp | 2 | ||||
| -rw-r--r-- | lldb/source/Core/Debugger.cpp | 4 | ||||
| -rw-r--r-- | lldb/source/Core/Mangled.cpp | 2 | ||||
| -rw-r--r-- | lldb/source/Core/Section.cpp | 14 | ||||
| -rw-r--r-- | lldb/source/Core/SourceManager.cpp | 10 | ||||
| -rw-r--r-- | lldb/source/Core/Value.cpp | 30 | ||||
| -rw-r--r-- | lldb/source/Core/ValueObject.cpp | 67 | ||||
| -rw-r--r-- | lldb/source/Core/ValueObjectConstResultImpl.cpp | 20 | ||||
| -rw-r--r-- | lldb/source/Core/ValueObjectMemory.cpp | 2 | ||||
| -rw-r--r-- | lldb/source/Core/ValueObjectRegister.cpp | 20 | ||||
| -rw-r--r-- | lldb/source/Core/ValueObjectVariable.cpp | 8 |
11 files changed, 90 insertions, 89 deletions
diff --git a/lldb/source/Core/Communication.cpp b/lldb/source/Core/Communication.cpp index ed5f5a559c5..f2919d807d5 100644 --- a/lldb/source/Core/Communication.cpp +++ b/lldb/source/Core/Communication.cpp @@ -359,7 +359,7 @@ lldb::thread_result_t Communication::ReadThread(lldb::thread_arg_t p) { // Let clients know that this thread is exiting comm->BroadcastEvent(eBroadcastBitNoMorePendingInput); comm->BroadcastEvent(eBroadcastBitReadThreadDidExit); - return NULL; + return nullptr; } void Communication::SetReadThreadBytesReceivedCallback( diff --git a/lldb/source/Core/Debugger.cpp b/lldb/source/Core/Debugger.cpp index 7f180c1575a..79402813e84 100644 --- a/lldb/source/Core/Debugger.cpp +++ b/lldb/source/Core/Debugger.cpp @@ -1616,7 +1616,7 @@ void Debugger::DefaultEventHandler() { 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 @@ lldb::thread_result_t Debugger::IOHandlerThread(lldb::thread_arg_t arg) { Debugger *debugger = (Debugger *)arg; debugger->ExecuteIOHandlers(); debugger->StopEventHandlerThread(); - return NULL; + return nullptr; } bool Debugger::HasIOHandlerThread() { return m_io_handler_thread.IsJoinable(); } diff --git a/lldb/source/Core/Mangled.cpp b/lldb/source/Core/Mangled.cpp index 608ea8964e7..c6759cc944c 100644 --- a/lldb/source/Core/Mangled.cpp +++ b/lldb/source/Core/Mangled.cpp @@ -160,7 +160,7 @@ Mangled::~Mangled() {} // if (mangled) // { ... Mangled::operator void *() const { - return (m_mangled) ? const_cast<Mangled *>(this) : NULL; + return (m_mangled) ? const_cast<Mangled *>(this) : nullptr; } // Logical NOT operator. This allows code to check any Mangled objects to see diff --git a/lldb/source/Core/Section.cpp b/lldb/source/Core/Section.cpp index 05d1468314c..a0d4cee4739 100644 --- a/lldb/source/Core/Section.cpp +++ b/lldb/source/Core/Section.cpp @@ -342,7 +342,7 @@ void Section::DumpName(Stream *s) const { 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 @@ SectionList::FindSectionByName(ConstString section_dstr) const { 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 @@ SectionSP SectionList::FindSectionByID(user_id_t sect_id) const { 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 @@ SectionSP SectionList::FindSectionContainingFileAddress(addr_t vm_addr, 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 @@ SectionSP SectionList::FindSectionContainingFileAddress(addr_t vm_addr, 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 @@ SectionSP SectionList::FindSectionContainingFileAddress(addr_t vm_addr, } 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 @@ void SectionList::Dump(Stream *s, Target *target, bool show_header, 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()) diff --git a/lldb/source/Core/SourceManager.cpp b/lldb/source/Core/SourceManager.cpp index 9cd9ac163fb..87065ab6242 100644 --- a/lldb/source/Core/SourceManager.cpp +++ b/lldb/source/Core/SourceManager.cpp @@ -326,7 +326,7 @@ bool SourceManager::GetDefaultFileAndLine(FileSpec &file_spec, uint32_t &line) { 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 @@ void SourceManager::File::CommonInitializer(const FileSpec &file_spec, 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 @@ uint32_t SourceManager::File::GetNumLines() { 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 @@ bool SourceManager::File::CalculateLineOffsets(uint32_t line) { 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(); diff --git a/lldb/source/Core/Value.cpp b/lldb/source/Core/Value.cpp index 541e0933bca..fdb4adb5f43 100644 --- a/lldb/source/Core/Value.cpp +++ b/lldb/source/Core/Value.cpp @@ -39,17 +39,17 @@ using namespace lldb; 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 @@ AddressType Value::GetValueAddressType() const { RegisterInfo *Value::GetRegisterInfo() const { if (m_context_type == eContextTypeRegisterInfo) return static_cast<RegisterInfo *>(m_context); - return NULL; + return nullptr; } Type *Value::GetType() { if (m_context_type == eContextTypeLLDBType) return static_cast<Type *>(m_context); - return NULL; + return nullptr; } size_t Value::AppendDataToHostBuffer(const Value &rhs) { @@ -353,11 +353,11 @@ Status Value::GetValueAsData(ExecutionContext *exe_ctx, DataExtractor &data, 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 @@ Status Value::GetValueAsData(ExecutionContext *exe_ctx, DataExtractor &data, 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 @@ Status Value::GetValueAsData(ExecutionContext *exe_ctx, DataExtractor &data, } uint8_t *dst = const_cast<uint8_t *>(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 @@ Scalar &Value::ResolveValue(ExecutionContext *exe_ctx) { { 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 @@ Scalar &Value::ResolveValue(ExecutionContext *exe_ctx) { Variable *Value::GetVariable() { if (m_context_type == eContextTypeVariable) return static_cast<Variable *>(m_context); - return NULL; + return nullptr; } void Value::Clear() { @@ -633,7 +633,7 @@ void Value::Clear() { 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 @@ Value *ValueList::GetValueAtIndex(size_t idx) { if (idx < GetSize()) { return &(m_values[idx]); } else - return NULL; + return nullptr; } void ValueList::Clear() { m_values.clear(); } diff --git a/lldb/source/Core/ValueObject.cpp b/lldb/source/Core/ValueObject.cpp index 8bb542263f9..e083b8dc086 100644 --- a/lldb/source/Core/ValueObject.cpp +++ b/lldb/source/Core/ValueObject.cpp @@ -81,12 +81,13 @@ static user_id_t g_value_obj_uid = 0; // 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(ValueObject &parent) 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 @@ ValueObjectSP ValueObject::GetChildAtIndex(size_t idx, bool can_create) { } ValueObject *child = m_children.GetChildAtIndex(idx); - if (child != NULL) + if (child != nullptr) return child->GetSP(); } return child_sp; @@ -617,7 +618,7 @@ void ValueObject::SetName(ConstString name) { m_name = name; } 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 @@ const char *ValueObject::GetSummaryAsCString(lldb::LanguageType lang) { summary_options); } if (m_summary_str.empty()) - return NULL; + return nullptr; return m_summary_str.c_str(); } @@ -763,12 +764,12 @@ size_t ValueObject::GetPointeeData(DataExtractor &data, uint32_t item_idx, 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 @@ size_t ValueObject::GetPointeeData(DataExtractor &data, uint32_t item_idx, } 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 @@ ValueObject::ReadPointedString(lldb::DataBufferSP &buffer_sp, Status &error, 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 @@ const char *ValueObject::GetValueAsCString() { } } if (m_value_str.empty()) - return NULL; + return nullptr; return m_value_str.c_str(); } @@ -1281,7 +1282,7 @@ bool ValueObject::DumpPrintableRepresentation( 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 @@ ValueObject::GetTypeInfo(CompilerType *pointee_or_element_compiler_type) { 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 @@ bool ValueObject::IsPossibleDynamicType() { 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 @@ ValueObject::GetSyntheticExpressionPathChild(const char *expression, // 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 @@ void ValueObject::CalculateSyntheticValue(bool use_synthetic) { TargetSP target_sp(GetTargetSP()); if (target_sp && !target_sp->GetEnableSyntheticValue()) { - m_synthetic_value = NULL; + m_synthetic_value = nullptr; return; } @@ -1932,7 +1933,7 @@ void ValueObject::CalculateSyntheticValue(bool use_synthetic) { 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 @@ ValueObjectSP ValueObject::GetDynamicValue(DynamicValueType use_dynamic) { 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 @@ ValueObjectSP ValueObject::GetSyntheticValue(bool use_synthetic) { 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 @@ ValueObject *ValueObject::GetNonBaseClassParent() { else return GetParent(); } - return NULL; + return nullptr; } bool ValueObject::IsBaseClass(uint32_t &depth) { @@ -3005,12 +3006,12 @@ bool ValueObject::EvaluationPoint::SyncWithProcessState( 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 @@ void ValueObject::ClearUserVisibleData(uint32_t clear_mask) { 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 @@ SymbolContextScope *ValueObject::GetSymbolContextScope() { if (!m_parent->IsPointerOrReferenceType()) return m_parent->GetSymbolContextScope(); } - return NULL; + return nullptr; } lldb::ValueObjectSP diff --git a/lldb/source/Core/ValueObjectConstResultImpl.cpp b/lldb/source/Core/ValueObjectConstResultImpl.cpp index aeea1743682..de51735736b 100644 --- a/lldb/source/Core/ValueObjectConstResultImpl.cpp +++ b/lldb/source/Core/ValueObjectConstResultImpl.cpp @@ -39,7 +39,7 @@ ValueObjectConstResultImpl::ValueObjectConstResultImpl( 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 @@ lldb::ValueObjectSP ValueObjectConstResultImpl::Dereference(Status &error) { 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 @@ ValueObject *ValueObjectConstResultImpl::CreateChildAtIndex( 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::GetSyntheticChildAtOffset( } 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::AddressOf(Status &error) { 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 @@ lldb::addr_t 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 @@ ValueObjectConstResultImpl::GetAddressOf(bool scalar_is_load_address, 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); diff --git a/lldb/source/Core/ValueObjectMemory.cpp b/lldb/source/Core/ValueObjectMemory.cpp index 42d1263b390..95d4330ee0c 100644 --- a/lldb/source/Core/ValueObjectMemory.cpp +++ b/lldb/source/Core/ValueObjectMemory.cpp @@ -49,7 +49,7 @@ ValueObjectMemory::ValueObjectMemory(ExecutionContextScope *exe_scope, : 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()); diff --git a/lldb/source/Core/ValueObjectRegister.cpp b/lldb/source/Core/ValueObjectRegister.cpp index 1d12747649e..75a254fbbc2 100644 --- a/lldb/source/Core/ValueObjectRegister.cpp +++ b/lldb/source/Core/ValueObjectRegister.cpp @@ -76,7 +76,7 @@ bool ValueObjectRegisterContext::UpdateValue() { 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 @@ bool ValueObjectRegisterContext::UpdateValue() { 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::Create(ExecutionContextScope *exe_scope, 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 @@ bool ValueObjectRegisterSet::UpdateValue() { 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 @@ bool ValueObjectRegisterSet::UpdateValue() { 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 @@ ValueObject *ValueObjectRegisterSet::CreateChildAtIndex( 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 @@ ValueObjectRegisterSet::GetIndexOfChildWithName(ConstString name) { 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 @@ bool ValueObjectRegister::UpdateValue() { 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(); } diff --git a/lldb/source/Core/ValueObjectVariable.cpp b/lldb/source/Core/ValueObjectVariable.cpp index dae9c709ecd..5aee82493b2 100644 --- a/lldb/source/Core/ValueObjectVariable.cpp +++ b/lldb/source/Core/ValueObjectVariable.cpp @@ -57,7 +57,7 @@ ValueObjectVariable::ValueObjectVariable(ExecutionContextScope *exe_scope, 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 @@ bool ValueObjectVariable::UpdateValue() { 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 @@ bool ValueObjectVariable::UpdateValue() { 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 @@ lldb::ModuleSP ValueObjectVariable::GetModule() { SymbolContextScope *ValueObjectVariable::GetSymbolContextScope() { if (m_variable_sp) return m_variable_sp->GetSymbolContextScope(); - return NULL; + return nullptr; } bool ValueObjectVariable::GetDeclaration(Declaration &decl) { |

