Author: jingham Date: Mon Sep 12 20:58:08 2016 New Revision: 281288 URL: http://llvm.org/viewvc/llvm-project?rev=281288&view=rev Log: Add a few const's (thanks Zachary) and return shared or unique pointers in places where they help prevent leaks.
Modified: lldb/trunk/include/lldb/Breakpoint/BreakpointOptions.h lldb/trunk/include/lldb/Breakpoint/BreakpointResolver.h lldb/trunk/include/lldb/Breakpoint/BreakpointResolverAddress.h lldb/trunk/include/lldb/Breakpoint/BreakpointResolverFileLine.h lldb/trunk/include/lldb/Breakpoint/BreakpointResolverFileRegex.h lldb/trunk/include/lldb/Breakpoint/BreakpointResolverName.h lldb/trunk/include/lldb/Core/SearchFilter.h lldb/trunk/include/lldb/Target/LanguageRuntime.h lldb/trunk/source/Breakpoint/Breakpoint.cpp lldb/trunk/source/Breakpoint/BreakpointOptions.cpp lldb/trunk/source/Breakpoint/BreakpointResolver.cpp lldb/trunk/source/Breakpoint/BreakpointResolverAddress.cpp lldb/trunk/source/Breakpoint/BreakpointResolverFileLine.cpp lldb/trunk/source/Breakpoint/BreakpointResolverFileRegex.cpp lldb/trunk/source/Breakpoint/BreakpointResolverName.cpp lldb/trunk/source/Core/SearchFilter.cpp lldb/trunk/source/Target/LanguageRuntime.cpp Modified: lldb/trunk/include/lldb/Breakpoint/BreakpointOptions.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Breakpoint/BreakpointOptions.h?rev=281288&r1=281287&r2=281288&view=diff ============================================================================== --- lldb/trunk/include/lldb/Breakpoint/BreakpointOptions.h (original) +++ lldb/trunk/include/lldb/Breakpoint/BreakpointOptions.h Mon Sep 12 20:58:08 2016 @@ -42,8 +42,8 @@ public: StructuredData::ObjectSP SerializeToStructuredData(); - static CommandData * - CreateFromStructuredData(StructuredData::Dictionary &options_dict, + static std::unique_ptr<CommandData> + 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<BreakpointOptions> + CreateFromStructuredData(const StructuredData::Dictionary &data_dict, + Error &error); virtual StructuredData::ObjectSP SerializeToStructuredData(); Modified: lldb/trunk/include/lldb/Breakpoint/BreakpointResolver.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Breakpoint/BreakpointResolver.h?rev=281288&r1=281287&r2=281288&view=diff ============================================================================== --- lldb/trunk/include/lldb/Breakpoint/BreakpointResolver.h (original) +++ lldb/trunk/include/lldb/Breakpoint/BreakpointResolver.h Mon Sep 12 20:58:08 2016 @@ -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() { Modified: lldb/trunk/include/lldb/Breakpoint/BreakpointResolverAddress.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Breakpoint/BreakpointResolverAddress.h?rev=281288&r1=281287&r2=281288&view=diff ============================================================================== --- lldb/trunk/include/lldb/Breakpoint/BreakpointResolverAddress.h (original) +++ lldb/trunk/include/lldb/Breakpoint/BreakpointResolverAddress.h Mon Sep 12 20:58:08 2016 @@ -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; Modified: lldb/trunk/include/lldb/Breakpoint/BreakpointResolverFileLine.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Breakpoint/BreakpointResolverFileLine.h?rev=281288&r1=281287&r2=281288&view=diff ============================================================================== --- lldb/trunk/include/lldb/Breakpoint/BreakpointResolverFileLine.h (original) +++ lldb/trunk/include/lldb/Breakpoint/BreakpointResolverFileLine.h Mon Sep 12 20:58:08 2016 @@ -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; Modified: lldb/trunk/include/lldb/Breakpoint/BreakpointResolverFileRegex.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Breakpoint/BreakpointResolverFileRegex.h?rev=281288&r1=281287&r2=281288&view=diff ============================================================================== --- lldb/trunk/include/lldb/Breakpoint/BreakpointResolverFileRegex.h (original) +++ lldb/trunk/include/lldb/Breakpoint/BreakpointResolverFileRegex.h Mon Sep 12 20:58:08 2016 @@ -35,8 +35,10 @@ public: Breakpoint *bkpt, RegularExpression ®ex, const std::unordered_set<std::string> &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; Modified: lldb/trunk/include/lldb/Breakpoint/BreakpointResolverName.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Breakpoint/BreakpointResolverName.h?rev=281288&r1=281287&r2=281288&view=diff ============================================================================== --- lldb/trunk/include/lldb/Breakpoint/BreakpointResolverName.h (original) +++ lldb/trunk/include/lldb/Breakpoint/BreakpointResolverName.h Mon Sep 12 20:58:08 2016 @@ -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; Modified: lldb/trunk/include/lldb/Core/SearchFilter.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/SearchFilter.h?rev=281288&r1=281287&r2=281288&view=diff ============================================================================== --- lldb/trunk/include/lldb/Core/SearchFilter.h (original) +++ lldb/trunk/include/lldb/Core/SearchFilter.h Mon Sep 12 20:58:08 2016 @@ -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; Modified: lldb/trunk/include/lldb/Target/LanguageRuntime.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/LanguageRuntime.h?rev=281288&r1=281287&r2=281288&view=diff ============================================================================== --- lldb/trunk/include/lldb/Target/LanguageRuntime.h (original) +++ lldb/trunk/include/lldb/Target/LanguageRuntime.h Mon Sep 12 20:58:08 2016 @@ -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; Modified: lldb/trunk/source/Breakpoint/Breakpoint.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/Breakpoint.cpp?rev=281288&r1=281287&r2=281288&view=diff ============================================================================== --- lldb/trunk/source/Breakpoint/Breakpoint.cpp (original) +++ lldb/trunk/source/Breakpoint/Breakpoint.cpp Mon Sep 12 20:58:08 2016 @@ -148,8 +148,8 @@ lldb::BreakpointSP Breakpoint::CreateFro 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::CreateFro } } - BreakpointOptions *options = nullptr; + std::unique_ptr<BreakpointOptions> 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::CreateFro } 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; } Modified: lldb/trunk/source/Breakpoint/BreakpointOptions.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointOptions.cpp?rev=281288&r1=281287&r2=281288&view=diff ============================================================================== --- lldb/trunk/source/Breakpoint/BreakpointOptions.cpp (original) +++ lldb/trunk/source/Breakpoint/BreakpointOptions.cpp Mon Sep 12 20:58:08 2016 @@ -45,13 +45,11 @@ BreakpointOptions::CommandData::Serializ 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::Serializ return options_dict_sp; } -BreakpointOptions::CommandData * +std::unique_ptr<BreakpointOptions::CommandData> 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::CreateFr data->user_source.AppendString(elem_string); } } - return data; + return std::unique_ptr<BreakpointOptions::CommandData>(data); } const char *BreakpointOptions::g_option_names @@ -169,8 +167,8 @@ BreakpointOptions::CopyOptionsNoCallback //---------------------------------------------------------------------- BreakpointOptions::~BreakpointOptions() = default; -BreakpointOptions *BreakpointOptions::CreateFromStructuredData( - StructuredData::Dictionary &options_dict, Error &error) { +std::unique_ptr<BreakpointOptions> 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::Cr return nullptr; } - BreakpointOptions::CommandData *cmd_data = nullptr; + std::unique_ptr<CommandData> cmd_data; StructuredData::Dictionary *cmds_dict; success = options_dict.GetValueForKeyAsDictionary( CommandData::GetSerializationKey(), cmds_dict); @@ -217,8 +215,8 @@ BreakpointOptions *BreakpointOptions::Cr 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<BreakpointOptions>(bp_options); } StructuredData::ObjectSP BreakpointOptions::SerializeToStructuredData() { Modified: lldb/trunk/source/Breakpoint/BreakpointResolver.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointResolver.cpp?rev=281288&r1=281287&r2=281288&view=diff ============================================================================== --- lldb/trunk/source/Breakpoint/BreakpointResolver.cpp (original) +++ lldb/trunk/source/Breakpoint/BreakpointResolver.cpp Mon Sep 12 20:58:08 2016 @@ -72,7 +72,7 @@ BreakpointResolver::BreakpointResolver(B 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."); Modified: lldb/trunk/source/Breakpoint/BreakpointResolverAddress.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointResolverAddress.cpp?rev=281288&r1=281287&r2=281288&view=diff ============================================================================== --- lldb/trunk/source/Breakpoint/BreakpointResolverAddress.cpp (original) +++ lldb/trunk/source/Breakpoint/BreakpointResolverAddress.cpp Mon Sep 12 20:58:08 2016 @@ -43,7 +43,8 @@ BreakpointResolverAddress::BreakpointRes 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; Modified: lldb/trunk/source/Breakpoint/BreakpointResolverFileLine.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointResolverFileLine.cpp?rev=281288&r1=281287&r2=281288&view=diff ============================================================================== --- lldb/trunk/source/Breakpoint/BreakpointResolverFileLine.cpp (original) +++ lldb/trunk/source/Breakpoint/BreakpointResolverFileLine.cpp Mon Sep 12 20:58:08 2016 @@ -37,7 +37,8 @@ BreakpointResolverFileLine::BreakpointRe 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; Modified: lldb/trunk/source/Breakpoint/BreakpointResolverFileRegex.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointResolverFileRegex.cpp?rev=281288&r1=281287&r2=281288&view=diff ============================================================================== --- lldb/trunk/source/Breakpoint/BreakpointResolverFileRegex.cpp (original) +++ lldb/trunk/source/Breakpoint/BreakpointResolverFileRegex.cpp Mon Sep 12 20:58:08 2016 @@ -37,7 +37,8 @@ BreakpointResolverFileRegex::BreakpointR 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; Modified: lldb/trunk/source/Breakpoint/BreakpointResolverName.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointResolverName.cpp?rev=281288&r1=281287&r2=281288&view=diff ============================================================================== --- lldb/trunk/source/Breakpoint/BreakpointResolverName.cpp (original) +++ lldb/trunk/source/Breakpoint/BreakpointResolverName.cpp Mon Sep 12 20:58:08 2016 @@ -91,7 +91,8 @@ BreakpointResolverName::BreakpointResolv 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( Modified: lldb/trunk/source/Core/SearchFilter.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/SearchFilter.cpp?rev=281288&r1=281287&r2=281288&view=diff ============================================================================== --- lldb/trunk/source/Core/SearchFilter.cpp (original) +++ lldb/trunk/source/Core/SearchFilter.cpp Mon Sep 12 20:58:08 2016 @@ -59,12 +59,13 @@ SearchFilter &SearchFilter::operator=(co 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::CreateFromSt 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::CreateFromSt 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::CreateFromSt 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::D // 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::DoCopyForBreakpoin 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::Crea } 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::DoCopyForBreak 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:: 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 SearchFilterByModuleList 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 *SearchFilterByModuleListAn 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 *SearchFilterByModuleListAn 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 *SearchFilterByModuleListAn 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 Modified: lldb/trunk/source/Target/LanguageRuntime.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/LanguageRuntime.cpp?rev=281288&r1=281287&r2=281288&view=diff ============================================================================== --- lldb/trunk/source/Target/LanguageRuntime.cpp (original) +++ lldb/trunk/source/Target/LanguageRuntime.cpp Mon Sep 12 20:58:08 2016 @@ -90,7 +90,7 @@ ExceptionSearchFilter::DoCopyForBreakpoi } 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; } _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits