diff options
Diffstat (limited to 'source/DataFormatters')
| -rw-r--r-- | source/DataFormatters/CXXFunctionPointer.cpp | 2 | ||||
| -rw-r--r-- | source/DataFormatters/DataVisualization.cpp | 8 | ||||
| -rw-r--r-- | source/DataFormatters/DumpValueObjectOptions.cpp | 6 | ||||
| -rw-r--r-- | source/DataFormatters/FormatCache.cpp | 4 | ||||
| -rw-r--r-- | source/DataFormatters/FormatClasses.cpp | 4 | ||||
| -rw-r--r-- | source/DataFormatters/FormatManager.cpp | 18 | ||||
| -rw-r--r-- | source/DataFormatters/FormattersHelpers.cpp | 4 | ||||
| -rw-r--r-- | source/DataFormatters/LanguageCategory.cpp | 4 | ||||
| -rw-r--r-- | source/DataFormatters/StringPrinter.cpp | 2 | ||||
| -rw-r--r-- | source/DataFormatters/TypeCategory.cpp | 9 | ||||
| -rw-r--r-- | source/DataFormatters/TypeCategoryMap.cpp | 7 | ||||
| -rw-r--r-- | source/DataFormatters/TypeFormat.cpp | 29 | ||||
| -rw-r--r-- | source/DataFormatters/TypeSummary.cpp | 6 | ||||
| -rw-r--r-- | source/DataFormatters/TypeSynthetic.cpp | 4 | ||||
| -rw-r--r-- | source/DataFormatters/TypeValidator.cpp | 4 | ||||
| -rw-r--r-- | source/DataFormatters/ValueObjectPrinter.cpp | 16 | ||||
| -rw-r--r-- | source/DataFormatters/VectorType.cpp | 22 |
17 files changed, 45 insertions, 104 deletions
diff --git a/source/DataFormatters/CXXFunctionPointer.cpp b/source/DataFormatters/CXXFunctionPointer.cpp index fad67a9d5b7a..9059891e5e9b 100644 --- a/source/DataFormatters/CXXFunctionPointer.cpp +++ b/source/DataFormatters/CXXFunctionPointer.cpp @@ -38,7 +38,7 @@ bool lldb_private::formatters::CXXFunctionPointerSummaryProvider( Address so_addr; Target *target = exe_ctx.GetTargetPtr(); - if (target && target->GetSectionLoadList().IsEmpty() == false) { + if (target && !target->GetSectionLoadList().IsEmpty()) { if (target->GetSectionLoadList().ResolveLoadAddress(func_ptr_address, so_addr)) { so_addr.Dump(&sstr, exe_ctx.GetBestExecutionContextScope(), diff --git a/source/DataFormatters/DataVisualization.cpp b/source/DataFormatters/DataVisualization.cpp index 2a2d4b8b553e..23b8b6e128c8 100644 --- a/source/DataFormatters/DataVisualization.cpp +++ b/source/DataFormatters/DataVisualization.cpp @@ -10,10 +10,6 @@ #include "lldb/DataFormatters/DataVisualization.h" -// C Includes -// C++ Includes -// Other libraries and framework includes -// Project includes using namespace lldb; using namespace lldb_private; @@ -149,7 +145,7 @@ void DataVisualization::Categories::Enable(lldb::LanguageType lang_type) { } void DataVisualization::Categories::Disable(const ConstString &category) { - if (GetFormatManager().GetCategory(category)->IsEnabled() == true) + if (GetFormatManager().GetCategory(category)->IsEnabled()) GetFormatManager().DisableCategory(category); } @@ -170,7 +166,7 @@ void DataVisualization::Categories::Enable( void DataVisualization::Categories::Disable( const lldb::TypeCategoryImplSP &category) { - if (category.get() && category->IsEnabled() == true) + if (category.get() && category->IsEnabled()) GetFormatManager().DisableCategory(category); } diff --git a/source/DataFormatters/DumpValueObjectOptions.cpp b/source/DataFormatters/DumpValueObjectOptions.cpp index 7c9d5eb77a01..17f8d00ff493 100644 --- a/source/DataFormatters/DumpValueObjectOptions.cpp +++ b/source/DataFormatters/DumpValueObjectOptions.cpp @@ -10,10 +10,6 @@ #include "lldb/DataFormatters/DumpValueObjectOptions.h" -// C Includes -// C++ Includes -// Other libraries and framework includes -// Project includes #include "lldb/Core/ValueObject.h" using namespace lldb; @@ -71,7 +67,7 @@ DumpValueObjectOptions &DumpValueObjectOptions::SetUseObjectiveC(bool use) { } DumpValueObjectOptions &DumpValueObjectOptions::SetShowSummary(bool show) { - if (show == false) + if (!show) SetOmitSummaryDepth(UINT32_MAX); else SetOmitSummaryDepth(0); diff --git a/source/DataFormatters/FormatCache.cpp b/source/DataFormatters/FormatCache.cpp index 0f1b29f1b476..bb5f379d3c73 100644 --- a/source/DataFormatters/FormatCache.cpp +++ b/source/DataFormatters/FormatCache.cpp @@ -8,13 +8,9 @@ // //===----------------------------------------------------------------------===// -// C Includes -// C++ Includes -// Other libraries and framework includes -// Project includes #include "lldb/DataFormatters/FormatCache.h" using namespace lldb; diff --git a/source/DataFormatters/FormatClasses.cpp b/source/DataFormatters/FormatClasses.cpp index f657361d3d5d..1c595c3c04e5 100644 --- a/source/DataFormatters/FormatClasses.cpp +++ b/source/DataFormatters/FormatClasses.cpp @@ -12,13 +12,9 @@ #include "lldb/DataFormatters/FormatManager.h" -// C Includes -// C++ Includes -// Other libraries and framework includes -// Project includes using namespace lldb; using namespace lldb_private; diff --git a/source/DataFormatters/FormatManager.cpp b/source/DataFormatters/FormatManager.cpp index bafee1799b80..da03c64b0f8c 100644 --- a/source/DataFormatters/FormatManager.cpp +++ b/source/DataFormatters/FormatManager.cpp @@ -11,10 +11,6 @@ #include "llvm/ADT/STLExtras.h" -// C Includes -// C++ Includes -// Other libraries and framework includes -// Project includes #include "lldb/Core/Debugger.h" #include "lldb/DataFormatters/FormattersHelpers.h" @@ -297,7 +293,7 @@ FormatManager::GetFormatForType(lldb::TypeNameSpecifierImplSP type_sp) { uint32_t prio_category = UINT32_MAX; for (uint32_t category_id = 0; category_id < num_categories; category_id++) { category_sp = GetCategoryAtIndex(category_id); - if (category_sp->IsEnabled() == false) + if (!category_sp->IsEnabled()) continue; lldb::TypeFormatImplSP format_current_sp = category_sp->GetFormatForType(type_sp); @@ -321,7 +317,7 @@ FormatManager::GetSummaryForType(lldb::TypeNameSpecifierImplSP type_sp) { uint32_t prio_category = UINT32_MAX; for (uint32_t category_id = 0; category_id < num_categories; category_id++) { category_sp = GetCategoryAtIndex(category_id); - if (category_sp->IsEnabled() == false) + if (!category_sp->IsEnabled()) continue; lldb::TypeSummaryImplSP summary_current_sp = category_sp->GetSummaryForType(type_sp); @@ -345,7 +341,7 @@ FormatManager::GetFilterForType(lldb::TypeNameSpecifierImplSP type_sp) { uint32_t prio_category = UINT32_MAX; for (uint32_t category_id = 0; category_id < num_categories; category_id++) { category_sp = GetCategoryAtIndex(category_id); - if (category_sp->IsEnabled() == false) + if (!category_sp->IsEnabled()) continue; lldb::TypeFilterImplSP filter_current_sp( (TypeFilterImpl *)category_sp->GetFilterForType(type_sp).get()); @@ -370,7 +366,7 @@ FormatManager::GetSyntheticForType(lldb::TypeNameSpecifierImplSP type_sp) { uint32_t prio_category = UINT32_MAX; for (uint32_t category_id = 0; category_id < num_categories; category_id++) { category_sp = GetCategoryAtIndex(category_id); - if (category_sp->IsEnabled() == false) + if (!category_sp->IsEnabled()) continue; lldb::ScriptedSyntheticChildrenSP synth_current_sp( (ScriptedSyntheticChildren *)category_sp->GetSyntheticForType(type_sp) @@ -410,7 +406,7 @@ FormatManager::GetValidatorForType(lldb::TypeNameSpecifierImplSP type_sp) { uint32_t prio_category = UINT32_MAX; for (uint32_t category_id = 0; category_id < num_categories; category_id++) { category_sp = GetCategoryAtIndex(category_id); - if (category_sp->IsEnabled() == false) + if (!category_sp->IsEnabled()) continue; lldb::TypeValidatorImplSP validator_current_sp( category_sp->GetValidatorForType(type_sp).get()); @@ -483,7 +479,7 @@ lldb::Format FormatManager::GetSingleItemFormat(lldb::Format vector_format) { bool FormatManager::ShouldPrintAsOneLiner(ValueObject &valobj) { // if settings say no oneline whatsoever if (valobj.GetTargetSP().get() && - valobj.GetTargetSP()->GetDebugger().GetAutoOneLineSummaries() == false) + !valobj.GetTargetSP()->GetDebugger().GetAutoOneLineSummaries()) return false; // then don't oneline // if this object has a summary, then ask the summary @@ -539,7 +535,7 @@ bool FormatManager::ShouldPrintAsOneLiner(ValueObject &valobj) { if (!synth_sp) return false; // but if we only have them to provide a value, keep going - if (synth_sp->MightHaveChildren() == false && + if (!synth_sp->MightHaveChildren() && synth_sp->DoesProvideSyntheticValue()) is_synth_val = true; else diff --git a/source/DataFormatters/FormattersHelpers.cpp b/source/DataFormatters/FormattersHelpers.cpp index 460a49690d3d..1a1321598966 100644 --- a/source/DataFormatters/FormattersHelpers.cpp +++ b/source/DataFormatters/FormattersHelpers.cpp @@ -8,13 +8,9 @@ // //===----------------------------------------------------------------------===// -// C Includes -// C++ Includes -// Other libraries and framework includes -// Project includes #include "lldb/DataFormatters/FormattersHelpers.h" #include "lldb/Target/StackFrame.h" diff --git a/source/DataFormatters/LanguageCategory.cpp b/source/DataFormatters/LanguageCategory.cpp index 251f0c368e08..4a4b7c544f09 100644 --- a/source/DataFormatters/LanguageCategory.cpp +++ b/source/DataFormatters/LanguageCategory.cpp @@ -10,10 +10,6 @@ #include "lldb/DataFormatters/LanguageCategory.h" -// C Includes -// C++ Includes -// Other libraries and framework includes -// Project includes #include "lldb/DataFormatters/FormatManager.h" #include "lldb/DataFormatters/TypeCategory.h" #include "lldb/DataFormatters/TypeFormat.h" diff --git a/source/DataFormatters/StringPrinter.cpp b/source/DataFormatters/StringPrinter.cpp index 89d7a95069ca..6a000f0f6431 100644 --- a/source/DataFormatters/StringPrinter.cpp +++ b/source/DataFormatters/StringPrinter.cpp @@ -312,7 +312,7 @@ static bool DumpUTFBufferToStream( utf8_data_end_ptr = utf8_data_ptr + utf8_data_buffer_sp->GetByteSize(); ConvertFunction(&data_ptr, data_end_ptr, &utf8_data_ptr, utf8_data_end_ptr, llvm::lenientConversion); - if (false == zero_is_terminator) + if (!zero_is_terminator) utf8_data_end_ptr = utf8_data_ptr; // needed because the ConvertFunction will change the value of the // data_ptr. diff --git a/source/DataFormatters/TypeCategory.cpp b/source/DataFormatters/TypeCategory.cpp index 184a8c98de62..5740a095f8bd 100644 --- a/source/DataFormatters/TypeCategory.cpp +++ b/source/DataFormatters/TypeCategory.cpp @@ -10,10 +10,6 @@ #include "lldb/DataFormatters/TypeCategory.h" #include "lldb/Target/Language.h" -// C Includes -// C++ Includes -// Other libraries and framework includes -// Project includes using namespace lldb; using namespace lldb_private; @@ -161,10 +157,7 @@ bool TypeCategoryImpl::Get(ValueObject &valobj, else /*if (filter_sp.get() && synth.get())*/ { - if (filter_sp->GetRevision() > synth->GetRevision()) - pick_synth = false; - else - pick_synth = true; + pick_synth = filter_sp->GetRevision() <= synth->GetRevision(); } if (pick_synth) { if (regex_synth && reason) diff --git a/source/DataFormatters/TypeCategoryMap.cpp b/source/DataFormatters/TypeCategoryMap.cpp index d2da672f13dc..3193f2703efa 100644 --- a/source/DataFormatters/TypeCategoryMap.cpp +++ b/source/DataFormatters/TypeCategoryMap.cpp @@ -13,10 +13,6 @@ #include "lldb/DataFormatters/FormatClasses.h" #include "lldb/Utility/Log.h" -// C Includes -// C++ Includes -// Other libraries and framework includes -// Project includes using namespace lldb; using namespace lldb_private; @@ -122,8 +118,7 @@ void TypeCategoryMap::EnableAllCategories() { void TypeCategoryMap::DisableAllCategories() { std::lock_guard<std::recursive_mutex> guard(m_map_mutex); - Position p = First; - for (; false == m_active_categories.empty(); p++) { + for (Position p = First; !m_active_categories.empty(); p++) { m_active_categories.front()->SetEnabledPosition(p); Disable(m_active_categories.front()); } diff --git a/source/DataFormatters/TypeFormat.cpp b/source/DataFormatters/TypeFormat.cpp index 7902ccb47771..f00a679cecfd 100644 --- a/source/DataFormatters/TypeFormat.cpp +++ b/source/DataFormatters/TypeFormat.cpp @@ -9,13 +9,9 @@ #include "lldb/DataFormatters/TypeFormat.h" -// C Includes -// C++ Includes -// Other libraries and framework includes -// Project includes #include "lldb/lldb-enumerations.h" #include "lldb/lldb-public.h" @@ -98,16 +94,18 @@ bool TypeFormatImpl_Format::FormatObject(ValueObject *valobj, return false; } + ExecutionContextScope *exe_scope = + exe_ctx.GetBestExecutionContextScope(); + llvm::Optional<uint64_t> size = compiler_type.GetByteSize(exe_scope); + if (!size) + return false; StreamString sstr; - ExecutionContextScope *exe_scope( - exe_ctx.GetBestExecutionContextScope()); compiler_type.DumpTypeValue( - &sstr, // The stream to use for display - GetFormat(), // Format to display this type with - data, // Data to extract from - 0, // Byte offset into "m_data" - compiler_type.GetByteSize( - exe_scope), // Byte size of item in "m_data" + &sstr, // The stream to use for display + GetFormat(), // Format to display this type with + data, // Data to extract from + 0, // Byte offset into "m_data" + *size, // Byte size of item in "m_data" valobj->GetBitfieldBitSize(), // Bitfield bit size valobj->GetBitfieldBitOffset(), // Bitfield bit offset exe_scope); @@ -163,11 +161,10 @@ bool TypeFormatImpl_EnumType::FormatObject(ValueObject *valobj, if (!target_sp) return false; const ModuleList &images(target_sp->GetImages()); - SymbolContext sc; TypeList types; llvm::DenseSet<lldb_private::SymbolFile *> searched_symbol_files; - images.FindTypes(sc, m_enum_type, false, UINT32_MAX, searched_symbol_files, - types); + images.FindTypes(nullptr, m_enum_type, false, UINT32_MAX, + searched_symbol_files, types); if (types.GetSize() == 0) return false; for (lldb::TypeSP type_sp : types.Types()) { @@ -182,7 +179,7 @@ bool TypeFormatImpl_EnumType::FormatObject(ValueObject *valobj, } } else valobj_enum_type = iter->second; - if (valobj_enum_type.IsValid() == false) + if (!valobj_enum_type.IsValid()) return false; DataExtractor data; Status error; diff --git a/source/DataFormatters/TypeSummary.cpp b/source/DataFormatters/TypeSummary.cpp index 09a7ff8d7d36..492d3efc7f4c 100644 --- a/source/DataFormatters/TypeSummary.cpp +++ b/source/DataFormatters/TypeSummary.cpp @@ -9,13 +9,9 @@ #include "lldb/DataFormatters/TypeSummary.h" -// C Includes -// C++ Includes -// Other libraries and framework includes -// Project includes #include "lldb/lldb-enumerations.h" #include "lldb/lldb-public.h" @@ -139,7 +135,7 @@ bool CXXFunctionSummaryFormat::FormatObject(ValueObject *valobj, const TypeSummaryOptions &options) { dest.clear(); StreamString stream; - if (!m_impl || m_impl(*valobj, stream, options) == false) + if (!m_impl || !m_impl(*valobj, stream, options)) return false; dest = stream.GetString(); return true; diff --git a/source/DataFormatters/TypeSynthetic.cpp b/source/DataFormatters/TypeSynthetic.cpp index 28a51dae6b20..de46d505349b 100644 --- a/source/DataFormatters/TypeSynthetic.cpp +++ b/source/DataFormatters/TypeSynthetic.cpp @@ -8,13 +8,9 @@ // //===----------------------------------------------------------------------===// -// C Includes -// C++ Includes -// Other libraries and framework includes -// Project includes #include "lldb/lldb-enumerations.h" #include "lldb/lldb-public.h" diff --git a/source/DataFormatters/TypeValidator.cpp b/source/DataFormatters/TypeValidator.cpp index 7a5b8d565292..6769a5a99856 100644 --- a/source/DataFormatters/TypeValidator.cpp +++ b/source/DataFormatters/TypeValidator.cpp @@ -7,13 +7,9 @@ // //===----------------------------------------------------------------------===// -// C Includes -// C++ Includes -// Other libraries and framework includes -// Project includes #include "lldb/DataFormatters/TypeValidator.h" #include "lldb/Utility/StreamString.h" diff --git a/source/DataFormatters/ValueObjectPrinter.cpp b/source/DataFormatters/ValueObjectPrinter.cpp index 43e91a2b6c92..082158822dff 100644 --- a/source/DataFormatters/ValueObjectPrinter.cpp +++ b/source/DataFormatters/ValueObjectPrinter.cpp @@ -9,10 +9,6 @@ #include "lldb/DataFormatters/ValueObjectPrinter.h" -// C Includes -// C++ Includes -// Other libraries and framework includes -// Project includes #include "lldb/Core/ValueObject.h" #include "lldb/DataFormatters/DataVisualization.h" #include "lldb/Interpreter/CommandInterpreter.h" @@ -133,13 +129,13 @@ bool ValueObjectPrinter::GetMostSpecializedValue() { } if (m_valobj->IsSynthetic()) { - if (m_options.m_use_synthetic == false) { + if (!m_options.m_use_synthetic) { ValueObject *non_synthetic = m_valobj->GetNonSyntheticValue().get(); if (non_synthetic) m_valobj = non_synthetic; } } else { - if (m_options.m_use_synthetic == true) { + if (m_options.m_use_synthetic) { ValueObject *synthetic = m_valobj->GetSyntheticValue().get(); if (synthetic) m_valobj = synthetic; @@ -170,7 +166,7 @@ const char *ValueObjectPrinter::GetRootNameForDisplay(const char *if_fail) { bool ValueObjectPrinter::ShouldPrintValueObject() { if (m_should_print == eLazyBoolCalculate) m_should_print = - (m_options.m_flat_output == false || m_type_flags.Test(eTypeHasValue)) + (!m_options.m_flat_output || m_type_flags.Test(eTypeHasValue)) ? eLazyBoolYes : eLazyBoolNo; return m_should_print == eLazyBoolYes; @@ -330,7 +326,7 @@ bool ValueObjectPrinter::CheckScopeIfNeeded() { } TypeSummaryImpl *ValueObjectPrinter::GetSummaryFormatter(bool null_if_omitted) { - if (m_summary_formatter.second == false) { + if (!m_summary_formatter.second) { TypeSummaryImpl *entry = m_options.m_summary_sp ? m_options.m_summary_sp.get() : m_valobj->GetSummaryFormat().get(); @@ -462,7 +458,7 @@ bool ValueObjectPrinter::PrintObjectDescriptionIfNeeded(bool value_printed, else m_stream->Printf("%s\n", object_desc); return true; - } else if (value_printed == false && summary_printed == false) + } else if (!value_printed && !summary_printed) return true; else return false; @@ -629,7 +625,7 @@ bool ValueObjectPrinter::ShouldPrintEmptyBrackets(bool value_printed, if (!IsAggregate()) return false; - if (m_options.m_reveal_empty_aggregates == false) { + if (!m_options.m_reveal_empty_aggregates) { if (value_printed || summary_printed) return false; } diff --git a/source/DataFormatters/VectorType.cpp b/source/DataFormatters/VectorType.cpp index d85a7e674177..b11fb1456afa 100644 --- a/source/DataFormatters/VectorType.cpp +++ b/source/DataFormatters/VectorType.cpp @@ -7,10 +7,6 @@ // //===----------------------------------------------------------------------===// -// C Includes -// C++ Includes -// Other libraries and framework includes -// Project includes #include "lldb/DataFormatters/VectorType.h" #include "lldb/Core/ValueObject.h" @@ -175,13 +171,14 @@ static size_t CalculateNumChildren( lldb_private::ExecutionContextScope *exe_scope = nullptr // does not matter here because all we trade in are basic types ) { - auto container_size = container_type.GetByteSize(exe_scope); - auto element_size = element_type.GetByteSize(exe_scope); + llvm::Optional<uint64_t> container_size = + container_type.GetByteSize(exe_scope); + llvm::Optional<uint64_t> element_size = element_type.GetByteSize(exe_scope); - if (element_size) { - if (container_size % element_size) + if (container_size && element_size && *element_size) { + if (*container_size % *element_size) return 0; - return container_size / element_size; + return *container_size / *element_size; } return 0; } @@ -201,8 +198,11 @@ public: lldb::ValueObjectSP GetChildAtIndex(size_t idx) override { if (idx >= CalculateNumChildren()) - return lldb::ValueObjectSP(); - auto offset = idx * m_child_type.GetByteSize(nullptr); + return {}; + llvm::Optional<uint64_t> size = m_child_type.GetByteSize(nullptr); + if (!size) + return {}; + auto offset = idx * *size; StreamString idx_name; idx_name.Printf("[%" PRIu64 "]", (uint64_t)idx); ValueObjectSP child_sp(m_backend.GetSyntheticChildAtOffset( |
