Skip to content

Commit abde937

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. (cherry picked from commit 776fa2d)
1 parent a926ee7 commit abde937

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;
@@ -7571,12 +7573,12 @@ IOHandlerCursesGUI::IOHandlerCursesGUI(Debugger &debugger)
75717573

75727574
void IOHandlerCursesGUI::Activate() {
75737575
IOHandler::Activate();
7574-
if (!m_app_ap) {
7575-
m_app_ap = std::make_unique<Application>(GetInputFILE(), GetOutputFILE());
7576+
if (!m_app_up) {
7577+
m_app_up = std::make_unique<Application>(GetInputFILE(), GetOutputFILE());
75767578

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

75817583
MenuDelegateSP app_menu_delegate_sp =
75827584
std::static_pointer_cast<MenuDelegate>(app_delegate_sp);
@@ -7650,8 +7652,8 @@ void IOHandlerCursesGUI::Activate() {
76507652
help_menu_sp->AddSubmenu(MenuSP(new Menu(
76517653
"GUI Help", nullptr, 'g', ApplicationDelegate::eMenuID_HelpGUIHelp)));
76527654

7653-
m_app_ap->Initialize();
7654-
WindowSP &main_window_sp = m_app_ap->GetMainWindow();
7655+
m_app_up->Initialize();
7656+
WindowSP &main_window_sp = m_app_up->GetMainWindow();
76557657

76567658
MenuSP menubar_sp(new Menu(Menu::Type::Bar));
76577659
menubar_sp->AddSubmenu(lldb_menu_sp);
@@ -7732,10 +7734,10 @@ void IOHandlerCursesGUI::Activate() {
77327734
}
77337735
}
77347736

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

77377739
void IOHandlerCursesGUI::Run() {
7738-
m_app_ap->Run(m_debugger);
7740+
m_app_up->Run(m_debugger);
77397741
SetIsDone(true);
77407742
}
77417743

@@ -7750,7 +7752,7 @@ bool IOHandlerCursesGUI::Interrupt() {
77507752
void IOHandlerCursesGUI::GotEOF() {}
77517753

77527754
void IOHandlerCursesGUI::TerminalSizeChanged() {
7753-
m_app_ap->TerminalSizeChanged();
7755+
m_app_up->TerminalSizeChanged();
77547756
}
77557757

77567758
#endif // LLDB_ENABLE_CURSES

0 commit comments

Comments
 (0)