Kaydet (Commit) 5053b8cd authored tarafından Noel Grandin's avatar Noel Grandin

loplugin:useuniqueptr in AstStruct

Change-Id: Ib7416235e41192323e74061bfce6c162e87612f2
Reviewed-on: https://gerrit.libreoffice.org/51736Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 2925ded0
......@@ -40,7 +40,7 @@ public:
AstScope* pScope);
virtual ~AstStruct() override;
DeclList::size_type getTypeParameterCount() const
std::size_t getTypeParameterCount() const
{ return m_typeParameters.size(); }
AstDeclaration const * findTypeParameter(OString const & name) const;
......@@ -50,7 +50,7 @@ public:
virtual bool dump(RegistryKey& rKey) override;
private:
AstStruct const* m_pBaseType;
DeclList m_typeParameters;
std::vector<std::unique_ptr<AstDeclaration>> m_typeParameters;
};
#endif // INCLUDED_IDLC_INC_ASTSTRUCT_HXX
......
......@@ -32,7 +32,7 @@ AstStruct::AstStruct(
{
for (auto const& elem : typeParameters)
{
m_typeParameters.push_back(
m_typeParameters.emplace_back(
new AstType(NT_type_parameter, elem, nullptr));
}
}
......@@ -49,10 +49,6 @@ AstStruct::AstStruct(const NodeType type,
AstStruct::~AstStruct()
{
for (auto const& elem : m_typeParameters)
{
delete elem;
}
}
AstDeclaration const * AstStruct::findTypeParameter(OString const & name)
......@@ -61,7 +57,7 @@ AstDeclaration const * AstStruct::findTypeParameter(OString const & name)
for (auto const& elem : m_typeParameters)
{
if (elem->getLocalName() == name) {
return elem;
return elem.get();
}
}
return nullptr;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment