From 7c1e96833670751c0ad9c0ca946feadafdc9ed0d Mon Sep 17 00:00:00 2001 From: Jiang Yi Date: Tue, 30 Aug 2022 09:52:07 +0200 Subject: [PATCH] Delete UITabCompletion* with unique_ptr --- lib/UserInterface/UserInterface.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/UserInterface/UserInterface.cpp b/lib/UserInterface/UserInterface.cpp index d30930df..77b25473 100644 --- a/lib/UserInterface/UserInterface.cpp +++ b/lib/UserInterface/UserInterface.cpp @@ -31,7 +31,7 @@ namespace { /// class UITabCompletion : public textinput::TabCompletion { const cling::Interpreter& m_ParentInterpreter; - + public: UITabCompletion(const cling::Interpreter& Parent) : m_ParentInterpreter(Parent) {} @@ -89,13 +89,11 @@ namespace cling { llvm::sys::path::append(histfilePath, ".cling_history"); } + const auto Completion = + std::make_unique(m_MetaProcessor->getInterpreter()); TextInputHolder TI(histfilePath); - // Inform text input about the code complete consumer - // TextInput owns the TabCompletion. - UITabCompletion* Completion = - new UITabCompletion(m_MetaProcessor->getInterpreter()); - TI->SetCompletion(Completion); + TI->SetCompletion(Completion.get()); bool Done = false; std::string Line;