Kaydet (Commit) 6ae487db authored tarafından Noel Grandin's avatar Noel Grandin

fix use of std::unique_ptr in Idlc

I removed the deletes in the destructor in

    commit b27fee9e
    Date:   Wed Jan 10 11:44:28 2018 +0200
    loplugin:useuniqueptr cppu,idlc,io,ucbhelper

but forgot to do the actual conversion

Change-Id: Icb03070e1d8a2b10ccf892f01e9b44cc6bf0156f
üst fb4296d1
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include "idlctypes.hxx" #include "idlctypes.hxx"
#include "aststack.hxx" #include "aststack.hxx"
#include "options.hxx" #include "options.hxx"
#include <memory>
#ifdef SAL_UNX #ifdef SAL_UNX
#define SEPARATOR '/' #define SEPARATOR '/'
...@@ -51,9 +52,9 @@ public: ...@@ -51,9 +52,9 @@ public:
Options* getOptions() Options* getOptions()
{ return m_pOptions; } { return m_pOptions; }
AstStack* scopes() AstStack* scopes()
{ return m_pScopes; } { return m_pScopes.get(); }
AstModule* getRoot() AstModule* getRoot()
{ return m_pRoot; } { return m_pRoot.get(); }
const OString& getFileName() const const OString& getFileName() const
{ return m_fileName; } { return m_fileName; }
void setFileName(const OString& fileName) void setFileName(const OString& fileName)
...@@ -115,8 +116,8 @@ public: ...@@ -115,8 +116,8 @@ public:
void reset(); void reset();
private: private:
Options* m_pOptions; Options* m_pOptions;
AstStack* m_pScopes; std::unique_ptr<AstStack> m_pScopes;
AstModule* m_pRoot; std::unique_ptr<AstModule> m_pRoot;
OString m_fileName; OString m_fileName;
OString m_mainFileName; OString m_mainFileName;
OString m_realFileName; OString m_realFileName;
......
...@@ -209,7 +209,7 @@ Idlc::Idlc(Options* pOptions) ...@@ -209,7 +209,7 @@ Idlc::Idlc(Options* pOptions)
, m_offsetEnd(0) , m_offsetEnd(0)
, m_parseState(PS_NoState) , m_parseState(PS_NoState)
{ {
m_pScopes = new AstStack(); m_pScopes.reset( new AstStack() );
// init root object after construction // init root object after construction
m_pRoot = nullptr; m_pRoot = nullptr;
m_bGenerateDoc = m_pOptions->isValid("-C"); m_bGenerateDoc = m_pOptions->isValid("-C");
...@@ -221,13 +221,12 @@ Idlc::~Idlc() ...@@ -221,13 +221,12 @@ Idlc::~Idlc()
void Idlc::init() void Idlc::init()
{ {
delete m_pRoot; m_pRoot.reset(new AstModule(NT_root, OString(), nullptr));
m_pRoot = new AstModule(NT_root, OString(), nullptr);
// push the root node on the stack // push the root node on the stack
m_pScopes->push(m_pRoot); m_pScopes->push(m_pRoot.get());
initializePredefinedTypes(m_pRoot); initializePredefinedTypes(m_pRoot.get());
predefineXInterface(m_pRoot); predefineXInterface(m_pRoot.get());
} }
void Idlc::reset() void Idlc::reset()
...@@ -247,13 +246,11 @@ void Idlc::reset() ...@@ -247,13 +246,11 @@ void Idlc::reset()
m_documentation.clear(); m_documentation.clear();
m_pScopes->clear(); m_pScopes->clear();
delete m_pRoot; m_pRoot.reset( new AstModule(NT_root, OString(), nullptr) );
m_pRoot = new AstModule(NT_root, OString(), nullptr);
// push the root node on the stack // push the root node on the stack
m_pScopes->push(m_pRoot); m_pScopes->push(m_pRoot.get());
initializePredefinedTypes(m_pRoot); initializePredefinedTypes(m_pRoot.get());
m_includes.clear(); m_includes.clear();
} }
......
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