This revision was automatically updated to reflect the committed changes.
Closed by commit rG52b04efa0197: [lldb] [Host] Remove TerminalStateSwitcher
(authored by mgorny).
Herald added a project: LLDB.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D110693/new/
https://reviews.llvm.org/D110693
Files:
lldb/include/lldb/Host/Terminal.h
lldb/source/Host/common/Terminal.cpp
Index: lldb/source/Host/common/Terminal.cpp
===================================================================
--- lldb/source/Host/common/Terminal.cpp
+++ lldb/source/Host/common/Terminal.cpp
@@ -188,50 +188,3 @@
bool TerminalState::ProcessGroupIsValid() const {
return static_cast<int32_t>(m_process_group) != -1;
}
-
-// Constructor
-TerminalStateSwitcher::TerminalStateSwitcher() = default;
-
-// Destructor
-TerminalStateSwitcher::~TerminalStateSwitcher() = default;
-
-// Returns the number of states that this switcher contains
-uint32_t TerminalStateSwitcher::GetNumberOfStates() const {
- return llvm::array_lengthof(m_ttystates);
-}
-
-// Restore the state at index "idx".
-//
-// Returns true if the restore was successful, false otherwise.
-bool TerminalStateSwitcher::Restore(uint32_t idx) const {
- const uint32_t num_states = GetNumberOfStates();
- if (idx >= num_states)
- return false;
-
- // See if we already are in this state?
- if (m_currentState < num_states && (idx == m_currentState) &&
- m_ttystates[idx].IsValid())
- return true;
-
- // Set the state to match the index passed in and only update the current
- // state if there are no errors.
- if (m_ttystates[idx].Restore()) {
- m_currentState = idx;
- return true;
- }
-
- // We failed to set the state. The tty state was invalid or not initialized.
- return false;
-}
-
-// Save the state at index "idx" for file descriptor "fd" and save the process
-// group if requested.
-//
-// Returns true if the restore was successful, false otherwise.
-bool TerminalStateSwitcher::Save(uint32_t idx, int fd,
- bool save_process_group) {
- const uint32_t num_states = GetNumberOfStates();
- if (idx < num_states)
- return m_ttystates[idx].Save(fd, save_process_group);
- return false;
-}
Index: lldb/include/lldb/Host/Terminal.h
===================================================================
--- lldb/include/lldb/Host/Terminal.h
+++ lldb/include/lldb/Host/Terminal.h
@@ -124,59 +124,6 @@
lldb::pid_t m_process_group = -1; ///< Cached process group information.
};
-/// \class TerminalStateSwitcher Terminal.h "lldb/Host/Terminal.h"
-/// A TTY state switching class.
-///
-/// This class can be used to remember 2 TTY states for a given file
-/// descriptor and switch between the two states.
-class TerminalStateSwitcher {
-public:
- /// Constructor
- TerminalStateSwitcher();
-
- /// Destructor
- ~TerminalStateSwitcher();
-
- /// Get the number of possible states to save.
- ///
- /// \return
- /// The number of states that this TTY switcher object contains.
- uint32_t GetNumberOfStates() const;
-
- /// Restore the TTY state for state at index \a idx.
- ///
- /// \return
- /// Returns \b true if the TTY state was successfully restored,
- /// \b false otherwise.
- bool Restore(uint32_t idx) const;
-
- /// Save the TTY state information for the state at index \a idx. The TTY
- /// state is saved for the file descriptor \a fd and the process group
- /// information will also be saved if requested by \a save_process_group.
- ///
- /// \param[in] idx
- /// The index into the state array where the state should be
- /// saved.
- ///
- /// \param[in] fd
- /// The file descriptor for which to save the settings.
- ///
- /// \param[in] save_process_group
- /// If \b true, save the process group information for the TTY.
- ///
- /// \return
- /// Returns \b true if the save was successful, \b false
- /// otherwise.
- bool Save(uint32_t idx, int fd, bool save_process_group);
-
-protected:
- // Member variables
- mutable uint32_t m_currentState =
- UINT32_MAX; ///< The currently active TTY state index.
- TerminalState
- m_ttystates[2]; ///< The array of TTY states that holds saved TTY info.
-};
-
} // namespace lldb_private
#endif // #if defined(__cplusplus)
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits