[Libreoffice-commits] core.git: idlc/inc idlc/source

Noel Grandin noel.grandin at collabora.co.uk
Sat Jan 13 10:20:37 UTC 2018


 idlc/inc/astsequence.hxx |    7 +------
 idlc/inc/fehelper.hxx    |   10 ++--------
 idlc/source/astdump.cxx  |    2 +-
 3 files changed, 4 insertions(+), 15 deletions(-)

New commits:
commit 37464a0fb7f3bafe72126e65d34f2c15377a3964
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Thu Jan 11 16:03:46 2018 +0200

    loplugin:useuniqueptr in idlc
    
    Change-Id: Iccc50462ca115546422824b6814abf16a029f005
    Reviewed-on: https://gerrit.libreoffice.org/47793
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

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();
     }


More information about the Libreoffice-commits mailing list