summaryrefslogtreecommitdiff
path: root/idlc
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-03-22 12:21:56 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-03-23 07:25:01 +0100
commit5053b8cd3f18cb5baa039c343e20b1b87e7b25a5 (patch)
tree22b95a47962745b1bc3a45c3d55f14289cbbf77d /idlc
parent2925ded06627fb7e5408f15288490db7c9f0ebb0 (diff)
loplugin:useuniqueptr in AstStruct
Change-Id: Ib7416235e41192323e74061bfce6c162e87612f2 Reviewed-on: https://gerrit.libreoffice.org/51736 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'idlc')
-rw-r--r--idlc/inc/aststruct.hxx4
-rw-r--r--idlc/source/aststruct.cxx8
2 files changed, 4 insertions, 8 deletions
diff --git a/idlc/inc/aststruct.hxx b/idlc/inc/aststruct.hxx
index 52981cf2b791..bb5ef15152e2 100644
--- a/idlc/inc/aststruct.hxx
+++ b/idlc/inc/aststruct.hxx
@@ -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
diff --git a/idlc/source/aststruct.cxx b/idlc/source/aststruct.cxx
index a7db14faaf7f..e06adc2b2bd1 100644
--- a/idlc/source/aststruct.cxx
+++ b/idlc/source/aststruct.cxx
@@ -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;