diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2015-12-30 11:55:28 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2015-12-30 11:55:28 +0000 |
commit | e81d9d49145e432d917eea3a70d2ae74dcad1d89 (patch) | |
tree | 9ed5e1a91f242e2cb5911577356e487a55c01b78 /include/lldb/Interpreter | |
parent | 85d8ef8f1f0e0e063a8571944302be2d2026f823 (diff) |
Notes
Diffstat (limited to 'include/lldb/Interpreter')
46 files changed, 801 insertions, 1778 deletions
diff --git a/include/lldb/Interpreter/Args.h b/include/lldb/Interpreter/Args.h index e11636b63f179..e79318ba5626c 100644 --- a/include/lldb/Interpreter/Args.h +++ b/include/lldb/Interpreter/Args.h @@ -424,6 +424,9 @@ public: static void ExpandEscapedCharacters (const char *src, std::string &dst); + static std::string + EscapeLLDBCommandArgument (const std::string& arg, char quote_char); + // This one isn't really relevant to Arguments per se, but we're using the Args as a // general strings container, so... void diff --git a/include/lldb/Interpreter/CommandCompletions.h b/include/lldb/Interpreter/CommandCompletions.h index 9df3041584ead..27ab45b3fa1f7 100644 --- a/include/lldb/Interpreter/CommandCompletions.h +++ b/include/lldb/Interpreter/CommandCompletions.h @@ -54,7 +54,6 @@ public: // so you can add custom enums starting from here in your Option class. // Also if you & in this bit the base code will not process the option. eCustomCompletion = (1u << 9) - } CommonCompletionTypes; struct CommonCompletionElement @@ -83,6 +82,7 @@ public: SearchFilter *searcher, bool &word_complete, StringList &matches); + static int DiskDirectories (CommandInterpreter &interpreter, const char *partial_file_name, @@ -170,16 +170,16 @@ public: int max_return_elements, StringList &matches); - virtual ~Completer (); + ~Completer() override; - virtual CallbackReturn - SearchCallback (SearchFilter &filter, - SymbolContext &context, - Address *addr, - bool complete) = 0; + CallbackReturn + SearchCallback(SearchFilter &filter, + SymbolContext &context, + Address *addr, + bool complete) override = 0; - virtual Depth - GetDepth () = 0; + Depth + GetDepth() override = 0; virtual size_t DoCompletion (SearchFilter *filter) = 0; @@ -190,8 +190,9 @@ public: int m_match_start_point; int m_max_return_elements; StringList &m_matches; + private: - DISALLOW_COPY_AND_ASSIGN (Completer); + DISALLOW_COPY_AND_ASSIGN(Completer); }; //---------------------------------------------------------------------- @@ -200,7 +201,6 @@ public: class SourceFileCompleter : public Completer { public: - SourceFileCompleter (CommandInterpreter &interpreter, bool include_support_files, const char *completion_str, @@ -208,24 +208,24 @@ public: int max_return_elements, StringList &matches); - virtual Searcher::Depth GetDepth (); + Searcher::Depth GetDepth() override; - virtual Searcher::CallbackReturn - SearchCallback (SearchFilter &filter, - SymbolContext &context, - Address *addr, - bool complete); + Searcher::CallbackReturn + SearchCallback(SearchFilter &filter, + SymbolContext &context, + Address *addr, + bool complete) override; size_t - DoCompletion (SearchFilter *filter); + DoCompletion(SearchFilter *filter) override; private: bool m_include_support_files; FileSpecList m_matching_files; const char *m_file_name; const char *m_dir_name; - DISALLOW_COPY_AND_ASSIGN (SourceFileCompleter); + DISALLOW_COPY_AND_ASSIGN(SourceFileCompleter); }; //---------------------------------------------------------------------- @@ -234,29 +234,28 @@ public: class ModuleCompleter : public Completer { public: - ModuleCompleter (CommandInterpreter &interpreter, const char *completion_str, int match_start_point, int max_return_elements, StringList &matches); - virtual Searcher::Depth GetDepth (); + Searcher::Depth GetDepth() override; - virtual Searcher::CallbackReturn - SearchCallback (SearchFilter &filter, - SymbolContext &context, - Address *addr, - bool complete); + Searcher::CallbackReturn + SearchCallback(SearchFilter &filter, + SymbolContext &context, + Address *addr, + bool complete) override; size_t - DoCompletion (SearchFilter *filter); + DoCompletion(SearchFilter *filter) override; private: const char *m_file_name; const char *m_dir_name; - DISALLOW_COPY_AND_ASSIGN (ModuleCompleter); + DISALLOW_COPY_AND_ASSIGN(ModuleCompleter); }; //---------------------------------------------------------------------- @@ -265,23 +264,22 @@ public: class SymbolCompleter : public Completer { public: - SymbolCompleter (CommandInterpreter &interpreter, const char *completion_str, int match_start_point, int max_return_elements, StringList &matches); - virtual Searcher::Depth GetDepth (); + Searcher::Depth GetDepth() override; - virtual Searcher::CallbackReturn - SearchCallback (SearchFilter &filter, - SymbolContext &context, - Address *addr, - bool complete); + Searcher::CallbackReturn + SearchCallback(SearchFilter &filter, + SymbolContext &context, + Address *addr, + bool complete) override; size_t - DoCompletion (SearchFilter *filter); + DoCompletion(SearchFilter *filter) override; private: // struct NameCmp { @@ -294,14 +292,14 @@ public: RegularExpression m_regex; typedef std::set<ConstString> collection; collection m_match_set; - DISALLOW_COPY_AND_ASSIGN (SymbolCompleter); + DISALLOW_COPY_AND_ASSIGN(SymbolCompleter); }; private: static CommonCompletionElement g_common_completions[]; - }; } // namespace lldb_private -#endif // lldb_CommandCompletions_h_ + +#endif // lldb_CommandCompletions_h_ diff --git a/include/lldb/Interpreter/CommandHistory.h b/include/lldb/Interpreter/CommandHistory.h index dbe6e99bb5b12..db5db15fc1e50 100644 --- a/include/lldb/Interpreter/CommandHistory.h +++ b/include/lldb/Interpreter/CommandHistory.h @@ -17,7 +17,6 @@ // Other libraries and framework includes // Project includes - #include "lldb/lldb-private.h" #include "lldb/Core/Stream.h" #include "lldb/Host/Mutex.h" diff --git a/include/lldb/Interpreter/CommandInterpreter.h b/include/lldb/Interpreter/CommandInterpreter.h index 1962050dffcbf..dd5c189d0ab93 100644 --- a/include/lldb/Interpreter/CommandInterpreter.h +++ b/include/lldb/Interpreter/CommandInterpreter.h @@ -14,6 +14,7 @@ // C++ Includes // Other libraries and framework includes // Project includes +#include "lldb/lldb-forward.h" #include "lldb/lldb-private.h" #include "lldb/Core/Broadcaster.h" #include "lldb/Core/Debugger.h" @@ -199,8 +200,6 @@ class CommandInterpreter : public IOHandlerDelegate { public: - - typedef std::map<std::string, OptionArgVectorSP> OptionArgMap; enum @@ -228,11 +227,17 @@ public: eCommandTypesAllThem = 0xFFFF // all commands }; + CommandInterpreter(Debugger &debugger, + lldb::ScriptLanguage script_language, + bool synchronous_execution); + + ~CommandInterpreter() override; + // These two functions fill out the Broadcaster interface: static ConstString &GetStaticBroadcasterClass (); - virtual ConstString &GetBroadcasterClass() const + ConstString &GetBroadcasterClass() const override { return GetStaticBroadcasterClass(); } @@ -241,13 +246,6 @@ public: SourceInitFile (bool in_cwd, CommandReturnObject &result); - CommandInterpreter (Debugger &debugger, - lldb::ScriptLanguage script_language, - bool synchronous_execution); - - virtual - ~CommandInterpreter (); - bool AddCommand (const char *name, const lldb::CommandObjectSP &cmd_sp, @@ -267,8 +265,8 @@ public: bool include_aliases); CommandObject * - GetCommandObject (const char *cmd, - StringList *matches = NULL); + GetCommandObject(const char *cmd, + StringList *matches = nullptr); bool CommandExists (const char *cmd); @@ -305,7 +303,6 @@ public: OptionArgVectorSP GetAliasOptions (const char *alias_name); - bool ProcessAliasOptionsArgs (lldb::CommandObjectSP &cmd_obj_sp, const char *options_args, @@ -325,20 +322,20 @@ public: CommandReturnObject &result); bool - HandleCommand (const char *command_line, - LazyBool add_to_history, - CommandReturnObject &result, - ExecutionContext *override_context = NULL, - bool repeat_on_empty_command = true, - bool no_context_switching = false); + HandleCommand(const char *command_line, + LazyBool add_to_history, + CommandReturnObject &result, + ExecutionContext *override_context = nullptr, + bool repeat_on_empty_command = true, + bool no_context_switching = false); //------------------------------------------------------------------ /// Execute a list of commands in sequence. /// /// @param[in] commands /// The list of commands to execute. - /// @param[in/out] context - /// The execution context in which to run the commands. Can be NULL in which case the default + /// @param[in,out] context + /// The execution context in which to run the commands. Can be nullptr in which case the default /// context will be used. /// @param[in] options /// This object holds the options used to control when to stop, whether to execute commands, @@ -358,8 +355,8 @@ public: /// /// @param[in] file /// The file from which to read in commands. - /// @param[in/out] context - /// The execution context in which to run the commands. Can be NULL in which case the default + /// @param[in,out] context + /// The execution context in which to run the commands. Can be nullptr in which case the default /// context will be used. /// @param[in] options /// This object holds the options used to control when to stop, whether to execute commands, @@ -393,7 +390,6 @@ public: // Otherwise, returns the number of matches. // // FIXME: Only max_return_elements == -1 is supported at present. - int HandleCompletion (const char *current_line, const char *cursor, @@ -406,7 +402,6 @@ public: // Help command can call it for the first argument. // word_complete tells whether the completions are considered a "complete" response (so the // completer should complete the quote & put a space after the word. - int HandleCompletionMatches (Args &input, int &cursor_index, @@ -416,7 +411,6 @@ public: bool &word_complete, StringList &matches); - int GetCommandNamesMatchingPartialString (const char *cmd_cstr, bool include_aliases, @@ -496,7 +490,6 @@ public: void SetScriptLanguage (lldb::ScriptLanguage lang); - bool HasCommands (); @@ -520,7 +513,10 @@ public: GetOptionArgumentPosition (const char *in_string); ScriptInterpreter * - GetScriptInterpreter (bool can_create = true); + GetScriptInterpreter(bool can_create = true); + + void + SetScriptInterpreter(); void SkipLLDBInitFiles (bool skip_lldbinit_files) @@ -647,7 +643,7 @@ public: } lldb::IOHandlerSP - GetIOHandler(bool force_create = false, CommandInterpreterRunOptions *options = NULL); + GetIOHandler(bool force_create = false, CommandInterpreterRunOptions *options = nullptr); bool GetStoppedForCrash () const @@ -655,26 +651,29 @@ public: return m_stopped_for_crash; } + bool + GetSpaceReplPrompts () const; + protected: friend class Debugger; //------------------------------------------------------------------ // IOHandlerDelegate functions //------------------------------------------------------------------ - virtual void - IOHandlerInputComplete (IOHandler &io_handler, - std::string &line); + void + IOHandlerInputComplete(IOHandler &io_handler, + std::string &line) override; - virtual ConstString - IOHandlerGetControlSequence (char ch) + ConstString + IOHandlerGetControlSequence(char ch) override { if (ch == 'd') return ConstString("quit\n"); return ConstString(); } - virtual bool - IOHandlerInterrupt (IOHandler &io_handler); + bool + IOHandlerInterrupt(IOHandler &io_handler) override; size_t GetProcessOutput (); @@ -683,11 +682,9 @@ protected: SetSynchronous (bool value); lldb::CommandObjectSP - GetCommandSP (const char *cmd, bool include_aliases = true, bool exact = true, StringList *matches = NULL); - + GetCommandSP(const char *cmd, bool include_aliases = true, bool exact = true, StringList *matches = nullptr); private: - Error PreprocessCommand (std::string &command); @@ -697,7 +694,6 @@ private: CommandObject * ResolveCommandImpl(std::string &command_line, CommandReturnObject &result); - Debugger &m_debugger; // The debugger session that this interpreter is associated with ExecutionContextRef m_exe_ctx_ref; // The current execution context to use when handling commands bool m_synchronous_execution; @@ -709,7 +705,7 @@ private: OptionArgMap m_alias_options; // Stores any options (with or without arguments) that go with any alias. CommandHistory m_command_history; std::string m_repeat_command; // Stores the command that will be executed for an empty command string. - std::unique_ptr<ScriptInterpreter> m_script_interpreter_ap; + lldb::ScriptInterpreterSP m_script_interpreter_sp; lldb::IOHandlerSP m_command_io_handler_sp; char m_comment_char; bool m_batch_command_mode; @@ -719,10 +715,8 @@ private: uint32_t m_num_errors; bool m_quit_requested; bool m_stopped_for_crash; - }; - } // namespace lldb_private -#endif // liblldb_CommandInterpreter_h_ +#endif // liblldb_CommandInterpreter_h_ diff --git a/include/lldb/Interpreter/CommandObject.h b/include/lldb/Interpreter/CommandObject.h index 023de29c7b6c6..8015fec41cd29 100644 --- a/include/lldb/Interpreter/CommandObject.h +++ b/include/lldb/Interpreter/CommandObject.h @@ -10,11 +10,14 @@ #ifndef liblldb_CommandObject_h_ #define liblldb_CommandObject_h_ +// C Includes +// C++ Includes #include <map> -#include <set> #include <string> #include <vector> +// Other libraries and framework includes +// Project includes #include "lldb/lldb-private.h" #include "lldb/Interpreter/Args.h" #include "lldb/Interpreter/CommandCompletions.h" @@ -28,7 +31,6 @@ namespace lldb_private { class CommandObject { public: - typedef const char *(ArgumentHelpCallbackFunction) (); struct ArgumentHelpCallback @@ -44,9 +46,8 @@ public: explicit operator bool() const { - return (help_callback != NULL); + return (help_callback != nullptr); } - }; struct ArgumentTableEntry // Entries in the main argument information table @@ -76,16 +77,15 @@ public: typedef std::map<std::string, lldb::CommandObjectSP> CommandMap; - CommandObject (CommandInterpreter &interpreter, - const char *name, - const char *help = NULL, - const char *syntax = NULL, - uint32_t flags = 0); + CommandObject(CommandInterpreter &interpreter, + const char *name, + const char *help = nullptr, + const char *syntax = nullptr, + uint32_t flags = 0); virtual ~CommandObject (); - static const char * GetArgumentTypeAsCString (const lldb::CommandArgumentType arg_type); @@ -141,15 +141,15 @@ public: IsMultiwordObject () { return false; } virtual lldb::CommandObjectSP - GetSubcommandSP (const char *sub_cmd, StringList *matches = NULL) + GetSubcommandSP(const char *sub_cmd, StringList *matches = nullptr) { return lldb::CommandObjectSP(); } virtual CommandObject * - GetSubcommandObject (const char *sub_cmd, StringList *matches = NULL) + GetSubcommandObject(const char *sub_cmd, StringList *matches = nullptr) { - return NULL; + return nullptr; } virtual void @@ -326,7 +326,6 @@ public: /// @return /// The number of completions. //------------------------------------------------------------------ - virtual int HandleArgumentCompletion (Args &input, int &cursor_index, @@ -374,13 +373,13 @@ public: /// The complete current command line. /// /// @return - /// NULL if there is no special repeat command - it will use the current command line. + /// nullptr if there is no special repeat command - it will use the current command line. /// Otherwise a pointer to the command to be repeated. /// If the returned string is the empty string, the command won't be repeated. //------------------------------------------------------------------ virtual const char *GetRepeatCommand (Args ¤t_command_args, uint32_t index) { - return NULL; + return nullptr; } bool @@ -488,62 +487,61 @@ protected: // to the specified command argument entry. static void AddIDsArgumentData(CommandArgumentEntry &arg, lldb::CommandArgumentType ID, lldb::CommandArgumentType IDRange); - }; class CommandObjectParsed : public CommandObject { public: - - CommandObjectParsed (CommandInterpreter &interpreter, - const char *name, - const char *help = NULL, - const char *syntax = NULL, - uint32_t flags = 0) : + CommandObjectParsed(CommandInterpreter &interpreter, + const char *name, + const char *help = nullptr, + const char *syntax = nullptr, + uint32_t flags = 0) : CommandObject (interpreter, name, help, syntax, flags) {} - virtual - ~CommandObjectParsed () {}; + ~CommandObjectParsed() override = default; - virtual bool - Execute (const char *args_string, CommandReturnObject &result); + bool + Execute(const char *args_string, CommandReturnObject &result) override; protected: virtual bool DoExecute (Args& command, CommandReturnObject &result) = 0; - virtual bool - WantsRawCommandString() { return false; }; + bool + WantsRawCommandString() override + { + return false; + } }; class CommandObjectRaw : public CommandObject { public: - - CommandObjectRaw (CommandInterpreter &interpreter, - const char *name, - const char *help = NULL, - const char *syntax = NULL, - uint32_t flags = 0) : + CommandObjectRaw(CommandInterpreter &interpreter, + const char *name, + const char *help = nullptr, + const char *syntax = nullptr, + uint32_t flags = 0) : CommandObject (interpreter, name, help, syntax, flags) {} - virtual - ~CommandObjectRaw () {}; + ~CommandObjectRaw() override = default; - virtual bool - Execute (const char *args_string, CommandReturnObject &result); + bool + Execute(const char *args_string, CommandReturnObject &result) override; protected: virtual bool DoExecute (const char *command, CommandReturnObject &result) = 0; - virtual bool - WantsRawCommandString() { return true; }; + bool + WantsRawCommandString() override + { + return true; + } }; - } // namespace lldb_private - -#endif // liblldb_CommandObject_h_ +#endif // liblldb_CommandObject_h_ diff --git a/include/lldb/Interpreter/CommandObjectMultiword.h b/include/lldb/Interpreter/CommandObjectMultiword.h index 491d43c4bd9db..e1ad2940c3837 100644 --- a/include/lldb/Interpreter/CommandObjectMultiword.h +++ b/include/lldb/Interpreter/CommandObjectMultiword.h @@ -12,8 +12,6 @@ // C Includes // C++ Includes -#include <map> - // Other libraries and framework includes // Project includes #include "lldb/Interpreter/CommandObject.h" @@ -30,57 +28,66 @@ class CommandObjectMultiword : public CommandObject friend class CommandInterpreter; friend class CommandObjectSyntax; public: - CommandObjectMultiword (CommandInterpreter &interpreter, - const char *name, - const char *help = NULL, - const char *syntax = NULL, - uint32_t flags = 0); + CommandObjectMultiword(CommandInterpreter &interpreter, + const char *name, + const char *help = nullptr, + const char *syntax = nullptr, + uint32_t flags = 0); - virtual - ~CommandObjectMultiword (); + ~CommandObjectMultiword() override; - virtual bool - IsMultiwordObject () { return true; } + bool + IsMultiwordObject() override + { + return true; + } - virtual bool - LoadSubCommand (const char *cmd_name, - const lldb::CommandObjectSP& command_obj); + bool + LoadSubCommand(const char *cmd_name, + const lldb::CommandObjectSP& command_obj) override; - virtual void - GenerateHelpText (Stream &output_stream); + void + GenerateHelpText(Stream &output_stream) override; - virtual lldb::CommandObjectSP - GetSubcommandSP (const char *sub_cmd, StringList *matches = NULL); + lldb::CommandObjectSP + GetSubcommandSP(const char *sub_cmd, StringList *matches = nullptr) override; - virtual CommandObject * - GetSubcommandObject (const char *sub_cmd, StringList *matches = NULL); - - virtual void - AproposAllSubCommands (const char *prefix, - const char *search_word, - StringList &commands_found, - StringList &commands_help); - - virtual bool - WantsRawCommandString() { return false; }; - - virtual int - HandleCompletion (Args &input, - int &cursor_index, - int &cursor_char_position, - int match_start_point, - int max_return_elements, - bool &word_complete, - StringList &matches); - - virtual const char *GetRepeatCommand (Args ¤t_command_args, uint32_t index); - - virtual bool - Execute (const char *args_string, - CommandReturnObject &result); + CommandObject * + GetSubcommandObject(const char *sub_cmd, StringList *matches = nullptr) override; + + void + AproposAllSubCommands(const char *prefix, + const char *search_word, + StringList &commands_found, + StringList &commands_help) override; + + bool + WantsRawCommandString() override + { + return false; + } + + int + HandleCompletion(Args &input, + int &cursor_index, + int &cursor_char_position, + int match_start_point, + int max_return_elements, + bool &word_complete, + StringList &matches) override; + + const char * + GetRepeatCommand (Args ¤t_command_args, uint32_t index) override; + + bool + Execute(const char *args_string, + CommandReturnObject &result) override; - virtual bool - IsRemovable() const { return m_can_be_removed; } + bool + IsRemovable() const override + { + return m_can_be_removed; + } void SetRemovable (bool removable) @@ -93,95 +100,93 @@ protected: CommandObject::CommandMap m_subcommand_dict; bool m_can_be_removed; }; - class CommandObjectProxy : public CommandObject { public: - CommandObjectProxy (CommandInterpreter &interpreter, - const char *name, - const char *help = NULL, - const char *syntax = NULL, - uint32_t flags = 0); + CommandObjectProxy(CommandInterpreter &interpreter, + const char *name, + const char *help = nullptr, + const char *syntax = nullptr, + uint32_t flags = 0); - virtual - ~CommandObjectProxy (); + ~CommandObjectProxy() override; // Subclasses must provide a command object that will be transparently // used for this object. virtual CommandObject * GetProxyCommandObject() = 0; - virtual const char * - GetHelpLong (); + const char * + GetHelpLong() override; - virtual bool - IsRemovable() const; + bool + IsRemovable() const override; - virtual bool - IsMultiwordObject (); - - virtual lldb::CommandObjectSP - GetSubcommandSP (const char *sub_cmd, StringList *matches = NULL); - - virtual CommandObject * - GetSubcommandObject (const char *sub_cmd, StringList *matches = NULL); + bool + IsMultiwordObject() override; - virtual void - AproposAllSubCommands (const char *prefix, - const char *search_word, - StringList &commands_found, - StringList &commands_help); - - virtual bool - LoadSubCommand (const char *cmd_name, - const lldb::CommandObjectSP& command_obj); - - virtual bool - WantsRawCommandString(); + void + GenerateHelpText (Stream &result) override; - virtual bool - WantsCompletion(); + lldb::CommandObjectSP + GetSubcommandSP(const char *sub_cmd, StringList *matches = nullptr) override; - virtual Options * - GetOptions (); + CommandObject * + GetSubcommandObject(const char *sub_cmd, StringList *matches = nullptr) override; - - virtual int - HandleCompletion (Args &input, - int &cursor_index, - int &cursor_char_position, - int match_start_point, - int max_return_elements, - bool &word_complete, - StringList &matches); - - virtual int - HandleArgumentCompletion (Args &input, - int &cursor_index, - int &cursor_char_position, - OptionElementVector &opt_element_vector, - int match_start_point, - int max_return_elements, - bool &word_complete, - StringList &matches); - - virtual const char * - GetRepeatCommand (Args ¤t_command_args, - uint32_t index); - - virtual bool - Execute (const char *args_string, - CommandReturnObject &result); + void + AproposAllSubCommands(const char *prefix, + const char *search_word, + StringList &commands_found, + StringList &commands_help) override; + + bool + LoadSubCommand(const char *cmd_name, + const lldb::CommandObjectSP& command_obj) override; + + bool + WantsRawCommandString() override; + + bool + WantsCompletion() override; + + Options * + GetOptions() override; + + int + HandleCompletion(Args &input, + int &cursor_index, + int &cursor_char_position, + int match_start_point, + int max_return_elements, + bool &word_complete, + StringList &matches) override; + + int + HandleArgumentCompletion(Args &input, + int &cursor_index, + int &cursor_char_position, + OptionElementVector &opt_element_vector, + int match_start_point, + int max_return_elements, + bool &word_complete, + StringList &matches) override; + + const char * + GetRepeatCommand(Args ¤t_command_args, + uint32_t index) override; + + bool + Execute(const char *args_string, + CommandReturnObject &result) override; protected: - // These two want to iterate over the subcommand dictionary. friend class CommandInterpreter; friend class CommandObjectSyntax; - }; } // namespace lldb_private -#endif // liblldb_CommandObjectMultiword_h_ +#endif // liblldb_CommandObjectMultiword_h_ diff --git a/include/lldb/Interpreter/CommandObjectRegexCommand.h b/include/lldb/Interpreter/CommandObjectRegexCommand.h index d865446387765..9f8974a32bb20 100644 --- a/include/lldb/Interpreter/CommandObjectRegexCommand.h +++ b/include/lldb/Interpreter/CommandObjectRegexCommand.h @@ -28,7 +28,6 @@ namespace lldb_private { class CommandObjectRegexCommand : public CommandObjectRaw { public: - CommandObjectRegexCommand (CommandInterpreter &interpreter, const char *name, const char *help, @@ -37,8 +36,7 @@ public: uint32_t completion_type_mask, bool is_removable); - virtual - ~CommandObjectRegexCommand (); + ~CommandObjectRegexCommand() override; bool IsRemovable () const override { return m_is_removable; } @@ -83,4 +81,4 @@ private: } // namespace lldb_private -#endif // liblldb_CommandObjectRegexCommand_h_ +#endif // liblldb_CommandObjectRegexCommand_h_ diff --git a/include/lldb/Interpreter/CommandOptionValidators.h b/include/lldb/Interpreter/CommandOptionValidators.h index 6be247ad4b65c..395cb8ed3d9ec 100644 --- a/include/lldb/Interpreter/CommandOptionValidators.h +++ b/include/lldb/Interpreter/CommandOptionValidators.h @@ -10,6 +10,10 @@ #ifndef liblldb_CommandOptionValidators_h_ #define liblldb_CommandOptionValidators_h_ +// C Includes +// C++ Includes +// Other libraries and framework includes +// Project includes #include "lldb/lldb-private-types.h" namespace lldb_private { @@ -19,12 +23,11 @@ class ExecutionContext; class PosixPlatformCommandOptionValidator : public OptionValidator { - virtual bool IsValid(Platform &platform, const ExecutionContext &target) const; - virtual const char* ShortConditionString() const; - virtual const char* LongConditionString() const; + bool IsValid(Platform &platform, const ExecutionContext &target) const override; + const char* ShortConditionString() const override; + const char* LongConditionString() const override; }; } // namespace lldb_private - -#endif // liblldb_CommandOptionValidators_h_ +#endif // liblldb_CommandOptionValidators_h_ diff --git a/include/lldb/Interpreter/CommandReturnObject.h b/include/lldb/Interpreter/CommandReturnObject.h index b922e1731d7e5..424ac800d14c0 100644 --- a/include/lldb/Interpreter/CommandReturnObject.h +++ b/include/lldb/Interpreter/CommandReturnObject.h @@ -22,11 +22,9 @@ namespace lldb_private { - class CommandReturnObject { public: - CommandReturnObject (); ~CommandReturnObject (); @@ -142,8 +140,8 @@ public: AppendErrorWithFormat (const char *format, ...) __attribute__ ((format (printf, 2, 3))); void - SetError (const Error &error, - const char *fallback_error_cstr = NULL); + SetError(const Error &error, + const char *fallback_error_cstr = nullptr); void SetError (const char *error_cstr); @@ -189,4 +187,4 @@ private: } // namespace lldb_private -#endif // liblldb_CommandReturnObject_h_ +#endif // liblldb_CommandReturnObject_h_ diff --git a/include/lldb/Interpreter/OptionGroupArchitecture.h b/include/lldb/Interpreter/OptionGroupArchitecture.h index 7cd1ca3d710d2..5ee608506c04b 100644 --- a/include/lldb/Interpreter/OptionGroupArchitecture.h +++ b/include/lldb/Interpreter/OptionGroupArchitecture.h @@ -26,26 +26,23 @@ namespace lldb_private { class OptionGroupArchitecture : public OptionGroup { public: - OptionGroupArchitecture (); - virtual - ~OptionGroupArchitecture (); + ~OptionGroupArchitecture() override; + uint32_t + GetNumDefinitions() override; - virtual uint32_t - GetNumDefinitions (); - - virtual const OptionDefinition* - GetDefinitions (); + const OptionDefinition* + GetDefinitions() override; - virtual Error - SetOptionValue (CommandInterpreter &interpreter, - uint32_t option_idx, - const char *option_value); + Error + SetOptionValue(CommandInterpreter &interpreter, + uint32_t option_idx, + const char *option_value) override; - virtual void - OptionParsingStarting (CommandInterpreter &interpreter); + void + OptionParsingStarting(CommandInterpreter &interpreter) override; bool GetArchitecture (Platform *platform, ArchSpec &arch); @@ -55,19 +52,17 @@ public: { return !m_arch_str.empty(); } + const char * - GetArchitectureName () + GetArchitectureName() { - if (m_arch_str.empty()) - return NULL; - return m_arch_str.c_str(); + return (m_arch_str.empty() ? nullptr : m_arch_str.c_str()); } protected: - std::string m_arch_str; // Save the arch triple in case a platform is specified after the architecture }; } // namespace lldb_private -#endif // liblldb_OptionGroupArchitecture_h_ +#endif // liblldb_OptionGroupArchitecture_h_ diff --git a/include/lldb/Interpreter/OptionGroupBoolean.h b/include/lldb/Interpreter/OptionGroupBoolean.h index 0d861b2416946..881a1bdf4be67 100644 --- a/include/lldb/Interpreter/OptionGroupBoolean.h +++ b/include/lldb/Interpreter/OptionGroupBoolean.h @@ -36,29 +36,27 @@ namespace lldb_private { bool default_value, bool no_argument_toggle_default); - virtual - ~OptionGroupBoolean (); - - - virtual uint32_t - GetNumDefinitions () + ~OptionGroupBoolean() override; + + uint32_t + GetNumDefinitions() override { return 1; } - virtual const OptionDefinition* - GetDefinitions () + const OptionDefinition* + GetDefinitions() override { return &m_option_definition; } - virtual Error - SetOptionValue (CommandInterpreter &interpreter, - uint32_t option_idx, - const char *option_value); + Error + SetOptionValue(CommandInterpreter &interpreter, + uint32_t option_idx, + const char *option_value) override; - virtual void - OptionParsingStarting (CommandInterpreter &interpreter); + void + OptionParsingStarting(CommandInterpreter &interpreter) override; OptionValueBoolean & GetOptionValue () @@ -75,9 +73,8 @@ namespace lldb_private { protected: OptionValueBoolean m_value; OptionDefinition m_option_definition; - }; } // namespace lldb_private -#endif // liblldb_OptionGroupBoolean_h_ +#endif // liblldb_OptionGroupBoolean_h_ diff --git a/include/lldb/Interpreter/OptionGroupFile.h b/include/lldb/Interpreter/OptionGroupFile.h index 632a2dbdf2200..9e35dd43ab7aa 100644 --- a/include/lldb/Interpreter/OptionGroupFile.h +++ b/include/lldb/Interpreter/OptionGroupFile.h @@ -1,4 +1,4 @@ -//===-- OptionGroupFile.h -------------------------------*- C++ -*-===// +//===-- OptionGroupFile.h ---------------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // @@ -27,7 +27,6 @@ namespace lldb_private { class OptionGroupFile : public OptionGroup { public: - OptionGroupFile (uint32_t usage_mask, bool required, const char *long_option, @@ -36,29 +35,27 @@ public: lldb::CommandArgumentType argument_type, const char *usage_text); - virtual - ~OptionGroupFile (); + ~OptionGroupFile() override; - - virtual uint32_t - GetNumDefinitions () + uint32_t + GetNumDefinitions() override { return 1; } - virtual const OptionDefinition* - GetDefinitions () + const OptionDefinition* + GetDefinitions() override { return &m_option_definition; } - virtual Error - SetOptionValue (CommandInterpreter &interpreter, - uint32_t option_idx, - const char *option_value); + Error + SetOptionValue(CommandInterpreter &interpreter, + uint32_t option_idx, + const char *option_value) override; - virtual void - OptionParsingStarting (CommandInterpreter &interpreter); + void + OptionParsingStarting(CommandInterpreter &interpreter) override; OptionValueFileSpec & GetOptionValue () @@ -75,7 +72,6 @@ public: protected: OptionValueFileSpec m_file; OptionDefinition m_option_definition; - }; //------------------------------------------------------------------------- @@ -94,30 +90,27 @@ public: lldb::CommandArgumentType argument_type, const char *usage_text); - virtual - ~OptionGroupFileList (); + ~OptionGroupFileList() override; - - virtual uint32_t - GetNumDefinitions () + uint32_t + GetNumDefinitions() override { return 1; } - virtual const OptionDefinition* - GetDefinitions () + const OptionDefinition* + GetDefinitions() override { return &m_option_definition; } - virtual Error - SetOptionValue (CommandInterpreter &interpreter, - uint32_t option_idx, - const char *option_value); - - virtual void - OptionParsingStarting (CommandInterpreter &interpreter); + Error + SetOptionValue(CommandInterpreter &interpreter, + uint32_t option_idx, + const char *option_value) override; + void + OptionParsingStarting(CommandInterpreter &interpreter) override; OptionValueFileSpecList & GetOptionValue () @@ -134,9 +127,8 @@ public: protected: OptionValueFileSpecList m_file_list; OptionDefinition m_option_definition; - }; } // namespace lldb_private -#endif // liblldb_OptionGroupFile_h_ +#endif // liblldb_OptionGroupFile_h_ diff --git a/include/lldb/Interpreter/OptionGroupFormat.h b/include/lldb/Interpreter/OptionGroupFormat.h index 7419b04966681..9a96cc505de4c 100644 --- a/include/lldb/Interpreter/OptionGroupFormat.h +++ b/include/lldb/Interpreter/OptionGroupFormat.h @@ -1,4 +1,4 @@ -//===-- OptionGroupFormat.h -------------------------------*- C++ -*-===// +//===-- OptionGroupFormat.h -------------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // @@ -37,23 +37,21 @@ public: uint64_t default_byte_size = UINT64_MAX, // Pass UINT64_MAX to disable the "--size" option uint64_t default_count = UINT64_MAX); // Pass UINT64_MAX to disable the "--count" option - virtual - ~OptionGroupFormat (); + ~OptionGroupFormat() override; + uint32_t + GetNumDefinitions() override; - virtual uint32_t - GetNumDefinitions (); + const OptionDefinition* + GetDefinitions() override; - virtual const OptionDefinition* - GetDefinitions (); + Error + SetOptionValue(CommandInterpreter &interpreter, + uint32_t option_idx, + const char *option_value) override; - virtual Error - SetOptionValue (CommandInterpreter &interpreter, - uint32_t option_idx, - const char *option_value); - - virtual void - OptionParsingStarting (CommandInterpreter &interpreter); + void + OptionParsingStarting(CommandInterpreter &interpreter) override; lldb::Format GetFormat () const @@ -112,7 +110,6 @@ public: } protected: - bool ParserGDBFormatLetter (CommandInterpreter &interpreter, char format_letter, @@ -124,10 +121,9 @@ protected: OptionValueUInt64 m_count; char m_prev_gdb_format; char m_prev_gdb_size; - bool m_has_gdb_format; }; } // namespace lldb_private -#endif // liblldb_OptionGroupFormat_h_ +#endif // liblldb_OptionGroupFormat_h_ diff --git a/include/lldb/Interpreter/OptionGroupOutputFile.h b/include/lldb/Interpreter/OptionGroupOutputFile.h index 533cd6ee8eb3f..e6083714c48d1 100644 --- a/include/lldb/Interpreter/OptionGroupOutputFile.h +++ b/include/lldb/Interpreter/OptionGroupOutputFile.h @@ -1,4 +1,4 @@ -//===-- OptionGroupOutputFile.h -------------------------------*- C++ -*-===// +//===-- OptionGroupOutputFile.h ---------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // @@ -26,26 +26,23 @@ namespace lldb_private { class OptionGroupOutputFile : public OptionGroup { public: - OptionGroupOutputFile (); - virtual - ~OptionGroupOutputFile (); + ~OptionGroupOutputFile() override; + uint32_t + GetNumDefinitions() override; - virtual uint32_t - GetNumDefinitions (); - - virtual const OptionDefinition* - GetDefinitions (); + const OptionDefinition* + GetDefinitions() override; - virtual Error - SetOptionValue (CommandInterpreter &interpreter, - uint32_t option_idx, - const char *option_value); + Error + SetOptionValue(CommandInterpreter &interpreter, + uint32_t option_idx, + const char *option_value) override; - virtual void - OptionParsingStarting (CommandInterpreter &interpreter); + void + OptionParsingStarting(CommandInterpreter &interpreter) override; const OptionValueFileSpec & GetFile () @@ -68,9 +65,8 @@ public: protected: OptionValueFileSpec m_file; OptionValueBoolean m_append; - }; } // namespace lldb_private -#endif // liblldb_OptionGroupOutputFile_h_ +#endif // liblldb_OptionGroupOutputFile_h_ diff --git a/include/lldb/Interpreter/OptionGroupPlatform.h b/include/lldb/Interpreter/OptionGroupPlatform.h index f7de50c86a563..68880236accc2 100644 --- a/include/lldb/Interpreter/OptionGroupPlatform.h +++ b/include/lldb/Interpreter/OptionGroupPlatform.h @@ -27,7 +27,6 @@ namespace lldb_private { class OptionGroupPlatform : public OptionGroup { public: - OptionGroupPlatform (bool include_platform_option) : OptionGroup(), m_platform_name (), @@ -39,24 +38,21 @@ public: { } - virtual - ~OptionGroupPlatform () - { - } + ~OptionGroupPlatform() override = default; - virtual uint32_t - GetNumDefinitions (); + uint32_t + GetNumDefinitions() override; - virtual const OptionDefinition* - GetDefinitions (); + const OptionDefinition* + GetDefinitions() override; - virtual Error - SetOptionValue (CommandInterpreter &interpreter, - uint32_t option_idx, - const char *option_value); + Error + SetOptionValue(CommandInterpreter &interpreter, + uint32_t option_idx, + const char *option_value) override; - virtual void - OptionParsingStarting (CommandInterpreter &interpreter); + void + OptionParsingStarting(CommandInterpreter &interpreter) override; lldb::PlatformSP CreatePlatformWithOptions (CommandInterpreter &interpreter, @@ -119,4 +115,4 @@ protected: } // namespace lldb_private -#endif // liblldb_OptionGroupPlatform_h_ +#endif // liblldb_OptionGroupPlatform_h_ diff --git a/include/lldb/Interpreter/OptionGroupString.h b/include/lldb/Interpreter/OptionGroupString.h index e62a81bc41180..6f46bdb79408c 100644 --- a/include/lldb/Interpreter/OptionGroupString.h +++ b/include/lldb/Interpreter/OptionGroupString.h @@ -1,4 +1,4 @@ -//===-- OptionGroupString.h ------------------------------------*- C++ -*-===// +//===-- OptionGroupString.h -------------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // @@ -25,7 +25,6 @@ namespace lldb_private { class OptionGroupString : public OptionGroup { public: - OptionGroupString (uint32_t usage_mask, bool required, const char *long_option, @@ -35,29 +34,27 @@ namespace lldb_private { const char *usage_text, const char *default_value); - virtual - ~OptionGroupString (); - - - virtual uint32_t - GetNumDefinitions () + ~OptionGroupString() override; + + uint32_t + GetNumDefinitions() override { return 1; } - virtual const OptionDefinition* - GetDefinitions () + const OptionDefinition* + GetDefinitions() override { return &m_option_definition; } - virtual Error - SetOptionValue (CommandInterpreter &interpreter, - uint32_t option_idx, - const char *option_value); + Error + SetOptionValue(CommandInterpreter &interpreter, + uint32_t option_idx, + const char *option_value) override; - virtual void - OptionParsingStarting (CommandInterpreter &interpreter); + void + OptionParsingStarting(CommandInterpreter &interpreter) override; OptionValueString & GetOptionValue () @@ -74,9 +71,8 @@ namespace lldb_private { protected: OptionValueString m_value; OptionDefinition m_option_definition; - }; } // namespace lldb_private -#endif // liblldb_OptionGroupString_h_ +#endif // liblldb_OptionGroupString_h_ diff --git a/include/lldb/Interpreter/OptionGroupUInt64.h b/include/lldb/Interpreter/OptionGroupUInt64.h index c5f9e85d2f8f8..b03c1ff889a11 100644 --- a/include/lldb/Interpreter/OptionGroupUInt64.h +++ b/include/lldb/Interpreter/OptionGroupUInt64.h @@ -1,4 +1,4 @@ -//===-- OptionGroupUInt64.h ------------------------------------*- C++ -*-===// +//===-- OptionGroupUInt64.h -------------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // @@ -18,6 +18,7 @@ #include "lldb/Interpreter/OptionValueUInt64.h" namespace lldb_private { + //------------------------------------------------------------------------- // OptionGroupUInt64 //------------------------------------------------------------------------- @@ -25,7 +26,6 @@ namespace lldb_private { class OptionGroupUInt64 : public OptionGroup { public: - OptionGroupUInt64 (uint32_t usage_mask, bool required, const char *long_option, @@ -35,29 +35,27 @@ namespace lldb_private { const char *usage_text, uint64_t default_value); - virtual - ~OptionGroupUInt64 (); - - - virtual uint32_t - GetNumDefinitions () + ~OptionGroupUInt64() override; + + uint32_t + GetNumDefinitions() override { return 1; } - virtual const OptionDefinition* - GetDefinitions () + const OptionDefinition* + GetDefinitions() override { return &m_option_definition; } - virtual Error - SetOptionValue (CommandInterpreter &interpreter, - uint32_t option_idx, - const char *option_value); + Error + SetOptionValue(CommandInterpreter &interpreter, + uint32_t option_idx, + const char *option_value) override; - virtual void - OptionParsingStarting (CommandInterpreter &interpreter); + void + OptionParsingStarting(CommandInterpreter &interpreter) override; OptionValueUInt64 & GetOptionValue () @@ -74,9 +72,8 @@ namespace lldb_private { protected: OptionValueUInt64 m_value; OptionDefinition m_option_definition; - }; } // namespace lldb_private -#endif // liblldb_OptionGroupUInt64_h_ +#endif // liblldb_OptionGroupUInt64_h_ diff --git a/include/lldb/Interpreter/OptionGroupUUID.h b/include/lldb/Interpreter/OptionGroupUUID.h index ea968d737969d..6495699dce752 100644 --- a/include/lldb/Interpreter/OptionGroupUUID.h +++ b/include/lldb/Interpreter/OptionGroupUUID.h @@ -18,6 +18,7 @@ #include "lldb/Interpreter/OptionValueUUID.h" namespace lldb_private { + //------------------------------------------------------------------------- // OptionGroupUUID //------------------------------------------------------------------------- @@ -25,26 +26,23 @@ namespace lldb_private { class OptionGroupUUID : public OptionGroup { public: - OptionGroupUUID (); - virtual - ~OptionGroupUUID (); + ~OptionGroupUUID() override; + uint32_t + GetNumDefinitions() override; - virtual uint32_t - GetNumDefinitions (); - - virtual const OptionDefinition* - GetDefinitions (); + const OptionDefinition* + GetDefinitions() override; - virtual Error - SetOptionValue (CommandInterpreter &interpreter, - uint32_t option_idx, - const char *option_value); + Error + SetOptionValue(CommandInterpreter &interpreter, + uint32_t option_idx, + const char *option_value) override; - virtual void - OptionParsingStarting (CommandInterpreter &interpreter); + void + OptionParsingStarting(CommandInterpreter &interpreter) override; const OptionValueUUID & GetOptionValue () const @@ -58,4 +56,4 @@ protected: } // namespace lldb_private -#endif // liblldb_OptionGroupUUID_h_ +#endif // liblldb_OptionGroupUUID_h_ diff --git a/include/lldb/Interpreter/OptionGroupValueObjectDisplay.h b/include/lldb/Interpreter/OptionGroupValueObjectDisplay.h index 5cce126f89bf6..53c8550da81e7 100644 --- a/include/lldb/Interpreter/OptionGroupValueObjectDisplay.h +++ b/include/lldb/Interpreter/OptionGroupValueObjectDisplay.h @@ -1,4 +1,4 @@ -//===-- OptionGroupValueObjectDisplay.h -------------------------------*- C++ -*-===// +//===-- OptionGroupValueObjectDisplay.h -------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // @@ -26,41 +26,38 @@ namespace lldb_private { class OptionGroupValueObjectDisplay : public OptionGroup { public: - OptionGroupValueObjectDisplay (); - virtual - ~OptionGroupValueObjectDisplay (); + ~OptionGroupValueObjectDisplay() override; + uint32_t + GetNumDefinitions() override; - virtual uint32_t - GetNumDefinitions (); - - virtual const OptionDefinition* - GetDefinitions (); + const OptionDefinition* + GetDefinitions() override; - virtual Error - SetOptionValue (CommandInterpreter &interpreter, - uint32_t option_idx, - const char *option_value); + Error + SetOptionValue(CommandInterpreter &interpreter, + uint32_t option_idx, + const char *option_value) override; - virtual void - OptionParsingStarting (CommandInterpreter &interpreter); + void + OptionParsingStarting(CommandInterpreter &interpreter) override; bool AnyOptionWasSet () const { - return show_types == true || - no_summary_depth != 0 || - show_location == true || - flat_output == true || - use_objc == true || + return show_types || + no_summary_depth != 0 || + show_location || + flat_output || + use_objc || max_depth != UINT32_MAX || ptr_depth != 0 || - use_synth == false || - be_raw == true || - ignore_cap == true || - run_validator == true; + !use_synth || + be_raw || + ignore_cap || + run_validator; } DumpValueObjectOptions @@ -85,4 +82,4 @@ public: } // namespace lldb_private -#endif // liblldb_OptionGroupValueObjectDisplay_h_ +#endif // liblldb_OptionGroupValueObjectDisplay_h_ diff --git a/include/lldb/Interpreter/OptionGroupVariable.h b/include/lldb/Interpreter/OptionGroupVariable.h index 40f4d436bc698..fd338f1ba8cba 100644 --- a/include/lldb/Interpreter/OptionGroupVariable.h +++ b/include/lldb/Interpreter/OptionGroupVariable.h @@ -26,25 +26,23 @@ namespace lldb_private { class OptionGroupVariable : public OptionGroup { public: - OptionGroupVariable (bool show_frame_options); - virtual - ~OptionGroupVariable (); - - virtual uint32_t - GetNumDefinitions (); + ~OptionGroupVariable() override; + + uint32_t + GetNumDefinitions() override; - virtual const OptionDefinition* - GetDefinitions (); + const OptionDefinition* + GetDefinitions() override; - virtual Error - SetOptionValue (CommandInterpreter &interpreter, - uint32_t option_idx, - const char *option_arg); + Error + SetOptionValue(CommandInterpreter &interpreter, + uint32_t option_idx, + const char *option_arg) override; - virtual void - OptionParsingStarting (CommandInterpreter &interpreter); + void + OptionParsingStarting(CommandInterpreter &interpreter) override; bool include_frame_options:1, show_args:1, // Frame option only (include_frame_options == true) @@ -62,4 +60,4 @@ namespace lldb_private { } // namespace lldb_private -#endif // liblldb_OptionGroupVariable_h_ +#endif // liblldb_OptionGroupVariable_h_ diff --git a/include/lldb/Interpreter/OptionGroupWatchpoint.h b/include/lldb/Interpreter/OptionGroupWatchpoint.h index 1298da80750e8..ddc4393bdc255 100644 --- a/include/lldb/Interpreter/OptionGroupWatchpoint.h +++ b/include/lldb/Interpreter/OptionGroupWatchpoint.h @@ -25,28 +25,26 @@ namespace lldb_private { class OptionGroupWatchpoint : public OptionGroup { public: - + OptionGroupWatchpoint (); + + ~OptionGroupWatchpoint() override; + static bool IsWatchSizeSupported(uint32_t watch_size); - OptionGroupWatchpoint (); - - virtual - ~OptionGroupWatchpoint (); - - virtual uint32_t - GetNumDefinitions (); + uint32_t + GetNumDefinitions() override; - virtual const OptionDefinition* - GetDefinitions (); + const OptionDefinition* + GetDefinitions() override; - virtual Error - SetOptionValue (CommandInterpreter &interpreter, - uint32_t option_idx, - const char *option_arg); + Error + SetOptionValue(CommandInterpreter &interpreter, + uint32_t option_idx, + const char *option_arg) override; - virtual void - OptionParsingStarting (CommandInterpreter &interpreter); + void + OptionParsingStarting(CommandInterpreter &interpreter) override; // Note: // eWatchRead == LLDB_WATCH_TYPE_READ; and @@ -68,4 +66,4 @@ namespace lldb_private { } // namespace lldb_private -#endif // liblldb_OptionGroupWatchpoint_h_ +#endif // liblldb_OptionGroupWatchpoint_h_ diff --git a/include/lldb/Interpreter/OptionValue.h b/include/lldb/Interpreter/OptionValue.h index fd751f744de63..a05a0fb0b64f3 100644 --- a/include/lldb/Interpreter/OptionValue.h +++ b/include/lldb/Interpreter/OptionValue.h @@ -1,4 +1,4 @@ -//===-- OptionValue.h --------------------------------------*- C++ -*-===// +//===-- OptionValue.h -------------------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // @@ -61,7 +61,6 @@ namespace lldb_private { eDumpGroupHelp = (eDumpOptionName | eDumpOptionType | eDumpOptionDescription) }; - OptionValue () : m_callback (nullptr), m_baton(nullptr), @@ -76,9 +75,8 @@ namespace lldb_private { { } - virtual ~OptionValue () - { - } + virtual ~OptionValue() = default; + //----------------------------------------------------------------- // Subclasses should override these functions //----------------------------------------------------------------- @@ -99,7 +97,6 @@ namespace lldb_private { return GetBuiltinTypeAsCString(GetType()); } - static const char * GetBuiltinTypeAsCString (Type t); @@ -156,6 +153,7 @@ namespace lldb_private { virtual bool DumpQualifiedName (Stream &strm) const; + //----------------------------------------------------------------- // Subclasses should NOT override these functions as they use the // above functions to implement functionality @@ -376,7 +374,7 @@ namespace lldb_private { SetSInt64Value (int64_t new_value); const char * - GetStringValue (const char *fail_value = NULL) const; + GetStringValue(const char *fail_value = nullptr) const; bool SetStringValue (const char *new_value); @@ -415,7 +413,7 @@ namespace lldb_private { SetValueChangedCallback (OptionValueChangedCallback callback, void *baton) { - assert (m_callback == NULL); + assert (m_callback == nullptr); m_callback = callback; m_baton = baton; } @@ -426,6 +424,7 @@ namespace lldb_private { if (m_callback) m_callback (m_baton, this); } + protected: lldb::OptionValueWP m_parent_wp; OptionValueChangedCallback m_callback; @@ -436,9 +435,8 @@ namespace lldb_private { // the command line or as a setting, versus if we // just have the default value that was already // populated in the option value. - }; } // namespace lldb_private -#endif // liblldb_OptionValue_h_ +#endif // liblldb_OptionValue_h_ diff --git a/include/lldb/Interpreter/OptionValueArch.h b/include/lldb/Interpreter/OptionValueArch.h index 3d5d72619efca..c83dc85580842 100644 --- a/include/lldb/Interpreter/OptionValueArch.h +++ b/include/lldb/Interpreter/OptionValueArch.h @@ -52,8 +52,7 @@ public: { } - virtual - ~OptionValueArch() + ~OptionValueArch() override { } @@ -61,37 +60,37 @@ public: // Virtual subclass pure virtual overrides //--------------------------------------------------------------------- - virtual OptionValue::Type - GetType () const + OptionValue::Type + GetType() const override { return eTypeArch; } - virtual void - DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask); + void + DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override; - virtual Error - SetValueFromString (llvm::StringRef value, - VarSetOperationType op = eVarSetOperationAssign); + Error + SetValueFromString(llvm::StringRef value, + VarSetOperationType op = eVarSetOperationAssign) override; - virtual bool - Clear () + bool + Clear() override { m_current_value = m_default_value; m_value_was_set = false; return true; } - virtual lldb::OptionValueSP - DeepCopy () const; + lldb::OptionValueSP + DeepCopy() const override; - virtual size_t - AutoComplete (CommandInterpreter &interpreter, - const char *s, - int match_start_point, - int max_return_elements, - bool &word_complete, - StringList &matches); + size_t + AutoComplete(CommandInterpreter &interpreter, + const char *s, + int match_start_point, + int max_return_elements, + bool &word_complete, + StringList &matches) override; //--------------------------------------------------------------------- // Subclass specific functions @@ -136,4 +135,4 @@ protected: } // namespace lldb_private -#endif // liblldb_OptionValueArch_h_ +#endif // liblldb_OptionValueArch_h_ diff --git a/include/lldb/Interpreter/OptionValueArgs.h b/include/lldb/Interpreter/OptionValueArgs.h index 365a52a8b39fe..ad9505af30153 100644 --- a/include/lldb/Interpreter/OptionValueArgs.h +++ b/include/lldb/Interpreter/OptionValueArgs.h @@ -26,16 +26,15 @@ public: { } - virtual - ~OptionValueArgs() + ~OptionValueArgs() override { } size_t GetArgs (Args &args); - virtual Type - GetType() const + Type + GetType() const override { return eTypeArgs; } @@ -43,4 +42,4 @@ public: } // namespace lldb_private -#endif // liblldb_OptionValueArgs_h_ +#endif // liblldb_OptionValueArgs_h_ diff --git a/include/lldb/Interpreter/OptionValueArray.h b/include/lldb/Interpreter/OptionValueArray.h index 2e44f9f074383..38b9e3c3ee97f 100644 --- a/include/lldb/Interpreter/OptionValueArray.h +++ b/include/lldb/Interpreter/OptionValueArray.h @@ -30,8 +30,7 @@ public: { } - virtual - ~OptionValueArray() + ~OptionValueArray() override { } @@ -39,41 +38,41 @@ public: // Virtual subclass pure virtual overrides //--------------------------------------------------------------------- - virtual OptionValue::Type - GetType () const + OptionValue::Type + GetType() const override { return eTypeArray; } - virtual void - DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask); + void + DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override; - virtual Error - SetValueFromString (llvm::StringRef value, - VarSetOperationType op = eVarSetOperationAssign); + Error + SetValueFromString(llvm::StringRef value, + VarSetOperationType op = eVarSetOperationAssign) override; - virtual bool - Clear () + bool + Clear() override { m_values.clear(); m_value_was_set = false; return true; } - virtual lldb::OptionValueSP - DeepCopy () const; + lldb::OptionValueSP + DeepCopy() const override; - virtual bool - IsAggregateValue () const + bool + IsAggregateValue() const override { return true; } - virtual lldb::OptionValueSP - GetSubValue (const ExecutionContext *exe_ctx, - const char *name, - bool will_modify, - Error &error) const; + lldb::OptionValueSP + GetSubValue(const ExecutionContext *exe_ctx, + const char *name, + bool will_modify, + Error &error) const override; //--------------------------------------------------------------------- // Subclass specific functions @@ -175,4 +174,4 @@ protected: } // namespace lldb_private -#endif // liblldb_OptionValueArray_h_ +#endif // liblldb_OptionValueArray_h_ diff --git a/include/lldb/Interpreter/OptionValueBoolean.h b/include/lldb/Interpreter/OptionValueBoolean.h index 214fd1649d39a..52d39a9b8d27d 100644 --- a/include/lldb/Interpreter/OptionValueBoolean.h +++ b/include/lldb/Interpreter/OptionValueBoolean.h @@ -35,8 +35,7 @@ public: { } - virtual - ~OptionValueBoolean() + ~OptionValueBoolean() override { } @@ -44,34 +43,34 @@ public: // Virtual subclass pure virtual overrides //--------------------------------------------------------------------- - virtual OptionValue::Type - GetType () const + OptionValue::Type + GetType() const override { return eTypeBoolean; } - virtual void - DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask); + void + DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override; - virtual Error - SetValueFromString (llvm::StringRef value, - VarSetOperationType op = eVarSetOperationAssign); + Error + SetValueFromString(llvm::StringRef value, + VarSetOperationType op = eVarSetOperationAssign) override; - virtual bool - Clear () + bool + Clear() override { m_current_value = m_default_value; m_value_was_set = false; return true; } - virtual size_t - AutoComplete (CommandInterpreter &interpreter, - const char *s, - int match_start_point, - int max_return_elements, - bool &word_complete, - StringList &matches); + size_t + AutoComplete(CommandInterpreter &interpreter, + const char *s, + int match_start_point, + int max_return_elements, + bool &word_complete, + StringList &matches) override; //--------------------------------------------------------------------- // Subclass specific functions @@ -128,8 +127,8 @@ public: m_default_value = value; } - virtual lldb::OptionValueSP - DeepCopy () const; + lldb::OptionValueSP + DeepCopy() const override; protected: bool m_current_value; @@ -138,4 +137,4 @@ protected: } // namespace lldb_private -#endif // liblldb_OptionValueBoolean_h_ +#endif // liblldb_OptionValueBoolean_h_ diff --git a/include/lldb/Interpreter/OptionValueChar.h b/include/lldb/Interpreter/OptionValueChar.h index 8fc02093e3d99..b05d9ca098b25 100644 --- a/include/lldb/Interpreter/OptionValueChar.h +++ b/include/lldb/Interpreter/OptionValueChar.h @@ -27,6 +27,7 @@ public: m_default_value (value) { } + OptionValueChar (char current_value, char default_value) : OptionValue(), @@ -35,8 +36,7 @@ public: { } - virtual - ~OptionValueChar() + ~OptionValueChar() override { } @@ -44,21 +44,21 @@ public: // Virtual subclass pure virtual overrides //--------------------------------------------------------------------- - virtual OptionValue::Type - GetType () const + OptionValue::Type + GetType() const override { return eTypeChar; } - virtual void - DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask); + void + DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override; - virtual Error - SetValueFromString (llvm::StringRef value, - VarSetOperationType op = eVarSetOperationAssign); + Error + SetValueFromString(llvm::StringRef value, + VarSetOperationType op = eVarSetOperationAssign) override; - virtual bool - Clear () + bool + Clear() override { m_current_value = m_default_value; m_value_was_set = false; @@ -100,8 +100,8 @@ public: m_default_value = value; } - virtual lldb::OptionValueSP - DeepCopy () const; + lldb::OptionValueSP + DeepCopy() const override; protected: char m_current_value; @@ -110,4 +110,4 @@ protected: } // namespace lldb_private -#endif // liblldb_OptionValueChar_h_ +#endif // liblldb_OptionValueChar_h_ diff --git a/include/lldb/Interpreter/OptionValueDictionary.h b/include/lldb/Interpreter/OptionValueDictionary.h index efa15dd6ef880..8ee8397756466 100644 --- a/include/lldb/Interpreter/OptionValueDictionary.h +++ b/include/lldb/Interpreter/OptionValueDictionary.h @@ -31,8 +31,7 @@ public: { } - virtual - ~OptionValueDictionary() + ~OptionValueDictionary() override { } @@ -40,32 +39,32 @@ public: // Virtual subclass pure virtual overrides //--------------------------------------------------------------------- - virtual OptionValue::Type - GetType () const + OptionValue::Type + GetType() const override { return eTypeDictionary; } - virtual void - DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask); + void + DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override; - virtual Error - SetValueFromString (llvm::StringRef value, - VarSetOperationType op = eVarSetOperationAssign); + Error + SetValueFromString(llvm::StringRef value, + VarSetOperationType op = eVarSetOperationAssign) override; - virtual bool - Clear () + bool + Clear() override { m_values.clear(); m_value_was_set = false; return true; } - virtual lldb::OptionValueSP - DeepCopy () const; + lldb::OptionValueSP + DeepCopy() const override; - virtual bool - IsAggregateValue () const + bool + IsAggregateValue() const override { return true; } @@ -89,17 +88,17 @@ public: lldb::OptionValueSP GetValueForKey (const ConstString &key) const; - virtual lldb::OptionValueSP - GetSubValue (const ExecutionContext *exe_ctx, - const char *name, - bool will_modify, - Error &error) const; - - virtual Error - SetSubValue (const ExecutionContext *exe_ctx, - VarSetOperationType op, - const char *name, - const char *value); + lldb::OptionValueSP + GetSubValue(const ExecutionContext *exe_ctx, + const char *name, + bool will_modify, + Error &error) const override; + + Error + SetSubValue(const ExecutionContext *exe_ctx, + VarSetOperationType op, + const char *name, + const char *value) override; //--------------------------------------------------------------------- // String value getters and setters @@ -136,4 +135,4 @@ protected: } // namespace lldb_private -#endif // liblldb_OptionValueDictionary_h_ +#endif // liblldb_OptionValueDictionary_h_ diff --git a/include/lldb/Interpreter/OptionValueEnumeration.h b/include/lldb/Interpreter/OptionValueEnumeration.h index e820729385de3..b3fc481dd7fae 100644 --- a/include/lldb/Interpreter/OptionValueEnumeration.h +++ b/include/lldb/Interpreter/OptionValueEnumeration.h @@ -23,7 +23,6 @@ namespace lldb_private { - class OptionValueEnumeration : public OptionValue { public: @@ -38,44 +37,43 @@ public: OptionValueEnumeration (const OptionEnumValueElement *enumerators, enum_type value); - virtual - ~OptionValueEnumeration(); + ~OptionValueEnumeration() override; //--------------------------------------------------------------------- // Virtual subclass pure virtual overrides //--------------------------------------------------------------------- - virtual OptionValue::Type - GetType () const + OptionValue::Type + GetType() const override { return eTypeEnum; } - virtual void - DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask); + void + DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override; - virtual Error - SetValueFromString (llvm::StringRef value, - VarSetOperationType op = eVarSetOperationAssign); + Error + SetValueFromString(llvm::StringRef value, + VarSetOperationType op = eVarSetOperationAssign) override; - virtual bool - Clear () + bool + Clear() override { m_current_value = m_default_value; m_value_was_set = false; return true; } - virtual lldb::OptionValueSP - DeepCopy () const; + lldb::OptionValueSP + DeepCopy() const override; - virtual size_t - AutoComplete (CommandInterpreter &interpreter, - const char *s, - int match_start_point, - int max_return_elements, - bool &word_complete, - StringList &matches); + size_t + AutoComplete(CommandInterpreter &interpreter, + const char *s, + int match_start_point, + int max_return_elements, + bool &word_complete, + StringList &matches) override; //--------------------------------------------------------------------- // Subclass specific functions @@ -123,4 +121,4 @@ protected: } // namespace lldb_private -#endif // liblldb_OptionValueEnumeration_h_ +#endif // liblldb_OptionValueEnumeration_h_ diff --git a/include/lldb/Interpreter/OptionValueFileSpec.h b/include/lldb/Interpreter/OptionValueFileSpec.h index 80dd77ecef2a6..274c4d064e511 100644 --- a/include/lldb/Interpreter/OptionValueFileSpec.h +++ b/include/lldb/Interpreter/OptionValueFileSpec.h @@ -31,8 +31,7 @@ public: const FileSpec &default_value, bool resolve = true); - virtual - ~OptionValueFileSpec() + ~OptionValueFileSpec() override { } @@ -40,21 +39,21 @@ public: // Virtual subclass pure virtual overrides //--------------------------------------------------------------------- - virtual OptionValue::Type - GetType () const + OptionValue::Type + GetType() const override { return eTypeFileSpec; } - virtual void - DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask); + void + DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override; - virtual Error - SetValueFromString (llvm::StringRef value, - VarSetOperationType op = eVarSetOperationAssign); + Error + SetValueFromString(llvm::StringRef value, + VarSetOperationType op = eVarSetOperationAssign) override; - virtual bool - Clear () + bool + Clear() override { m_current_value = m_default_value; m_value_was_set = false; @@ -63,16 +62,16 @@ public: return true; } - virtual lldb::OptionValueSP - DeepCopy () const; + lldb::OptionValueSP + DeepCopy() const override; - virtual size_t - AutoComplete (CommandInterpreter &interpreter, - const char *s, - int match_start_point, - int max_return_elements, - bool &word_complete, - StringList &matches); + size_t + AutoComplete(CommandInterpreter &interpreter, + const char *s, + int match_start_point, + int max_return_elements, + bool &word_complete, + StringList &matches) override; //--------------------------------------------------------------------- // Subclass specific functions @@ -131,4 +130,4 @@ protected: } // namespace lldb_private -#endif // liblldb_OptionValueFileSpec_h_ +#endif // liblldb_OptionValueFileSpec_h_ diff --git a/include/lldb/Interpreter/OptionValueFileSpecList.h b/include/lldb/Interpreter/OptionValueFileSpecList.h index a105d22e45f9a..2051323580240 100644 --- a/include/lldb/Interpreter/OptionValueFileSpecList.h +++ b/include/lldb/Interpreter/OptionValueFileSpecList.h @@ -34,9 +34,7 @@ public: { } - - virtual - ~OptionValueFileSpecList() + ~OptionValueFileSpecList() override { } @@ -44,32 +42,32 @@ public: // Virtual subclass pure virtual overrides //--------------------------------------------------------------------- - virtual OptionValue::Type - GetType () const + OptionValue::Type + GetType() const override { return eTypeFileSpecList; } - virtual void - DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask); + void + DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override; - virtual Error - SetValueFromString (llvm::StringRef value, - VarSetOperationType op = eVarSetOperationAssign); + Error + SetValueFromString(llvm::StringRef value, + VarSetOperationType op = eVarSetOperationAssign) override; - virtual bool - Clear () + bool + Clear() override { m_current_value.Clear(); m_value_was_set = false; return true; } - virtual lldb::OptionValueSP - DeepCopy () const; + lldb::OptionValueSP + DeepCopy() const override; - virtual bool - IsAggregateValue () const + bool + IsAggregateValue() const override { return true; } @@ -102,4 +100,4 @@ protected: } // namespace lldb_private -#endif // liblldb_OptionValueFileSpecList_h_ +#endif // liblldb_OptionValueFileSpecList_h_ diff --git a/include/lldb/Interpreter/OptionValueFormat.h b/include/lldb/Interpreter/OptionValueFormat.h index 06ed128543182..1c29094599110 100644 --- a/include/lldb/Interpreter/OptionValueFormat.h +++ b/include/lldb/Interpreter/OptionValueFormat.h @@ -36,8 +36,7 @@ public: { } - virtual - ~OptionValueFormat() + ~OptionValueFormat() override { } @@ -45,29 +44,29 @@ public: // Virtual subclass pure virtual overrides //--------------------------------------------------------------------- - virtual OptionValue::Type - GetType () const + OptionValue::Type + GetType() const override { return eTypeFormat; } - virtual void - DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask); + void + DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override; - virtual Error - SetValueFromString (llvm::StringRef value, - VarSetOperationType op = eVarSetOperationAssign); + Error + SetValueFromString(llvm::StringRef value, + VarSetOperationType op = eVarSetOperationAssign) override; - virtual bool - Clear () + bool + Clear() override { m_current_value = m_default_value; m_value_was_set = false; return true; } - virtual lldb::OptionValueSP - DeepCopy () const; + lldb::OptionValueSP + DeepCopy() const override; //--------------------------------------------------------------------- // Subclass specific functions @@ -104,4 +103,4 @@ protected: } // namespace lldb_private -#endif // liblldb_OptionValueFormat_h_ +#endif // liblldb_OptionValueFormat_h_ diff --git a/include/lldb/Interpreter/OptionValueFormatEntity.h b/include/lldb/Interpreter/OptionValueFormatEntity.h index 18ace3a6a1b69..10a456a1b9948 100644 --- a/include/lldb/Interpreter/OptionValueFormatEntity.h +++ b/include/lldb/Interpreter/OptionValueFormatEntity.h @@ -24,8 +24,7 @@ class OptionValueFormatEntity : public OptionValue public: OptionValueFormatEntity (const char *default_format); - virtual - ~OptionValueFormatEntity() + ~OptionValueFormatEntity() override { } @@ -94,7 +93,6 @@ public: return m_default_entry; } - protected: std::string m_current_format; std::string m_default_format; @@ -104,4 +102,4 @@ protected: } // namespace lldb_private -#endif // liblldb_OptionValueFormatEntity_h_ +#endif // liblldb_OptionValueFormatEntity_h_ diff --git a/include/lldb/Interpreter/OptionValueLanguage.h b/include/lldb/Interpreter/OptionValueLanguage.h index fba5e22821e0d..bd6df3ea4943f 100644 --- a/include/lldb/Interpreter/OptionValueLanguage.h +++ b/include/lldb/Interpreter/OptionValueLanguage.h @@ -37,8 +37,7 @@ public: { } - virtual - ~OptionValueLanguage () + ~OptionValueLanguage() override { } @@ -104,4 +103,4 @@ protected: } // namespace lldb_private -#endif // liblldb_OptionValueLanguage_h_ +#endif // liblldb_OptionValueLanguage_h_ diff --git a/include/lldb/Interpreter/OptionValuePathMappings.h b/include/lldb/Interpreter/OptionValuePathMappings.h index 7b476a9cd366a..4ed1c8c848d6d 100644 --- a/include/lldb/Interpreter/OptionValuePathMappings.h +++ b/include/lldb/Interpreter/OptionValuePathMappings.h @@ -29,8 +29,7 @@ public: { } - virtual - ~OptionValuePathMappings() + ~OptionValuePathMappings() override { } @@ -38,32 +37,32 @@ public: // Virtual subclass pure virtual overrides //--------------------------------------------------------------------- - virtual OptionValue::Type - GetType () const + OptionValue::Type + GetType() const override { return eTypePathMap; } - virtual void - DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask); + void + DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override; - virtual Error - SetValueFromString (llvm::StringRef value, - VarSetOperationType op = eVarSetOperationAssign); + Error + SetValueFromString(llvm::StringRef value, + VarSetOperationType op = eVarSetOperationAssign) override; - virtual bool - Clear () + bool + Clear() override { m_path_mappings.Clear(m_notify_changes); m_value_was_set = false; return true; } - virtual lldb::OptionValueSP - DeepCopy () const; + lldb::OptionValueSP + DeepCopy() const override; - virtual bool - IsAggregateValue () const + bool + IsAggregateValue() const override { return true; } @@ -91,4 +90,4 @@ protected: } // namespace lldb_private -#endif // liblldb_OptionValuePathMappings_h_ +#endif // liblldb_OptionValuePathMappings_h_ diff --git a/include/lldb/Interpreter/OptionValueProperties.h b/include/lldb/Interpreter/OptionValueProperties.h index 405beefff6d15..c8783bcf36eb0 100644 --- a/include/lldb/Interpreter/OptionValueProperties.h +++ b/include/lldb/Interpreter/OptionValueProperties.h @@ -1,4 +1,4 @@ -//===-- OptionValueProperties.h --------------------------------------*- C++ -*-===// +//===-- OptionValueProperties.h ---------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // @@ -12,6 +12,8 @@ // C Includes // C++ Includes +#include <vector> + // Other libraries and framework includes // Project includes #include "lldb/Core/ConstString.h" @@ -27,10 +29,6 @@ class OptionValueProperties : public std::enable_shared_from_this<OptionValueProperties> { public: - - //--------------------------------------------------------------------- - // OptionValueProperties - //--------------------------------------------------------------------- OptionValueProperties () : OptionValue(), m_name (), @@ -42,34 +40,32 @@ public: OptionValueProperties (const ConstString &name); OptionValueProperties (const OptionValueProperties &global_properties); - - virtual - ~OptionValueProperties() - { - } - - virtual Type - GetType () const + + ~OptionValueProperties() override = default; + + Type + GetType() const override { return eTypeProperties; } - virtual bool - Clear (); + bool + Clear() override; - virtual lldb::OptionValueSP - DeepCopy () const; + lldb::OptionValueSP + DeepCopy() const override; - virtual Error - SetValueFromString (llvm::StringRef value, VarSetOperationType op = eVarSetOperationAssign); + Error + SetValueFromString(llvm::StringRef value, + VarSetOperationType op = eVarSetOperationAssign) override; - virtual void - DumpValue (const ExecutionContext *exe_ctx, - Stream &strm, - uint32_t dump_mask); + void + DumpValue(const ExecutionContext *exe_ctx, + Stream &strm, + uint32_t dump_mask) override; - virtual ConstString - GetName () const + ConstString + GetName() const override { return m_name; } @@ -149,16 +145,16 @@ public: bool value_will_be_modified) const; lldb::OptionValueSP - GetSubValue (const ExecutionContext *exe_ctx, - const char *name, - bool value_will_be_modified, - Error &error) const; + GetSubValue(const ExecutionContext *exe_ctx, + const char *name, + bool value_will_be_modified, + Error &error) const override; - virtual Error - SetSubValue (const ExecutionContext *exe_ctx, - VarSetOperationType op, - const char *path, - const char *value); + Error + SetSubValue(const ExecutionContext *exe_ctx, + VarSetOperationType op, + const char *path, + const char *value) override; virtual bool PredicateMatches (const ExecutionContext *exe_ctx, @@ -171,6 +167,9 @@ public: OptionValueArch * GetPropertyAtIndexAsOptionValueArch (const ExecutionContext *exe_ctx, uint32_t idx) const; + OptionValueLanguage * + GetPropertyAtIndexAsOptionValueLanguage (const ExecutionContext *exe_ctx, uint32_t idx) const; + bool GetPropertyAtIndexAsArgs (const ExecutionContext *exe_ctx, uint32_t idx, Args &args) const; @@ -251,22 +250,18 @@ public: SetValueChangedCallback (uint32_t property_idx, OptionValueChangedCallback callback, void *baton); -protected: +protected: Property * - ProtectedGetPropertyAtIndex (uint32_t idx) + ProtectedGetPropertyAtIndex(uint32_t idx) { - if (idx < m_properties.size()) - return &m_properties[idx]; - return NULL; + return ((idx < m_properties.size()) ? &m_properties[idx] : nullptr); } const Property * - ProtectedGetPropertyAtIndex (uint32_t idx) const + ProtectedGetPropertyAtIndex(uint32_t idx) const { - if (idx < m_properties.size()) - return &m_properties[idx]; - return NULL; + return ((idx < m_properties.size()) ? &m_properties[idx] : nullptr); } typedef UniqueCStringMap<size_t> NameToIndex; @@ -278,4 +273,4 @@ protected: } // namespace lldb_private -#endif // liblldb_OptionValueProperties_h_ +#endif // liblldb_OptionValueProperties_h_ diff --git a/include/lldb/Interpreter/OptionValueRegex.h b/include/lldb/Interpreter/OptionValueRegex.h index 5e04218dbfdfc..a094a402b1a96 100644 --- a/include/lldb/Interpreter/OptionValueRegex.h +++ b/include/lldb/Interpreter/OptionValueRegex.h @@ -12,8 +12,6 @@ // C Includes // C++ Includes -#include <string> - // Other libraries and framework includes // Project includes #include "lldb/Core/RegularExpression.h" @@ -24,44 +22,41 @@ namespace lldb_private { class OptionValueRegex : public OptionValue { public: - OptionValueRegex (const char *value = NULL) : + OptionValueRegex(const char *value = nullptr) : OptionValue(), m_regex (value) { } - virtual - ~OptionValueRegex() - { - } - + ~OptionValueRegex() override = default; + //--------------------------------------------------------------------- // Virtual subclass pure virtual overrides //--------------------------------------------------------------------- - virtual OptionValue::Type - GetType () const + OptionValue::Type + GetType() const override { return eTypeRegex; } - virtual void - DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask); + void + DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override; - virtual Error - SetValueFromString (llvm::StringRef value, - VarSetOperationType op = eVarSetOperationAssign); + Error + SetValueFromString(llvm::StringRef value, + VarSetOperationType op = eVarSetOperationAssign) override; - virtual bool - Clear () + bool + Clear() override { m_regex.Clear(); m_value_was_set = false; return true; } - virtual lldb::OptionValueSP - DeepCopy () const; + lldb::OptionValueSP + DeepCopy() const override; //--------------------------------------------------------------------- // Subclass specific functions @@ -69,9 +64,7 @@ public: const RegularExpression * GetCurrentValue() const { - if (m_regex.IsValid()) - return &m_regex; - return NULL; + return (m_regex.IsValid() ? &m_regex : nullptr); } void @@ -95,4 +88,4 @@ protected: } // namespace lldb_private -#endif // liblldb_OptionValueRegex_h_ +#endif // liblldb_OptionValueRegex_h_ diff --git a/include/lldb/Interpreter/OptionValueSInt64.h b/include/lldb/Interpreter/OptionValueSInt64.h index 36ae97ccfcf87..8c8b201b6e82b 100644 --- a/include/lldb/Interpreter/OptionValueSInt64.h +++ b/include/lldb/Interpreter/OptionValueSInt64.h @@ -58,8 +58,7 @@ public: { } - virtual - ~OptionValueSInt64() + ~OptionValueSInt64() override { } @@ -67,29 +66,29 @@ public: // Virtual subclass pure virtual overrides //--------------------------------------------------------------------- - virtual OptionValue::Type - GetType () const + OptionValue::Type + GetType() const override { return eTypeSInt64; } - virtual void - DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask); + void + DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override; - virtual Error - SetValueFromString (llvm::StringRef value, - VarSetOperationType op = eVarSetOperationAssign); + Error + SetValueFromString(llvm::StringRef value, + VarSetOperationType op = eVarSetOperationAssign) override; - virtual bool - Clear () + bool + Clear() override { m_current_value = m_default_value; m_value_was_set = false; return true; } - virtual lldb::OptionValueSP - DeepCopy () const; + lldb::OptionValueSP + DeepCopy() const override; //--------------------------------------------------------------------- // Subclass specific functions @@ -169,4 +168,4 @@ protected: } // namespace lldb_private -#endif // liblldb_OptionValueSInt64_h_ +#endif // liblldb_OptionValueSInt64_h_ diff --git a/include/lldb/Interpreter/OptionValueString.h b/include/lldb/Interpreter/OptionValueString.h index c75745d402bef..bbdd0c8ba55c2 100644 --- a/include/lldb/Interpreter/OptionValueString.h +++ b/include/lldb/Interpreter/OptionValueString.h @@ -1,4 +1,4 @@ -//===-- OptionValueString.h --------------------------------------*- C++ -*-===// +//===-- OptionValueString.h -------------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // @@ -24,7 +24,6 @@ namespace lldb_private { class OptionValueString : public OptionValue { public: - typedef Error (*ValidatorCallback) (const char* string, void* baton); @@ -43,8 +42,8 @@ public: { } - OptionValueString (ValidatorCallback validator, - void* baton = NULL) : + OptionValueString(ValidatorCallback validator, + void* baton = nullptr) : OptionValue(), m_current_value (), m_default_value (), @@ -84,9 +83,9 @@ public: m_default_value.assign (default_value); } - OptionValueString (const char *value, - ValidatorCallback validator, - void* baton = NULL) : + OptionValueString(const char *value, + ValidatorCallback validator, + void* baton = nullptr) : OptionValue(), m_current_value (), m_default_value (), @@ -101,10 +100,10 @@ public: } } - OptionValueString (const char *current_value, - const char *default_value, - ValidatorCallback validator, - void* baton = NULL) : + OptionValueString(const char *current_value, + const char *default_value, + ValidatorCallback validator, + void* baton = nullptr) : OptionValue(), m_current_value (), m_default_value (), @@ -118,38 +117,35 @@ public: m_default_value.assign (default_value); } - virtual - ~OptionValueString() - { - } - + ~OptionValueString() override = default; + //--------------------------------------------------------------------- // Virtual subclass pure virtual overrides //--------------------------------------------------------------------- - virtual OptionValue::Type - GetType () const + OptionValue::Type + GetType() const override { return eTypeString; } - virtual void - DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask); + void + DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override; - virtual Error - SetValueFromString (llvm::StringRef value, - VarSetOperationType op = eVarSetOperationAssign); + Error + SetValueFromString(llvm::StringRef value, + VarSetOperationType op = eVarSetOperationAssign) override; - virtual bool - Clear () + bool + Clear() override { m_current_value = m_default_value; m_value_was_set = false; return true; } - virtual lldb::OptionValueSP - DeepCopy () const; + lldb::OptionValueSP + DeepCopy() const override; //--------------------------------------------------------------------- // Subclass specific functions @@ -213,7 +209,6 @@ public: return m_default_value.empty(); } - protected: std::string m_current_value; std::string m_default_value; @@ -224,4 +219,4 @@ protected: } // namespace lldb_private -#endif // liblldb_OptionValueString_h_ +#endif // liblldb_OptionValueString_h_ diff --git a/include/lldb/Interpreter/OptionValueUInt64.h b/include/lldb/Interpreter/OptionValueUInt64.h index 51ff8818dcff4..874e8ca166658 100644 --- a/include/lldb/Interpreter/OptionValueUInt64.h +++ b/include/lldb/Interpreter/OptionValueUInt64.h @@ -43,8 +43,7 @@ public: { } - virtual - ~OptionValueUInt64() + ~OptionValueUInt64() override { } @@ -60,29 +59,29 @@ public: // Virtual subclass pure virtual overrides //--------------------------------------------------------------------- - virtual OptionValue::Type - GetType () const + OptionValue::Type + GetType() const override { return eTypeUInt64; } - virtual void - DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask); + void + DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override; - virtual Error - SetValueFromString (llvm::StringRef value, - VarSetOperationType op = eVarSetOperationAssign); + Error + SetValueFromString(llvm::StringRef value, + VarSetOperationType op = eVarSetOperationAssign) override; - virtual bool - Clear () + bool + Clear() override { m_current_value = m_default_value; m_value_was_set = false; return true; } - virtual lldb::OptionValueSP - DeepCopy () const; + lldb::OptionValueSP + DeepCopy() const override; //--------------------------------------------------------------------- // Subclass specific functions @@ -131,4 +130,4 @@ protected: } // namespace lldb_private -#endif // liblldb_OptionValueUInt64_h_ +#endif // liblldb_OptionValueUInt64_h_ diff --git a/include/lldb/Interpreter/OptionValueUUID.h b/include/lldb/Interpreter/OptionValueUUID.h index c6ab48a627f6b..4aecc39bc8c4c 100644 --- a/include/lldb/Interpreter/OptionValueUUID.h +++ b/include/lldb/Interpreter/OptionValueUUID.h @@ -34,8 +34,7 @@ public: { } - virtual - ~OptionValueUUID() + ~OptionValueUUID() override { } @@ -43,29 +42,29 @@ public: // Virtual subclass pure virtual overrides //--------------------------------------------------------------------- - virtual OptionValue::Type - GetType () const + OptionValue::Type + GetType() const override { return eTypeUUID; } - virtual void - DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask); + void + DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override; - virtual Error - SetValueFromString (llvm::StringRef value, - VarSetOperationType op = eVarSetOperationAssign); + Error + SetValueFromString(llvm::StringRef value, + VarSetOperationType op = eVarSetOperationAssign) override; - virtual bool - Clear () + bool + Clear() override { m_uuid.Clear(); m_value_was_set = false; return true; } - virtual lldb::OptionValueSP - DeepCopy () const; + lldb::OptionValueSP + DeepCopy() const override; //--------------------------------------------------------------------- // Subclass specific functions @@ -89,13 +88,13 @@ public: m_uuid = value; } - virtual size_t - AutoComplete (CommandInterpreter &interpreter, - const char *s, - int match_start_point, - int max_return_elements, - bool &word_complete, - StringList &matches); + size_t + AutoComplete(CommandInterpreter &interpreter, + const char *s, + int match_start_point, + int max_return_elements, + bool &word_complete, + StringList &matches) override; protected: UUID m_uuid; @@ -103,4 +102,4 @@ protected: } // namespace lldb_private -#endif // liblldb_OptionValueUUID_h_ +#endif // liblldb_OptionValueUUID_h_ diff --git a/include/lldb/Interpreter/Options.h b/include/lldb/Interpreter/Options.h index 6ecf08d28e750..bac26308a8d19 100644 --- a/include/lldb/Interpreter/Options.h +++ b/include/lldb/Interpreter/Options.h @@ -11,7 +11,6 @@ #define liblldb_Options_h_ // C Includes - // C++ Includes #include <set> #include <vector> @@ -32,7 +31,6 @@ namespace lldb_private { return isprint(ch); } - //---------------------------------------------------------------------- /// @class Options Options.h "lldb/Interpreter/Options.h" /// @brief A command line option parsing protocol class. @@ -72,7 +70,7 @@ namespace lldb_private { /// case 'g': debug = true; break; /// case 'v': verbose = true; break; /// case 'l': log_file = option_arg; break; -/// case 'f': log_flags = strtoull(option_arg, NULL, 0); break; +/// case 'f': log_flags = strtoull(option_arg, nullptr, 0); break; /// default: /// error.SetErrorStringWithFormat("unrecognized short option %c", option_val); /// break; @@ -95,11 +93,11 @@ namespace lldb_private { /// /// struct option CommandOptions::g_options[] = /// { -/// { "debug", no_argument, NULL, 'g' }, -/// { "log-file", required_argument, NULL, 'l' }, -/// { "log-flags", required_argument, NULL, 'f' }, -/// { "verbose", no_argument, NULL, 'v' }, -/// { NULL, 0, NULL, 0 } +/// { "debug", no_argument, nullptr, 'g' }, +/// { "log-file", required_argument, nullptr, 'l' }, +/// { "log-flags", required_argument, nullptr, 'f' }, +/// { "verbose", no_argument, nullptr, 'v' }, +/// { nullptr, 0, nullptr, 0 } /// }; /// /// int main (int argc, const char **argv, const char **envp) @@ -119,7 +117,6 @@ namespace lldb_private { class Options { public: - Options (CommandInterpreter &interpreter); virtual @@ -153,7 +150,6 @@ public: // Verify that the options given are in the options table and can // be used together, but there may be some required options that are // missing (used to verify options that get folded into command aliases). - bool VerifyPartialOptions (CommandReturnObject &result); @@ -173,7 +169,10 @@ public: // class that inherits from this class. virtual const OptionDefinition* - GetDefinitions () { return NULL; } + GetDefinitions() + { + return nullptr; + } // Call this prior to parsing any options. This call will call the // subclass OptionParsingStarting() and will avoid the need for all @@ -195,7 +194,7 @@ public: /// /// @param[in] option_arg /// The argument value for the option that the user entered, or - /// NULL if there is no argument for the current option. + /// nullptr if there is no argument for the current option. /// /// /// @see Args::ParseOptions (Options&) @@ -359,15 +358,11 @@ protected: class OptionGroup { public: - OptionGroup () - { - } - + OptionGroup() = default; + virtual - ~OptionGroup () - { - } - + ~OptionGroup() = default; + virtual uint32_t GetNumDefinitions () = 0; @@ -395,7 +390,6 @@ protected: class OptionGroupOptions : public Options { public: - OptionGroupOptions (CommandInterpreter &interpreter) : Options (interpreter), m_option_defs (), @@ -404,12 +398,8 @@ protected: { } - virtual - ~OptionGroupOptions () - { - } - - + ~OptionGroupOptions() override = default; + //---------------------------------------------------------------------- /// Append options from a OptionGroup class. /// @@ -459,18 +449,18 @@ protected: return m_did_finalize; } - virtual Error - SetOptionValue (uint32_t option_idx, - const char *option_arg); + Error + SetOptionValue(uint32_t option_idx, + const char *option_arg) override; - virtual void - OptionParsingStarting (); + void + OptionParsingStarting() override; - virtual Error - OptionParsingFinished (); + Error + OptionParsingFinished() override; const OptionDefinition* - GetDefinitions () + GetDefinitions() override { assert (m_did_finalize); return &m_option_defs[0]; @@ -495,8 +485,7 @@ protected: OptionInfos m_option_infos; bool m_did_finalize; }; - } // namespace lldb_private -#endif // liblldb_Options_h_ +#endif // liblldb_Options_h_ diff --git a/include/lldb/Interpreter/PythonDataObjects.h b/include/lldb/Interpreter/PythonDataObjects.h deleted file mode 100644 index df281b533cba8..0000000000000 --- a/include/lldb/Interpreter/PythonDataObjects.h +++ /dev/null @@ -1,280 +0,0 @@ -//===-- PythonDataObjects.h----------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#ifndef liblldb_PythonDataObjects_h_ -#define liblldb_PythonDataObjects_h_ - -// C Includes -// C++ Includes - -// Other libraries and framework includes -// Project includes -#include "lldb/lldb-defines.h" -#include "lldb/Core/ConstString.h" -#include "lldb/Core/StructuredData.h" -#include "lldb/Core/Flags.h" -#include "lldb/Interpreter/OptionValue.h" -#include "lldb/lldb-python.h" - -namespace lldb_private { -class PythonString; -class PythonList; -class PythonDictionary; -class PythonObject; -class PythonInteger; - -class StructuredPythonObject : public StructuredData::Generic -{ - public: - StructuredPythonObject() - : StructuredData::Generic() - { - } - - StructuredPythonObject(void *obj) - : StructuredData::Generic(obj) - { - Py_XINCREF(GetValue()); - } - - virtual ~StructuredPythonObject() - { - if (Py_IsInitialized()) - Py_XDECREF(GetValue()); - SetValue(nullptr); - } - - bool - IsValid() const override - { - return GetValue() && GetValue() != Py_None; - } - - void Dump(Stream &s) const override; - - private: - DISALLOW_COPY_AND_ASSIGN(StructuredPythonObject); -}; - -enum class PyObjectType -{ - Unknown, - None, - Integer, - Dictionary, - List, - String -}; - - class PythonObject - { - public: - PythonObject () : - m_py_obj(NULL) - { - } - - explicit PythonObject (PyObject* py_obj) : - m_py_obj(NULL) - { - Reset (py_obj); - } - - PythonObject (const PythonObject &rhs) : - m_py_obj(NULL) - { - Reset (rhs.m_py_obj); - } - - virtual - ~PythonObject () - { - Reset (NULL); - } - - bool - Reset (const PythonObject &object) - { - return Reset(object.get()); - } - - virtual bool - Reset (PyObject* py_obj = NULL) - { - if (py_obj != m_py_obj) - { - if (Py_IsInitialized()) - Py_XDECREF(m_py_obj); - m_py_obj = py_obj; - if (Py_IsInitialized()) - Py_XINCREF(m_py_obj); - } - return true; - } - - void - Dump () const - { - if (m_py_obj) - _PyObject_Dump (m_py_obj); - else - puts ("NULL"); - } - - void - Dump (Stream &strm) const; - - PyObject* - get () const - { - return m_py_obj; - } - - PyObjectType GetObjectType() const; - - PythonString - Repr (); - - PythonString - Str (); - - explicit operator bool () const - { - return m_py_obj != NULL; - } - - bool - IsNULLOrNone () const; - - StructuredData::ObjectSP CreateStructuredObject() const; - - protected: - PyObject* m_py_obj; - }; - - class PythonString: public PythonObject - { - public: - PythonString (); - PythonString (PyObject *o); - PythonString (const PythonObject &object); - PythonString (llvm::StringRef string); - PythonString (const char *string); - virtual ~PythonString (); - - virtual bool - Reset (PyObject* py_obj = NULL); - - llvm::StringRef - GetString() const; - - size_t - GetSize() const; - - void SetString(llvm::StringRef string); - - StructuredData::StringSP CreateStructuredString() const; - }; - - class PythonInteger: public PythonObject - { - public: - - PythonInteger (); - PythonInteger (PyObject* py_obj); - PythonInteger (const PythonObject &object); - PythonInteger (int64_t value); - virtual ~PythonInteger (); - - virtual bool - Reset (PyObject* py_obj = NULL); - - int64_t GetInteger() const; - - void - SetInteger (int64_t value); - - StructuredData::IntegerSP CreateStructuredInteger() const; - }; - - class PythonList: public PythonObject - { - public: - - PythonList (bool create_empty); - PythonList (PyObject* py_obj); - PythonList (const PythonObject &object); - PythonList (uint32_t count); - virtual ~PythonList (); - - virtual bool - Reset (PyObject* py_obj = NULL); - - uint32_t GetSize() const; - - PythonObject GetItemAtIndex(uint32_t index) const; - - void - SetItemAtIndex (uint32_t index, const PythonObject &object); - - void - AppendItem (const PythonObject &object); - - StructuredData::ArraySP CreateStructuredArray() const; - }; - - class PythonDictionary: public PythonObject - { - public: - - explicit PythonDictionary (bool create_empty); - PythonDictionary (PyObject* object); - PythonDictionary (const PythonObject &object); - virtual ~PythonDictionary (); - - virtual bool - Reset (PyObject* object = NULL); - - uint32_t GetSize() const; - - PythonObject - GetItemForKey (const PythonString &key) const; - - const char * - GetItemForKeyAsString (const PythonString &key, const char *fail_value = NULL) const; - - int64_t - GetItemForKeyAsInteger (const PythonString &key, int64_t fail_value = 0) const; - - PythonObject - GetItemForKey (const char *key) const; - - typedef bool (*DictionaryIteratorCallback)(PythonString* key, PythonDictionary* dict); - - PythonList - GetKeys () const; - - PythonString - GetKeyAtPosition (uint32_t pos) const; - - PythonObject - GetValueAtPosition (uint32_t pos) const; - - void - SetItemForKey (const PythonString &key, PyObject *value); - - void - SetItemForKey (const PythonString &key, const PythonObject& value); - - StructuredData::DictionarySP CreateStructuredDictionary() const; - }; - -} // namespace lldb_private - -#endif // liblldb_PythonDataObjects_h_ diff --git a/include/lldb/Interpreter/ScriptInterpreter.h b/include/lldb/Interpreter/ScriptInterpreter.h index 0f45dd8245e9f..eafc03a00cca4 100644 --- a/include/lldb/Interpreter/ScriptInterpreter.h +++ b/include/lldb/Interpreter/ScriptInterpreter.h @@ -10,37 +10,36 @@ #ifndef liblldb_ScriptInterpreter_h_ #define liblldb_ScriptInterpreter_h_ +// C Includes +// C++ Includes +// Other libraries and framework includes +// Project includes #include "lldb/lldb-private.h" #include "lldb/Core/Broadcaster.h" #include "lldb/Core/Error.h" +#include "lldb/Core/PluginInterface.h" #include "lldb/Core/StructuredData.h" #include "lldb/Utility/PseudoTerminal.h" - namespace lldb_private { class ScriptInterpreterLocker { public: - ScriptInterpreterLocker () - { - } + ScriptInterpreterLocker() = default; - virtual ~ScriptInterpreterLocker () - { - } + virtual ~ScriptInterpreterLocker() = default; + private: DISALLOW_COPY_AND_ASSIGN (ScriptInterpreterLocker); }; - -class ScriptInterpreter +class ScriptInterpreter : public PluginInterface { public: - typedef enum { eScriptReturnTypeCharPtr, @@ -62,7 +61,7 @@ public: ScriptInterpreter (CommandInterpreter &interpreter, lldb::ScriptLanguage script_lang); - virtual ~ScriptInterpreter (); + ~ScriptInterpreter() override; struct ExecuteScriptOptions { @@ -174,13 +173,13 @@ public: } virtual bool - GenerateTypeScriptFunction (const char* oneliner, std::string& output, const void* name_token = NULL) + GenerateTypeScriptFunction(const char* oneliner, std::string& output, const void* name_token = nullptr) { return false; } virtual bool - GenerateTypeScriptFunction (StringList &input, std::string& output, const void* name_token = NULL) + GenerateTypeScriptFunction(StringList &input, std::string& output, const void* name_token = nullptr) { return false; } @@ -192,13 +191,13 @@ public: } virtual bool - GenerateTypeSynthClass (StringList &input, std::string& output, const void* name_token = NULL) + GenerateTypeSynthClass(StringList &input, std::string& output, const void* name_token = nullptr) { return false; } virtual bool - GenerateTypeSynthClass (const char* oneliner, std::string& output, const void* name_token = NULL) + GenerateTypeSynthClass(const char* oneliner, std::string& output, const void* name_token = nullptr) { return false; } @@ -324,7 +323,6 @@ public: SetBreakpointCommandCallbackFunction (BreakpointOptions *bp_options, const char *function_name) { - return; } /// Set a one-liner as the callback for the watchpoint. @@ -332,7 +330,6 @@ public: SetWatchpointCommandCallback (WatchpointOptions *wp_options, const char *oneliner) { - return; } virtual bool @@ -349,7 +346,7 @@ public: } virtual size_t - CalculateNumChildren(const StructuredData::ObjectSP &implementor) + CalculateNumChildren(const StructuredData::ObjectSP &implementor, uint32_t max) { return 0; } @@ -459,7 +456,7 @@ public: virtual bool GetDocumentationForItem (const char* item, std::string& dest) { - dest.clear(); + dest.clear(); return false; } @@ -514,8 +511,8 @@ public: int GetMasterFileDescriptor (); - CommandInterpreter & - GetCommandInterpreter (); + CommandInterpreter & + GetCommandInterpreter(); static std::string LanguageToString (lldb::ScriptLanguage language); @@ -530,4 +527,4 @@ protected: } // namespace lldb_private -#endif // #ifndef liblldb_ScriptInterpreter_h_ +#endif // liblldb_ScriptInterpreter_h_ diff --git a/include/lldb/Interpreter/ScriptInterpreterNone.h b/include/lldb/Interpreter/ScriptInterpreterNone.h deleted file mode 100644 index 6c82b60b0bcda..0000000000000 --- a/include/lldb/Interpreter/ScriptInterpreterNone.h +++ /dev/null @@ -1,35 +0,0 @@ -//===-- ScriptInterpreterNone.h ---------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#ifndef liblldb_ScriptInterpreterNone_h_ -#define liblldb_ScriptInterpreterNone_h_ - -#include "lldb/Interpreter/ScriptInterpreter.h" - -namespace lldb_private { - -class ScriptInterpreterNone : public ScriptInterpreter -{ -public: - - ScriptInterpreterNone (CommandInterpreter &interpreter); - - ~ScriptInterpreterNone (); - - bool - ExecuteOneLine (const char *command, CommandReturnObject *result, const ExecuteScriptOptions &options = ExecuteScriptOptions()); - - void - ExecuteInterpreterLoop (); - -}; - -} // namespace lldb_private - -#endif // #ifndef liblldb_ScriptInterpreterNone_h_ diff --git a/include/lldb/Interpreter/ScriptInterpreterPython.h b/include/lldb/Interpreter/ScriptInterpreterPython.h deleted file mode 100644 index 058058ecccb52..0000000000000 --- a/include/lldb/Interpreter/ScriptInterpreterPython.h +++ /dev/null @@ -1,563 +0,0 @@ -//===-- ScriptInterpreterPython.h -------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - - -#ifndef liblldb_ScriptInterpreterPython_h_ -#define liblldb_ScriptInterpreterPython_h_ - -#ifdef LLDB_DISABLE_PYTHON - -// Python is disabled in this build - -#else - -#include "lldb/lldb-python.h" -#include "lldb/lldb-private.h" -#include "lldb/Core/IOHandler.h" -#include "lldb/Interpreter/ScriptInterpreter.h" -#include "lldb/Interpreter/PythonDataObjects.h" -#include "lldb/Host/Terminal.h" - -class IOHandlerPythonInterpreter; - -namespace lldb_private { - -class ScriptInterpreterPython : - public ScriptInterpreter, - public IOHandlerDelegateMultiline -{ -public: - typedef void (*SWIGInitCallback) (void); - - typedef bool (*SWIGBreakpointCallbackFunction) (const char *python_function_name, - const char *session_dictionary_name, - const lldb::StackFrameSP& frame_sp, - const lldb::BreakpointLocationSP &bp_loc_sp); - - typedef bool (*SWIGWatchpointCallbackFunction) (const char *python_function_name, - const char *session_dictionary_name, - const lldb::StackFrameSP& frame_sp, - const lldb::WatchpointSP &wp_sp); - - typedef bool (*SWIGPythonTypeScriptCallbackFunction) (const char *python_function_name, - void *session_dictionary, - const lldb::ValueObjectSP& valobj_sp, - void** pyfunct_wrapper, - const lldb::TypeSummaryOptionsSP& options, - std::string& retval); - - typedef void* (*SWIGPythonCreateSyntheticProvider) (const char *python_class_name, - const char *session_dictionary_name, - const lldb::ValueObjectSP& valobj_sp); - - typedef void* (*SWIGPythonCreateCommandObject) (const char *python_class_name, - const char *session_dictionary_name, - const lldb::DebuggerSP debugger_sp); - - typedef void* (*SWIGPythonCreateScriptedThreadPlan) (const char *python_class_name, - const char *session_dictionary_name, - const lldb::ThreadPlanSP& thread_plan_sp); - - typedef bool (*SWIGPythonCallThreadPlan) (void *implementor, const char *method_name, Event *event_sp, bool &got_error); - - typedef void* (*SWIGPythonCreateOSPlugin) (const char *python_class_name, - const char *session_dictionary_name, - const lldb::ProcessSP& process_sp); - - typedef size_t (*SWIGPythonCalculateNumChildren) (void *implementor); - typedef void* (*SWIGPythonGetChildAtIndex) (void *implementor, uint32_t idx); - typedef int (*SWIGPythonGetIndexOfChildWithName) (void *implementor, const char* child_name); - typedef void* (*SWIGPythonCastPyObjectToSBValue) (void* data); - typedef lldb::ValueObjectSP (*SWIGPythonGetValueObjectSPFromSBValue) (void* data); - typedef bool (*SWIGPythonUpdateSynthProviderInstance) (void* data); - typedef bool (*SWIGPythonMightHaveChildrenSynthProviderInstance) (void* data); - typedef void* (*SWIGPythonGetValueSynthProviderInstance) (void *implementor); - - typedef bool (*SWIGPythonCallCommand) (const char *python_function_name, - const char *session_dictionary_name, - lldb::DebuggerSP& debugger, - const char* args, - lldb_private::CommandReturnObject& cmd_retobj, - lldb::ExecutionContextRefSP exe_ctx_ref_sp); - - typedef bool (*SWIGPythonCallCommandObject) (void *implementor, - lldb::DebuggerSP& debugger, - const char* args, - lldb_private::CommandReturnObject& cmd_retobj, - lldb::ExecutionContextRefSP exe_ctx_ref_sp); - - - typedef bool (*SWIGPythonCallModuleInit) (const char *python_module_name, - const char *session_dictionary_name, - lldb::DebuggerSP& debugger); - - typedef bool (*SWIGPythonScriptKeyword_Process) (const char* python_function_name, - const char* session_dictionary_name, - lldb::ProcessSP& process, - std::string& output); - typedef bool (*SWIGPythonScriptKeyword_Thread) (const char* python_function_name, - const char* session_dictionary_name, - lldb::ThreadSP& thread, - std::string& output); - - typedef bool (*SWIGPythonScriptKeyword_Target) (const char* python_function_name, - const char* session_dictionary_name, - lldb::TargetSP& target, - std::string& output); - - typedef bool (*SWIGPythonScriptKeyword_Frame) (const char* python_function_name, - const char* session_dictionary_name, - lldb::StackFrameSP& frame, - std::string& output); - - typedef bool (*SWIGPythonScriptKeyword_Value) (const char* python_function_name, - const char* session_dictionary_name, - lldb::ValueObjectSP& value, - std::string& output); - - typedef void* (*SWIGPython_GetDynamicSetting) (void* module, - const char* setting, - const lldb::TargetSP& target_sp); - - friend class ::IOHandlerPythonInterpreter; - - ScriptInterpreterPython (CommandInterpreter &interpreter); - - ~ScriptInterpreterPython (); - - bool - Interrupt() override; - - bool - ExecuteOneLine (const char *command, - CommandReturnObject *result, - const ExecuteScriptOptions &options = ExecuteScriptOptions()) override; - - void - ExecuteInterpreterLoop () override; - - bool - ExecuteOneLineWithReturn (const char *in_string, - ScriptInterpreter::ScriptReturnType return_type, - void *ret_value, - const ExecuteScriptOptions &options = ExecuteScriptOptions()) override; - - lldb_private::Error - ExecuteMultipleLines (const char *in_string, - const ExecuteScriptOptions &options = ExecuteScriptOptions()) override; - - Error - ExportFunctionDefinitionToInterpreter (StringList &function_def) override; - - bool - GenerateTypeScriptFunction (StringList &input, std::string& output, const void* name_token = NULL) override; - - bool - GenerateTypeSynthClass (StringList &input, std::string& output, const void* name_token = NULL) override; - - bool - GenerateTypeSynthClass (const char* oneliner, std::string& output, const void* name_token = NULL) override; - - // use this if the function code is just a one-liner script - bool - GenerateTypeScriptFunction (const char* oneliner, std::string& output, const void* name_token = NULL) override; - - bool - GenerateScriptAliasFunction (StringList &input, std::string& output) override; - - StructuredData::ObjectSP CreateSyntheticScriptedProvider(const char *class_name, lldb::ValueObjectSP valobj) override; - - StructuredData::GenericSP CreateScriptCommandObject (const char *class_name) override; - - StructuredData::ObjectSP CreateScriptedThreadPlan(const char *class_name, lldb::ThreadPlanSP thread_plan) override; - - bool ScriptedThreadPlanExplainsStop(StructuredData::ObjectSP implementor_sp, Event *event, bool &script_error) override; - bool ScriptedThreadPlanShouldStop(StructuredData::ObjectSP implementor_sp, Event *event, bool &script_error) override; - lldb::StateType ScriptedThreadPlanGetRunState(StructuredData::ObjectSP implementor_sp, bool &script_error) override; - - StructuredData::GenericSP OSPlugin_CreatePluginObject(const char *class_name, lldb::ProcessSP process_sp) override; - - StructuredData::DictionarySP OSPlugin_RegisterInfo(StructuredData::ObjectSP os_plugin_object_sp) override; - - StructuredData::ArraySP OSPlugin_ThreadsInfo(StructuredData::ObjectSP os_plugin_object_sp) override; - - StructuredData::StringSP OSPlugin_RegisterContextData(StructuredData::ObjectSP os_plugin_object_sp, lldb::tid_t thread_id) override; - - StructuredData::DictionarySP OSPlugin_CreateThread(StructuredData::ObjectSP os_plugin_object_sp, lldb::tid_t tid, - lldb::addr_t context) override; - - StructuredData::ObjectSP LoadPluginModule(const FileSpec &file_spec, lldb_private::Error &error) override; - - StructuredData::DictionarySP GetDynamicSettings(StructuredData::ObjectSP plugin_module_sp, Target *target, const char *setting_name, - lldb_private::Error &error) override; - - size_t CalculateNumChildren(const StructuredData::ObjectSP &implementor) override; - - lldb::ValueObjectSP GetChildAtIndex(const StructuredData::ObjectSP &implementor, uint32_t idx) override; - - int GetIndexOfChildWithName(const StructuredData::ObjectSP &implementor, const char *child_name) override; - - bool UpdateSynthProviderInstance(const StructuredData::ObjectSP &implementor) override; - - bool MightHaveChildrenSynthProviderInstance(const StructuredData::ObjectSP &implementor) override; - - lldb::ValueObjectSP GetSyntheticValue(const StructuredData::ObjectSP &implementor) override; - - bool - RunScriptBasedCommand(const char* impl_function, - const char* args, - ScriptedCommandSynchronicity synchronicity, - lldb_private::CommandReturnObject& cmd_retobj, - Error& error, - const lldb_private::ExecutionContext& exe_ctx) override; - - bool - RunScriptBasedCommand (StructuredData::GenericSP impl_obj_sp, - const char* args, - ScriptedCommandSynchronicity synchronicity, - lldb_private::CommandReturnObject& cmd_retobj, - Error& error, - const lldb_private::ExecutionContext& exe_ctx) override; - - Error - GenerateFunction(const char *signature, const StringList &input) override; - - Error - GenerateBreakpointCommandCallbackData (StringList &input, std::string& output) override; - - bool - GenerateWatchpointCommandCallbackData (StringList &input, std::string& output) override; - -// static size_t -// GenerateBreakpointOptionsCommandCallback (void *baton, -// InputReader &reader, -// lldb::InputReaderAction notification, -// const char *bytes, -// size_t bytes_len); -// -// static size_t -// GenerateWatchpointOptionsCommandCallback (void *baton, -// InputReader &reader, -// lldb::InputReaderAction notification, -// const char *bytes, -// size_t bytes_len); - - static bool - BreakpointCallbackFunction (void *baton, - StoppointCallbackContext *context, - lldb::user_id_t break_id, - lldb::user_id_t break_loc_id); - - static bool - WatchpointCallbackFunction (void *baton, - StoppointCallbackContext *context, - lldb::user_id_t watch_id); - - bool GetScriptedSummary(const char *function_name, lldb::ValueObjectSP valobj, StructuredData::ObjectSP &callee_wrapper_sp, - const TypeSummaryOptions &options, std::string &retval) override; - - void - Clear () override; - - bool - GetDocumentationForItem (const char* item, std::string& dest) override; - - bool - GetShortHelpForCommandObject(StructuredData::GenericSP cmd_obj_sp, std::string& dest) override; - - uint32_t - GetFlagsForCommandObject (StructuredData::GenericSP cmd_obj_sp) override; - - bool - GetLongHelpForCommandObject(StructuredData::GenericSP cmd_obj_sp, std::string& dest) override; - - bool - CheckObjectExists (const char* name) override - { - if (!name || !name[0]) - return false; - std::string temp; - return GetDocumentationForItem (name,temp); - } - - bool - RunScriptFormatKeyword (const char* impl_function, - Process* process, - std::string& output, - Error& error) override; - - bool - RunScriptFormatKeyword (const char* impl_function, - Thread* thread, - std::string& output, - Error& error) override; - - bool - RunScriptFormatKeyword (const char* impl_function, - Target* target, - std::string& output, - Error& error) override; - - bool - RunScriptFormatKeyword (const char* impl_function, - StackFrame* frame, - std::string& output, - Error& error) override; - - bool - RunScriptFormatKeyword (const char* impl_function, - ValueObject* value, - std::string& output, - Error& error) override; - - bool LoadScriptingModule(const char *filename, bool can_reload, bool init_session, lldb_private::Error &error, - StructuredData::ObjectSP *module_sp = nullptr) override; - - bool - IsReservedWord (const char* word) override; - - std::unique_ptr<ScriptInterpreterLocker> - AcquireInterpreterLock () override; - - void - CollectDataForBreakpointCommandCallback (std::vector<BreakpointOptions *> &bp_options_vec, - CommandReturnObject &result) override; - - void - CollectDataForWatchpointCommandCallback (WatchpointOptions *wp_options, - CommandReturnObject &result) override; - - /// Set the callback body text into the callback for the breakpoint. - Error - SetBreakpointCommandCallback (BreakpointOptions *bp_options, - const char *callback_body) override; - - void - SetBreakpointCommandCallbackFunction (BreakpointOptions *bp_options, - const char *function_name) override; - - /// Set a one-liner as the callback for the watchpoint. - void - SetWatchpointCommandCallback (WatchpointOptions *wp_options, - const char *oneliner) override; - - StringList - ReadCommandInputFromUser (FILE *in_file); - - void ResetOutputFileHandle(FILE *new_fh) override; - - static void - InitializePrivate (); - - static void - InitializeInterpreter (SWIGInitCallback python_swig_init_callback, - SWIGBreakpointCallbackFunction swig_breakpoint_callback, - SWIGWatchpointCallbackFunction swig_watchpoint_callback, - SWIGPythonTypeScriptCallbackFunction swig_typescript_callback, - SWIGPythonCreateSyntheticProvider swig_synthetic_script, - SWIGPythonCreateCommandObject swig_create_cmd, - SWIGPythonCalculateNumChildren swig_calc_children, - SWIGPythonGetChildAtIndex swig_get_child_index, - SWIGPythonGetIndexOfChildWithName swig_get_index_child, - SWIGPythonCastPyObjectToSBValue swig_cast_to_sbvalue , - SWIGPythonGetValueObjectSPFromSBValue swig_get_valobj_sp_from_sbvalue, - SWIGPythonUpdateSynthProviderInstance swig_update_provider, - SWIGPythonMightHaveChildrenSynthProviderInstance swig_mighthavechildren_provider, - SWIGPythonGetValueSynthProviderInstance swig_getvalue_provider, - SWIGPythonCallCommand swig_call_command, - SWIGPythonCallCommandObject swig_call_command_object, - SWIGPythonCallModuleInit swig_call_module_init, - SWIGPythonCreateOSPlugin swig_create_os_plugin, - SWIGPythonScriptKeyword_Process swig_run_script_keyword_process, - SWIGPythonScriptKeyword_Thread swig_run_script_keyword_thread, - SWIGPythonScriptKeyword_Target swig_run_script_keyword_target, - SWIGPythonScriptKeyword_Frame swig_run_script_keyword_frame, - SWIGPythonScriptKeyword_Value swig_run_script_keyword_value, - SWIGPython_GetDynamicSetting swig_plugin_get, - SWIGPythonCreateScriptedThreadPlan swig_thread_plan_script, - SWIGPythonCallThreadPlan swig_call_thread_plan); - - const char * - GetDictionaryName () - { - return m_dictionary_name.c_str(); - } - - - PyThreadState * - GetThreadState() - { - return m_command_thread_state; - } - - void - SetThreadState (PyThreadState *s) - { - if (s) - m_command_thread_state = s; - } - - //---------------------------------------------------------------------- - // IOHandlerDelegate - //---------------------------------------------------------------------- - void - IOHandlerActivated (IOHandler &io_handler) override; - - void - IOHandlerInputComplete (IOHandler &io_handler, std::string &data) override; - -protected: - - bool - EnterSession (uint16_t on_entry_flags, - FILE *in, - FILE *out, - FILE *err); - - void - LeaveSession (); - - void - SaveTerminalState (int fd); - - void - RestoreTerminalState (); - - class SynchronicityHandler - { - private: - lldb::DebuggerSP m_debugger_sp; - ScriptedCommandSynchronicity m_synch_wanted; - bool m_old_asynch; - public: - SynchronicityHandler(lldb::DebuggerSP, - ScriptedCommandSynchronicity); - ~SynchronicityHandler(); - }; - -public: - class Locker : public ScriptInterpreterLocker - { - public: - - enum OnEntry - { - AcquireLock = 0x0001, - InitSession = 0x0002, - InitGlobals = 0x0004, - NoSTDIN = 0x0008 - }; - - enum OnLeave - { - FreeLock = 0x0001, - FreeAcquiredLock = 0x0002, // do not free the lock if we already held it when calling constructor - TearDownSession = 0x0004 - }; - - Locker (ScriptInterpreterPython *py_interpreter = NULL, - uint16_t on_entry = AcquireLock | InitSession, - uint16_t on_leave = FreeLock | TearDownSession, - FILE *in = NULL, - FILE *out = NULL, - FILE *err = NULL); - - ~Locker (); - - private: - - bool - DoAcquireLock (); - - bool - DoInitSession (uint16_t on_entry_flags, FILE *in, FILE *out, FILE *err); - - bool - DoFreeLock (); - - bool - DoTearDownSession (); - - static void - ReleasePythonLock (); - - bool m_teardown_session; - ScriptInterpreterPython *m_python_interpreter; -// FILE* m_tmp_fh; - PyGILState_STATE m_GILState; - }; -protected: - enum class AddLocation - { - Beginning, - End - }; - - static void AddToSysPath(AddLocation location, std::string path); - - uint32_t - IsExecutingPython () const - { - return m_lock_count > 0; - } - - uint32_t - IncrementLockCount() - { - return ++m_lock_count; - } - - uint32_t - DecrementLockCount() - { - if (m_lock_count > 0) - --m_lock_count; - return m_lock_count; - } - - enum ActiveIOHandler { - eIOHandlerNone, - eIOHandlerBreakpoint, - eIOHandlerWatchpoint - }; - PythonObject & - GetMainModule (); - - PythonDictionary & - GetSessionDictionary (); - - PythonDictionary & - GetSysModuleDictionary (); - - bool - GetEmbeddedInterpreterModuleObjects (); - - PythonObject m_saved_stdin; - PythonObject m_saved_stdout; - PythonObject m_saved_stderr; - PythonObject m_main_module; - PythonObject m_lldb_module; - PythonDictionary m_session_dict; - PythonDictionary m_sys_module_dict; - PythonObject m_run_one_line_function; - PythonObject m_run_one_line_str_global; - std::string m_dictionary_name; - TerminalState m_terminal_state; - ActiveIOHandler m_active_io_handler; - bool m_session_is_active; - bool m_pty_slave_is_open; - bool m_valid_session; - uint32_t m_lock_count; - PyThreadState *m_command_thread_state; -}; -} // namespace lldb_private - -#endif // #ifdef LLDB_DISABLE_PYTHON - -#endif // #ifndef liblldb_ScriptInterpreterPython_h_ |