Author: Omar Emara Date: 2021-07-26T14:22:25-07:00 New Revision: ed5b4dbd3952ffa8970ae59faa7f7505cd28aa92
URL: https://github.com/llvm/llvm-project/commit/ed5b4dbd3952ffa8970ae59faa7f7505cd28aa92 DIFF: https://github.com/llvm/llvm-project/commit/ed5b4dbd3952ffa8970ae59faa7f7505cd28aa92.diff LOG: [LLDB][GUI] Add Arch Field This patch adds an Arch field that inputs and validates an arch spec. Differential Revision: https://reviews.llvm.org/D106564 Added: Modified: lldb/source/Core/IOHandlerCursesGUI.cpp Removed: ################################################################################ diff --git a/lldb/source/Core/IOHandlerCursesGUI.cpp b/lldb/source/Core/IOHandlerCursesGUI.cpp index e664ac1ba4bd..4bed788d4863 100644 --- a/lldb/source/Core/IOHandlerCursesGUI.cpp +++ b/lldb/source/Core/IOHandlerCursesGUI.cpp @@ -1374,6 +1374,25 @@ class DirectoryFieldDelegate : public TextFieldDelegate { bool m_need_to_exist; }; +class ArchFieldDelegate : public TextFieldDelegate { +public: + ArchFieldDelegate(const char *label, const char *content, bool required) + : TextFieldDelegate(label, content, required) {} + + void FieldDelegateExitCallback() override { + TextFieldDelegate::FieldDelegateExitCallback(); + if (!IsSpecified()) + return; + + if (!GetArchSpec().IsValid()) + SetError("Not a valid arch!"); + } + + const std::string &GetArchString() { return m_content; } + + ArchSpec GetArchSpec() { return ArchSpec(GetArchString()); } +}; + class BooleanFieldDelegate : public FieldDelegate { public: BooleanFieldDelegate(const char *label, bool content) @@ -1989,6 +2008,14 @@ class FormDelegate { return delegate; } + ArchFieldDelegate *AddArchField(const char *label, const char *content, + bool required) { + ArchFieldDelegate *delegate = + new ArchFieldDelegate(label, content, required); + m_fields.push_back(FieldDelegateUP(delegate)); + return delegate; + } + IntegerFieldDelegate *AddIntegerField(const char *label, int content, bool required) { IntegerFieldDelegate *delegate = _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits