Skip to content

Commit 776fa2d

Browse files
committed
[lldb] Gardening in IOHandlerCurses (NFC)
- Remove _ap (auto_ptr) suffix with _up (unique_ptr) suffix - Move forward declaration from IOHandler.h to IOHandlerCursesGUI.h - Move curses namespace under lldb_private Motivated by Alex' comment in llvm#126630.
1 parent b24e140 commit 776fa2d

File tree

3 files changed

+15
-15
lines changed

3 files changed

+15
-15
lines changed

lldb/include/lldb/Core/IOHandler.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,6 @@ namespace lldb_private {
3232
class Debugger;
3333
} // namespace lldb_private
3434

35-
namespace curses {
36-
class Application;
37-
typedef std::unique_ptr<Application> ApplicationAP;
38-
} // namespace curses
39-
4035
namespace lldb_private {
4136

4237
class IOHandler {

lldb/include/lldb/Core/IOHandlerCursesGUI.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
#include "lldb/Core/IOHandler.h"
1313

1414
namespace lldb_private {
15+
namespace curses {
16+
class Application;
17+
} // namespace curses
1518

1619
class IOHandlerCursesGUI : public IOHandler {
1720
public:
@@ -34,7 +37,7 @@ class IOHandlerCursesGUI : public IOHandler {
3437
void TerminalSizeChanged() override;
3538

3639
protected:
37-
curses::ApplicationAP m_app_ap;
40+
std::unique_ptr<curses::Application> m_app_up;
3841
};
3942

4043
} // namespace lldb_private

lldb/source/Core/IOHandlerCursesGUI.cpp

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ using llvm::StringRef;
9494
#define KEY_SHIFT_TAB (KEY_MAX + 1)
9595
#define KEY_ALT_ENTER (KEY_MAX + 2)
9696

97+
namespace lldb_private {
9798
namespace curses {
9899
class Menu;
99100
class MenuDelegate;
@@ -4479,8 +4480,9 @@ class Application {
44794480
};
44804481

44814482
} // namespace curses
4483+
} // namespace lldb_private
44824484

4483-
using namespace curses;
4485+
using namespace lldb_private::curses;
44844486

44854487
struct Row {
44864488
ValueObjectUpdater value;
@@ -7573,12 +7575,12 @@ IOHandlerCursesGUI::IOHandlerCursesGUI(Debugger &debugger)
75737575

75747576
void IOHandlerCursesGUI::Activate() {
75757577
IOHandler::Activate();
7576-
if (!m_app_ap) {
7577-
m_app_ap = std::make_unique<Application>(GetInputFILE(), GetOutputFILE());
7578+
if (!m_app_up) {
7579+
m_app_up = std::make_unique<Application>(GetInputFILE(), GetOutputFILE());
75787580

75797581
// This is both a window and a menu delegate
75807582
std::shared_ptr<ApplicationDelegate> app_delegate_sp(
7581-
new ApplicationDelegate(*m_app_ap, m_debugger));
7583+
new ApplicationDelegate(*m_app_up, m_debugger));
75827584

75837585
MenuDelegateSP app_menu_delegate_sp =
75847586
std::static_pointer_cast<MenuDelegate>(app_delegate_sp);
@@ -7652,8 +7654,8 @@ void IOHandlerCursesGUI::Activate() {
76527654
help_menu_sp->AddSubmenu(MenuSP(new Menu(
76537655
"GUI Help", nullptr, 'g', ApplicationDelegate::eMenuID_HelpGUIHelp)));
76547656

7655-
m_app_ap->Initialize();
7656-
WindowSP &main_window_sp = m_app_ap->GetMainWindow();
7657+
m_app_up->Initialize();
7658+
WindowSP &main_window_sp = m_app_up->GetMainWindow();
76577659

76587660
MenuSP menubar_sp(new Menu(Menu::Type::Bar));
76597661
menubar_sp->AddSubmenu(lldb_menu_sp);
@@ -7734,10 +7736,10 @@ void IOHandlerCursesGUI::Activate() {
77347736
}
77357737
}
77367738

7737-
void IOHandlerCursesGUI::Deactivate() { m_app_ap->Terminate(); }
7739+
void IOHandlerCursesGUI::Deactivate() { m_app_up->Terminate(); }
77387740

77397741
void IOHandlerCursesGUI::Run() {
7740-
m_app_ap->Run(m_debugger);
7742+
m_app_up->Run(m_debugger);
77417743
SetIsDone(true);
77427744
}
77437745

@@ -7752,7 +7754,7 @@ bool IOHandlerCursesGUI::Interrupt() {
77527754
void IOHandlerCursesGUI::GotEOF() {}
77537755

77547756
void IOHandlerCursesGUI::TerminalSizeChanged() {
7755-
m_app_ap->TerminalSizeChanged();
7757+
m_app_up->TerminalSizeChanged();
77567758
}
77577759

77587760
#endif // LLDB_ENABLE_CURSES

0 commit comments

Comments
 (0)