diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-01-11 16:03:46 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-01-13 11:20:05 +0100 |
commit | 37464a0fb7f3bafe72126e65d34f2c15377a3964 (patch) | |
tree | 487117274ed62ba672c2d2ed485a9743645f0057 /idlc | |
parent | 9acf3da78a5146c5af557967eabd0c47bf54d466 (diff) |
loplugin:useuniqueptr in idlc
Change-Id: Iccc50462ca115546422824b6814abf16a029f005
Reviewed-on: https://gerrit.libreoffice.org/47793
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'idlc')
-rw-r--r-- | idlc/inc/astsequence.hxx | 7 | ||||
-rw-r--r-- | idlc/inc/fehelper.hxx | 10 | ||||
-rw-r--r-- | idlc/source/astdump.cxx | 2 |
3 files changed, 4 insertions, 15 deletions
diff --git a/idlc/inc/astsequence.hxx b/idlc/inc/astsequence.hxx index 20dac9b4fdc0..1a7a2073f763 100644 --- a/idlc/inc/astsequence.hxx +++ b/idlc/inc/astsequence.hxx @@ -29,11 +29,6 @@ public: , m_pMemberType(pMemberType) , m_pRelativName(nullptr) {} - virtual ~AstSequence() override - { - if ( m_pRelativName ) - delete m_pRelativName; - } AstType const * getMemberType() const { return m_pMemberType; } @@ -44,7 +39,7 @@ public: virtual const sal_Char* getRelativName() const override; private: AstType const * m_pMemberType; - mutable OString* m_pRelativName; + mutable std::unique_ptr<OString> m_pRelativName; }; #endif // INCLUDED_IDLC_INC_ASTSEQUENCE_HXX diff --git a/idlc/inc/fehelper.hxx b/idlc/inc/fehelper.hxx index 11668e6946be..be401defcaa1 100644 --- a/idlc/inc/fehelper.hxx +++ b/idlc/inc/fehelper.hxx @@ -46,16 +46,10 @@ public: NodeType nodeType, OString* pName, OString const * pInherits, std::vector< OString > const * typeParameters); - ~FeInheritanceHeader() - { - if ( m_pName ) - delete m_pName; - } - NodeType getNodeType() const { return m_nodeType; } OString* getName() - { return m_pName; } + { return m_pName.get(); } AstDeclaration* getInherits() { return m_pInherits; } @@ -66,7 +60,7 @@ private: void initializeInherits(OString const * pinherits); NodeType m_nodeType; - OString* m_pName; + std::unique_ptr<OString> m_pName; AstDeclaration* m_pInherits; std::vector< OString > m_typeParameters; }; diff --git a/idlc/source/astdump.cxx b/idlc/source/astdump.cxx index 945060bce392..7b869b7564dc 100644 --- a/idlc/source/astdump.cxx +++ b/idlc/source/astdump.cxx @@ -411,7 +411,7 @@ const sal_Char* AstSequence::getRelativName() const { if ( !m_pRelativName ) { - m_pRelativName = new OString("[]"); + m_pRelativName.reset( new OString("[]") ); AstDeclaration const * pType = resolveTypedefs( m_pMemberType ); *m_pRelativName += pType->getRelativName(); } |