From 1a81b273783119bcce4e81f6c31bd6b422f1029f Mon Sep 17 00:00:00 2001 From: Jim Ingham Date: Tue, 13 Sep 2016 01:58:08 +0000 Subject: [PATCH] Add a few const's (thanks Zachary) and return shared or unique pointers in places where they help prevent leaks. llvm-svn: 281288 --- lldb/include/lldb/Breakpoint/BreakpointOptions.h | 9 ++-- lldb/include/lldb/Breakpoint/BreakpointResolver.h | 2 +- .../lldb/Breakpoint/BreakpointResolverAddress.h | 6 ++- .../lldb/Breakpoint/BreakpointResolverFileLine.h | 3 +- .../lldb/Breakpoint/BreakpointResolverFileRegex.h | 6 ++- .../lldb/Breakpoint/BreakpointResolverName.h | 3 +- lldb/include/lldb/Core/SearchFilter.h | 25 +++++---- lldb/include/lldb/Target/LanguageRuntime.h | 3 +- lldb/source/Breakpoint/Breakpoint.cpp | 14 ++--- lldb/source/Breakpoint/BreakpointOptions.cpp | 28 +++++----- lldb/source/Breakpoint/BreakpointResolver.cpp | 2 +- .../Breakpoint/BreakpointResolverAddress.cpp | 3 +- .../Breakpoint/BreakpointResolverFileLine.cpp | 3 +- .../Breakpoint/BreakpointResolverFileRegex.cpp | 3 +- lldb/source/Breakpoint/BreakpointResolverName.cpp | 3 +- lldb/source/Core/SearchFilter.cpp | 61 ++++++++++++---------- lldb/source/Target/LanguageRuntime.cpp | 2 +- 17 files changed, 98 insertions(+), 78 deletions(-) diff --git a/lldb/include/lldb/Breakpoint/BreakpointOptions.h b/lldb/include/lldb/Breakpoint/BreakpointOptions.h index 5397fb6..d96c4ec 100644 --- a/lldb/include/lldb/Breakpoint/BreakpointOptions.h +++ b/lldb/include/lldb/Breakpoint/BreakpointOptions.h @@ -42,8 +42,8 @@ public: StructuredData::ObjectSP SerializeToStructuredData(); - static CommandData * - CreateFromStructuredData(StructuredData::Dictionary &options_dict, + static std::unique_ptr + CreateFromStructuredData(const StructuredData::Dictionary &options_dict, Error &error); StringList user_source; @@ -111,8 +111,9 @@ public: virtual ~BreakpointOptions(); - static BreakpointOptions * - CreateFromStructuredData(StructuredData::Dictionary &data_dict, Error &error); + static std::unique_ptr + CreateFromStructuredData(const StructuredData::Dictionary &data_dict, + Error &error); virtual StructuredData::ObjectSP SerializeToStructuredData(); diff --git a/lldb/include/lldb/Breakpoint/BreakpointResolver.h b/lldb/include/lldb/Breakpoint/BreakpointResolver.h index bac7ec6..cfbb7f6 100644 --- a/lldb/include/lldb/Breakpoint/BreakpointResolver.h +++ b/lldb/include/lldb/Breakpoint/BreakpointResolver.h @@ -140,7 +140,7 @@ public: /// objects. static lldb::BreakpointResolverSP - CreateFromStructuredData(StructuredData::Dictionary &resolver_dict, + CreateFromStructuredData(const StructuredData::Dictionary &resolver_dict, Error &error); virtual StructuredData::ObjectSP SerializeToStructuredData() { diff --git a/lldb/include/lldb/Breakpoint/BreakpointResolverAddress.h b/lldb/include/lldb/Breakpoint/BreakpointResolverAddress.h index ed2d61a..6d2d505 100644 --- a/lldb/include/lldb/Breakpoint/BreakpointResolverAddress.h +++ b/lldb/include/lldb/Breakpoint/BreakpointResolverAddress.h @@ -36,8 +36,10 @@ public: ~BreakpointResolverAddress() override; - static BreakpointResolver *CreateFromStructuredData( - Breakpoint *bkpt, StructuredData::Dictionary &options_dict, Error &error); + static BreakpointResolver * + CreateFromStructuredData(Breakpoint *bkpt, + const StructuredData::Dictionary &options_dict, + Error &error); StructuredData::ObjectSP SerializeToStructuredData() override; diff --git a/lldb/include/lldb/Breakpoint/BreakpointResolverFileLine.h b/lldb/include/lldb/Breakpoint/BreakpointResolverFileLine.h index 82ed24c..f1fdf60 100644 --- a/lldb/include/lldb/Breakpoint/BreakpointResolverFileLine.h +++ b/lldb/include/lldb/Breakpoint/BreakpointResolverFileLine.h @@ -35,7 +35,8 @@ public: static BreakpointResolver * CreateFromStructuredData(Breakpoint *bkpt, - StructuredData::Dictionary &data_dict, Error &error); + const StructuredData::Dictionary &data_dict, + Error &error); StructuredData::ObjectSP SerializeToStructuredData() override; diff --git a/lldb/include/lldb/Breakpoint/BreakpointResolverFileRegex.h b/lldb/include/lldb/Breakpoint/BreakpointResolverFileRegex.h index 4afe9b1..0429e26 100644 --- a/lldb/include/lldb/Breakpoint/BreakpointResolverFileRegex.h +++ b/lldb/include/lldb/Breakpoint/BreakpointResolverFileRegex.h @@ -35,8 +35,10 @@ public: Breakpoint *bkpt, RegularExpression ®ex, const std::unordered_set &func_name_set, bool exact_match); - static BreakpointResolver *CreateFromStructuredData( - Breakpoint *bkpt, StructuredData::Dictionary &options_dict, Error &error); + static BreakpointResolver * + CreateFromStructuredData(Breakpoint *bkpt, + const StructuredData::Dictionary &options_dict, + Error &error); StructuredData::ObjectSP SerializeToStructuredData() override; diff --git a/lldb/include/lldb/Breakpoint/BreakpointResolverName.h b/lldb/include/lldb/Breakpoint/BreakpointResolverName.h index 85a8bb0..4223125 100644 --- a/lldb/include/lldb/Breakpoint/BreakpointResolverName.h +++ b/lldb/include/lldb/Breakpoint/BreakpointResolverName.h @@ -56,7 +56,8 @@ public: static BreakpointResolver * CreateFromStructuredData(Breakpoint *bkpt, - StructuredData::Dictionary &data_dict, Error &error); + const StructuredData::Dictionary &data_dict, + Error &error); StructuredData::ObjectSP SerializeToStructuredData() override; diff --git a/lldb/include/lldb/Core/SearchFilter.h b/lldb/include/lldb/Core/SearchFilter.h index d6053cb..6b3a79e 100644 --- a/lldb/include/lldb/Core/SearchFilter.h +++ b/lldb/include/lldb/Core/SearchFilter.h @@ -216,9 +216,10 @@ public: lldb::SearchFilterSP CopyForBreakpoint(Breakpoint &breakpoint); - static SearchFilter * + static lldb::SearchFilterSP CreateFromStructuredData(Target &target, - StructuredData::Dictionary &data_dict, Error &error); + const StructuredData::Dictionary &data_dict, + Error &error); virtual StructuredData::ObjectSP SerializeToStructuredData() { return StructuredData::ObjectSP(); @@ -316,9 +317,10 @@ public: bool ModulePasses(const lldb::ModuleSP &module_sp) override; - static SearchFilter * + static lldb::SearchFilterSP CreateFromStructuredData(Target &target, - StructuredData::Dictionary &data_dict, Error &error); + const StructuredData::Dictionary &data_dict, + Error &error); StructuredData::ObjectSP SerializeToStructuredData() override; @@ -369,9 +371,10 @@ public: void Search(Searcher &searcher) override; - static SearchFilter * + static lldb::SearchFilterSP CreateFromStructuredData(Target &target, - StructuredData::Dictionary &data_dict, Error &error); + const StructuredData::Dictionary &data_dict, + Error &error); StructuredData::ObjectSP SerializeToStructuredData() override; @@ -425,9 +428,10 @@ public: void Search(Searcher &searcher) override; - static SearchFilter * + static lldb::SearchFilterSP CreateFromStructuredData(Target &target, - StructuredData::Dictionary &data_dict, Error &error); + const StructuredData::Dictionary &data_dict, + Error &error); StructuredData::ObjectSP SerializeToStructuredData() override; @@ -477,9 +481,10 @@ public: void Search(Searcher &searcher) override; - static SearchFilter * + static lldb::SearchFilterSP CreateFromStructuredData(Target &target, - StructuredData::Dictionary &data_dict, Error &error); + const StructuredData::Dictionary &data_dict, + Error &error); StructuredData::ObjectSP SerializeToStructuredData() override; diff --git a/lldb/include/lldb/Target/LanguageRuntime.h b/lldb/include/lldb/Target/LanguageRuntime.h index d13ec15..a57216e8 100644 --- a/lldb/include/lldb/Target/LanguageRuntime.h +++ b/lldb/include/lldb/Target/LanguageRuntime.h @@ -47,7 +47,8 @@ public: static SearchFilter * CreateFromStructuredData(Target &target, - StructuredData::Dictionary &data_dict, Error &error); + const StructuredData::Dictionary &data_dict, + Error &error); StructuredData::ObjectSP SerializeToStructuredData() override; diff --git a/lldb/source/Breakpoint/Breakpoint.cpp b/lldb/source/Breakpoint/Breakpoint.cpp index a73b82e..34349f7 100644 --- a/lldb/source/Breakpoint/Breakpoint.cpp +++ b/lldb/source/Breakpoint/Breakpoint.cpp @@ -148,8 +148,8 @@ lldb::BreakpointSP Breakpoint::CreateFromStructuredData( filter_sp.reset( new SearchFilterForUnconstrainedSearches(target.shared_from_this())); else { - filter_sp.reset(SearchFilter::CreateFromStructuredData(target, *filter_dict, - create_error)); + filter_sp = SearchFilter::CreateFromStructuredData(target, *filter_dict, + create_error); if (create_error.Fail()) { error.SetErrorStringWithFormat( "Error creating breakpoint filter from data: %s.", @@ -158,13 +158,13 @@ lldb::BreakpointSP Breakpoint::CreateFromStructuredData( } } - BreakpointOptions *options = nullptr; + std::unique_ptr options_up; StructuredData::Dictionary *options_dict; success = breakpoint_dict->GetValueForKeyAsDictionary( BreakpointOptions::GetSerializationKey(), options_dict); if (success) { - options = BreakpointOptions::CreateFromStructuredData(*options_dict, - create_error); + options_up = BreakpointOptions::CreateFromStructuredData(*options_dict, + create_error); if (create_error.Fail()) { error.SetErrorStringWithFormat( "Error creating breakpoint options from data: %s.", @@ -174,8 +174,8 @@ lldb::BreakpointSP Breakpoint::CreateFromStructuredData( } result_sp = target.CreateBreakpoint(filter_sp, resolver_sp, false, false, true); - if (result_sp && options) { - result_sp->m_options_up.reset(options); + if (result_sp && options_up) { + result_sp->m_options_up = std::move(options_up); } return result_sp; } diff --git a/lldb/source/Breakpoint/BreakpointOptions.cpp b/lldb/source/Breakpoint/BreakpointOptions.cpp index bf24ee0..47b6715 100644 --- a/lldb/source/Breakpoint/BreakpointOptions.cpp +++ b/lldb/source/Breakpoint/BreakpointOptions.cpp @@ -45,13 +45,11 @@ BreakpointOptions::CommandData::SerializeToStructuredData() { stop_on_error); StructuredData::ArraySP user_source_sp(new StructuredData::Array()); - if (num_strings > 0) { - for (size_t i = 0; i < num_strings; i++) { - StructuredData::StringSP item_sp( - new StructuredData::String(user_source[i])); - user_source_sp->AddItem(item_sp); - options_dict_sp->AddItem(GetKey(OptionNames::UserSource), user_source_sp); - } + for (size_t i = 0; i < num_strings; i++) { + StructuredData::StringSP item_sp( + new StructuredData::String(user_source[i])); + user_source_sp->AddItem(item_sp); + options_dict_sp->AddItem(GetKey(OptionNames::UserSource), user_source_sp); } if (!script_source.empty()) { @@ -61,9 +59,9 @@ BreakpointOptions::CommandData::SerializeToStructuredData() { return options_dict_sp; } -BreakpointOptions::CommandData * +std::unique_ptr BreakpointOptions::CommandData::CreateFromStructuredData( - StructuredData::Dictionary &options_dict, Error &error) { + const StructuredData::Dictionary &options_dict, Error &error) { std::string script_source; CommandData *data = new CommandData(); bool success = options_dict.GetValueForKeyAsBoolean( @@ -84,7 +82,7 @@ BreakpointOptions::CommandData::CreateFromStructuredData( data->user_source.AppendString(elem_string); } } - return data; + return std::unique_ptr(data); } const char *BreakpointOptions::g_option_names @@ -169,8 +167,8 @@ BreakpointOptions::CopyOptionsNoCallback(BreakpointOptions &orig) { //---------------------------------------------------------------------- BreakpointOptions::~BreakpointOptions() = default; -BreakpointOptions *BreakpointOptions::CreateFromStructuredData( - StructuredData::Dictionary &options_dict, Error &error) { +std::unique_ptr BreakpointOptions::CreateFromStructuredData( + const StructuredData::Dictionary &options_dict, Error &error) { bool enabled = true; bool one_shot = false; int32_t ignore_count = 0; @@ -199,7 +197,7 @@ BreakpointOptions *BreakpointOptions::CreateFromStructuredData( return nullptr; } - BreakpointOptions::CommandData *cmd_data = nullptr; + std::unique_ptr cmd_data; StructuredData::Dictionary *cmds_dict; success = options_dict.GetValueForKeyAsDictionary( CommandData::GetSerializationKey(), cmds_dict); @@ -217,8 +215,8 @@ BreakpointOptions *BreakpointOptions::CreateFromStructuredData( BreakpointOptions *bp_options = new BreakpointOptions( condition_text.c_str(), enabled, ignore_count, one_shot); if (cmd_data) - bp_options->SetCommandDataCallback(cmd_data); - return bp_options; + bp_options->SetCommandDataCallback(cmd_data.release()); + return std::unique_ptr(bp_options); } StructuredData::ObjectSP BreakpointOptions::SerializeToStructuredData() { diff --git a/lldb/source/Breakpoint/BreakpointResolver.cpp b/lldb/source/Breakpoint/BreakpointResolver.cpp index 5a93d57..a7c63c6 100644 --- a/lldb/source/Breakpoint/BreakpointResolver.cpp +++ b/lldb/source/Breakpoint/BreakpointResolver.cpp @@ -72,7 +72,7 @@ BreakpointResolver::BreakpointResolver(Breakpoint *bkpt, BreakpointResolver::~BreakpointResolver() {} BreakpointResolverSP BreakpointResolver::CreateFromStructuredData( - StructuredData::Dictionary &resolver_dict, Error &error) { + const StructuredData::Dictionary &resolver_dict, Error &error) { BreakpointResolverSP result_sp; if (!resolver_dict.IsValid()) { error.SetErrorString("Can't deserialize from an invalid data object."); diff --git a/lldb/source/Breakpoint/BreakpointResolverAddress.cpp b/lldb/source/Breakpoint/BreakpointResolverAddress.cpp index cf8637b..a866f61 100644 --- a/lldb/source/Breakpoint/BreakpointResolverAddress.cpp +++ b/lldb/source/Breakpoint/BreakpointResolverAddress.cpp @@ -43,7 +43,8 @@ BreakpointResolverAddress::BreakpointResolverAddress(Breakpoint *bkpt, BreakpointResolverAddress::~BreakpointResolverAddress() {} BreakpointResolver *BreakpointResolverAddress::CreateFromStructuredData( - Breakpoint *bkpt, StructuredData::Dictionary &options_dict, Error &error) { + Breakpoint *bkpt, const StructuredData::Dictionary &options_dict, + Error &error) { std::string module_name; lldb::addr_t addr_offset; FileSpec module_filespec; diff --git a/lldb/source/Breakpoint/BreakpointResolverFileLine.cpp b/lldb/source/Breakpoint/BreakpointResolverFileLine.cpp index 5f0b0d2..f3f20bc 100644 --- a/lldb/source/Breakpoint/BreakpointResolverFileLine.cpp +++ b/lldb/source/Breakpoint/BreakpointResolverFileLine.cpp @@ -37,7 +37,8 @@ BreakpointResolverFileLine::BreakpointResolverFileLine( BreakpointResolverFileLine::~BreakpointResolverFileLine() {} BreakpointResolver *BreakpointResolverFileLine::CreateFromStructuredData( - Breakpoint *bkpt, StructuredData::Dictionary &options_dict, Error &error) { + Breakpoint *bkpt, const StructuredData::Dictionary &options_dict, + Error &error) { std::string filename; uint32_t line_no; bool check_inlines; diff --git a/lldb/source/Breakpoint/BreakpointResolverFileRegex.cpp b/lldb/source/Breakpoint/BreakpointResolverFileRegex.cpp index da8b7b3..ae2e094 100644 --- a/lldb/source/Breakpoint/BreakpointResolverFileRegex.cpp +++ b/lldb/source/Breakpoint/BreakpointResolverFileRegex.cpp @@ -37,7 +37,8 @@ BreakpointResolverFileRegex::BreakpointResolverFileRegex( BreakpointResolverFileRegex::~BreakpointResolverFileRegex() {} BreakpointResolver *BreakpointResolverFileRegex::CreateFromStructuredData( - Breakpoint *bkpt, StructuredData::Dictionary &options_dict, Error &error) { + Breakpoint *bkpt, const StructuredData::Dictionary &options_dict, + Error &error) { bool success; std::string regex_string; diff --git a/lldb/source/Breakpoint/BreakpointResolverName.cpp b/lldb/source/Breakpoint/BreakpointResolverName.cpp index a946ba3..175eebd 100644 --- a/lldb/source/Breakpoint/BreakpointResolverName.cpp +++ b/lldb/source/Breakpoint/BreakpointResolverName.cpp @@ -91,7 +91,8 @@ BreakpointResolverName::BreakpointResolverName( m_language(rhs.m_language), m_skip_prologue(rhs.m_skip_prologue) {} BreakpointResolver *BreakpointResolverName::CreateFromStructuredData( - Breakpoint *bkpt, StructuredData::Dictionary &options_dict, Error &error) { + Breakpoint *bkpt, const StructuredData::Dictionary &options_dict, + Error &error) { LanguageType language = eLanguageTypeUnknown; std::string language_name; bool success = options_dict.GetValueForKeyAsString( diff --git a/lldb/source/Core/SearchFilter.cpp b/lldb/source/Core/SearchFilter.cpp index aa21422..1b6e08e 100644 --- a/lldb/source/Core/SearchFilter.cpp +++ b/lldb/source/Core/SearchFilter.cpp @@ -59,12 +59,13 @@ SearchFilter &SearchFilter::operator=(const SearchFilter &rhs) = default; SearchFilter::~SearchFilter() = default; -SearchFilter *SearchFilter::CreateFromStructuredData( - Target &target, StructuredData::Dictionary &filter_dict, Error &error) { - SearchFilter *result = nullptr; +SearchFilterSP SearchFilter::CreateFromStructuredData( + Target &target, const StructuredData::Dictionary &filter_dict, + Error &error) { + SearchFilterSP result_sp; if (!filter_dict.IsValid()) { error.SetErrorString("Can't deserialize from an invalid data object."); - return result; + return result_sp; } std::string subclass_name; @@ -73,14 +74,14 @@ SearchFilter *SearchFilter::CreateFromStructuredData( GetSerializationSubclassKey(), subclass_name); if (!success) { error.SetErrorStringWithFormat("Filter data missing subclass key"); - return result; + return result_sp; } FilterTy filter_type = NameToFilterTy(subclass_name.c_str()); if (filter_type == UnknownFilter) { error.SetErrorStringWithFormat("Unknown filter type: %s.", subclass_name.c_str()); - return result; + return result_sp; } StructuredData::Dictionary *subclass_options = nullptr; @@ -88,24 +89,24 @@ SearchFilter *SearchFilter::CreateFromStructuredData( GetSerializationSubclassOptionsKey(), subclass_options); if (!success || !subclass_options || !subclass_options->IsValid()) { error.SetErrorString("Filter data missing subclass options key."); - return result; + return result_sp; } switch (filter_type) { case Unconstrained: - result = SearchFilterForUnconstrainedSearches::CreateFromStructuredData( + result_sp = SearchFilterForUnconstrainedSearches::CreateFromStructuredData( target, *subclass_options, error); break; case ByModule: - result = SearchFilterByModule::CreateFromStructuredData( + result_sp = SearchFilterByModule::CreateFromStructuredData( target, *subclass_options, error); break; case ByModules: - result = SearchFilterByModuleList::CreateFromStructuredData( + result_sp = SearchFilterByModuleList::CreateFromStructuredData( target, *subclass_options, error); break; case ByModulesAndCU: - result = SearchFilterByModuleListAndCU::CreateFromStructuredData( + result_sp = SearchFilterByModuleListAndCU::CreateFromStructuredData( target, *subclass_options, error); break; case Exception: @@ -115,7 +116,7 @@ SearchFilter *SearchFilter::CreateFromStructuredData( llvm_unreachable("Should never get an uresolvable filter type."); } - return result; + return result_sp; } bool SearchFilter::ModulePasses(const FileSpec &spec) { return true; } @@ -312,10 +313,11 @@ Searcher::CallbackReturn SearchFilter::DoFunctionIteration( // Selects a shared library matching a given file spec, consulting the targets // "black list". //---------------------------------------------------------------------- -SearchFilter *SearchFilterForUnconstrainedSearches::CreateFromStructuredData( - Target &target, StructuredData::Dictionary &data_dict, Error &error) { +SearchFilterSP SearchFilterForUnconstrainedSearches::CreateFromStructuredData( + Target &target, const StructuredData::Dictionary &data_dict, Error &error) { // No options for an unconstrained search. - return new SearchFilterForUnconstrainedSearches(target.shared_from_this()); + return SearchFilterSP( + new SearchFilterForUnconstrainedSearches(target.shared_from_this())); } StructuredData::ObjectSP @@ -447,8 +449,8 @@ SearchFilterByModule::DoCopyForBreakpoint(Breakpoint &breakpoint) { return ret_sp; } -SearchFilter *SearchFilterByModule::CreateFromStructuredData( - Target &target, StructuredData::Dictionary &data_dict, Error &error) { +SearchFilterSP SearchFilterByModule::CreateFromStructuredData( + Target &target, const StructuredData::Dictionary &data_dict, Error &error) { StructuredData::Array *modules_array; bool success = data_dict.GetValueForKeyAsArray(GetKey(OptionNames::ModList), modules_array); @@ -472,7 +474,8 @@ SearchFilter *SearchFilterByModule::CreateFromStructuredData( } FileSpec module_spec(module.c_str(), false); - return new SearchFilterByModule(target.shared_from_this(), module_spec); + return SearchFilterSP( + new SearchFilterByModule(target.shared_from_this(), module_spec)); } StructuredData::ObjectSP SearchFilterByModule::SerializeToStructuredData() { @@ -622,8 +625,8 @@ SearchFilterByModuleList::DoCopyForBreakpoint(Breakpoint &breakpoint) { return ret_sp; } -SearchFilter *SearchFilterByModuleList::CreateFromStructuredData( - Target &target, StructuredData::Dictionary &data_dict, Error &error) { +SearchFilterSP SearchFilterByModuleList::CreateFromStructuredData( + Target &target, const StructuredData::Dictionary &data_dict, Error &error) { StructuredData::Array *modules_array; bool success = data_dict.GetValueForKeyAsArray(GetKey(OptionNames::ModList), modules_array); @@ -645,7 +648,8 @@ SearchFilter *SearchFilterByModuleList::CreateFromStructuredData( modules.Append(FileSpec(module.c_str(), false)); } - return new SearchFilterByModuleList(target.shared_from_this(), modules); + return SearchFilterSP( + new SearchFilterByModuleList(target.shared_from_this(), modules)); } void SearchFilterByModuleList::SerializeUnwrapped( @@ -688,14 +692,15 @@ operator=(const SearchFilterByModuleListAndCU &rhs) { SearchFilterByModuleListAndCU::~SearchFilterByModuleListAndCU() = default; -SearchFilter *SearchFilterByModuleListAndCU::CreateFromStructuredData( - Target &target, StructuredData::Dictionary &data_dict, Error &error) { +lldb::SearchFilterSP SearchFilterByModuleListAndCU::CreateFromStructuredData( + Target &target, const StructuredData::Dictionary &data_dict, Error &error) { StructuredData::Array *modules_array; + SearchFilterSP result_sp; bool success = data_dict.GetValueForKeyAsArray(GetKey(OptionNames::ModList), modules_array); if (!success) { error.SetErrorString("SFBM::CFSD: Could not find the module list key."); - return nullptr; + return result_sp; } size_t num_modules = modules_array->GetSize(); @@ -706,7 +711,7 @@ SearchFilter *SearchFilterByModuleListAndCU::CreateFromStructuredData( if (!success) { error.SetErrorStringWithFormat( "SFBM::CFSD: filter module item %zu not a string.", i); - return nullptr; + return result_sp; } modules.Append(FileSpec(module.c_str(), false)); } @@ -716,7 +721,7 @@ SearchFilter *SearchFilterByModuleListAndCU::CreateFromStructuredData( data_dict.GetValueForKeyAsArray(GetKey(OptionNames::CUList), cus_array); if (!success) { error.SetErrorString("SFBM::CFSD: Could not find the CU list key."); - return nullptr; + return result_sp; } size_t num_cus = cus_array->GetSize(); @@ -732,8 +737,8 @@ SearchFilter *SearchFilterByModuleListAndCU::CreateFromStructuredData( cus.Append(FileSpec(cu.c_str(), false)); } - return new SearchFilterByModuleListAndCU(target.shared_from_this(), modules, - cus); + return SearchFilterSP(new SearchFilterByModuleListAndCU( + target.shared_from_this(), modules, cus)); } StructuredData::ObjectSP diff --git a/lldb/source/Target/LanguageRuntime.cpp b/lldb/source/Target/LanguageRuntime.cpp index 83c6afa..24da18f 100644 --- a/lldb/source/Target/LanguageRuntime.cpp +++ b/lldb/source/Target/LanguageRuntime.cpp @@ -90,7 +90,7 @@ ExceptionSearchFilter::DoCopyForBreakpoint(Breakpoint &breakpoint) { } SearchFilter *ExceptionSearchFilter::CreateFromStructuredData( - Target &target, StructuredData::Dictionary &data_dict, Error &error) { + Target &target, const StructuredData::Dictionary &data_dict, Error &error) { SearchFilter *result = nullptr; return result; } -- 2.7.4