Index: lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h =================================================================== --- lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h +++ lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h @@ -265,8 +265,8 @@ bool include_aliases); CommandObject * - GetCommandObject (const char *cmd, - StringList *matches = NULL); + GetCommandObject(const char *cmd, + StringList *matches = nullptr); bool CommandExists (const char *cmd); @@ -322,12 +322,12 @@ 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. @@ -335,7 +335,7 @@ /// @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 + /// 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, @@ -356,7 +356,7 @@ /// @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 + /// 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, @@ -643,7 +643,7 @@ } lldb::IOHandlerSP - GetIOHandler(bool force_create = false, CommandInterpreterRunOptions *options = NULL); + GetIOHandler(bool force_create = false, CommandInterpreterRunOptions *options = nullptr); bool GetStoppedForCrash () const @@ -682,7 +682,7 @@ 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 Index: lldb/trunk/include/lldb/Interpreter/CommandObject.h =================================================================== --- lldb/trunk/include/lldb/Interpreter/CommandObject.h +++ lldb/trunk/include/lldb/Interpreter/CommandObject.h @@ -46,7 +46,7 @@ explicit operator bool() const { - return (help_callback != NULL); + return (help_callback != nullptr); } }; @@ -77,11 +77,11 @@ typedef std::map 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 (); @@ -141,15 +141,15 @@ 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 @@ -373,13 +373,13 @@ /// 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 @@ -492,11 +492,11 @@ 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) {} ~CommandObjectParsed() override = default; @@ -519,11 +519,11 @@ 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) {} ~CommandObjectRaw() override = default; Index: lldb/trunk/include/lldb/Interpreter/CommandObjectMultiword.h =================================================================== --- lldb/trunk/include/lldb/Interpreter/CommandObjectMultiword.h +++ lldb/trunk/include/lldb/Interpreter/CommandObjectMultiword.h @@ -28,11 +28,11 @@ 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); ~CommandObjectMultiword() override; @@ -50,10 +50,10 @@ GenerateHelpText(Stream &output_stream) override; lldb::CommandObjectSP - GetSubcommandSP(const char *sub_cmd, StringList *matches = NULL) override; + GetSubcommandSP(const char *sub_cmd, StringList *matches = nullptr) override; CommandObject * - GetSubcommandObject(const char *sub_cmd, StringList *matches = NULL) override; + GetSubcommandObject(const char *sub_cmd, StringList *matches = nullptr) override; void AproposAllSubCommands(const char *prefix, @@ -104,11 +104,11 @@ 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); ~CommandObjectProxy() override; @@ -127,10 +127,10 @@ IsMultiwordObject() override; lldb::CommandObjectSP - GetSubcommandSP(const char *sub_cmd, StringList *matches = NULL) override; + GetSubcommandSP(const char *sub_cmd, StringList *matches = nullptr) override; CommandObject * - GetSubcommandObject(const char *sub_cmd, StringList *matches = NULL) override; + GetSubcommandObject(const char *sub_cmd, StringList *matches = nullptr) override; void AproposAllSubCommands(const char *prefix, Index: lldb/trunk/include/lldb/Interpreter/CommandReturnObject.h =================================================================== --- lldb/trunk/include/lldb/Interpreter/CommandReturnObject.h +++ lldb/trunk/include/lldb/Interpreter/CommandReturnObject.h @@ -22,11 +22,9 @@ namespace lldb_private { - class CommandReturnObject { public: - CommandReturnObject (); ~CommandReturnObject (); @@ -142,8 +140,8 @@ 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 @@ } // namespace lldb_private -#endif // liblldb_CommandReturnObject_h_ +#endif // liblldb_CommandReturnObject_h_ Index: lldb/trunk/include/lldb/Interpreter/OptionGroupArchitecture.h =================================================================== --- lldb/trunk/include/lldb/Interpreter/OptionGroupArchitecture.h +++ lldb/trunk/include/lldb/Interpreter/OptionGroupArchitecture.h @@ -26,7 +26,6 @@ class OptionGroupArchitecture : public OptionGroup { public: - OptionGroupArchitecture (); ~OptionGroupArchitecture() override; @@ -55,15 +54,12 @@ } 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 }; Index: lldb/trunk/include/lldb/Interpreter/OptionValue.h =================================================================== --- lldb/trunk/include/lldb/Interpreter/OptionValue.h +++ lldb/trunk/include/lldb/Interpreter/OptionValue.h @@ -1,4 +1,4 @@ -//===-- OptionValue.h --------------------------------------*- C++ -*-===// +//===-- OptionValue.h -------------------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // @@ -61,7 +61,6 @@ eDumpGroupHelp = (eDumpOptionName | eDumpOptionType | eDumpOptionDescription) }; - OptionValue () : m_callback (nullptr), m_baton(nullptr), @@ -76,9 +75,8 @@ { } - virtual ~OptionValue () - { - } + virtual ~OptionValue() = default; + //----------------------------------------------------------------- // Subclasses should override these functions //----------------------------------------------------------------- @@ -99,7 +97,6 @@ return GetBuiltinTypeAsCString(GetType()); } - static const char * GetBuiltinTypeAsCString (Type t); @@ -156,6 +153,7 @@ 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 @@ 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 @@ SetValueChangedCallback (OptionValueChangedCallback callback, void *baton) { - assert (m_callback == NULL); + assert (m_callback == nullptr); m_callback = callback; m_baton = baton; } @@ -426,6 +424,7 @@ if (m_callback) m_callback (m_baton, this); } + protected: lldb::OptionValueWP m_parent_wp; OptionValueChangedCallback m_callback; @@ -436,9 +435,8 @@ // 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_ Index: lldb/trunk/include/lldb/Interpreter/OptionValueProperties.h =================================================================== --- lldb/trunk/include/lldb/Interpreter/OptionValueProperties.h +++ lldb/trunk/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 + // Other libraries and framework includes // Project includes #include "lldb/Core/ConstString.h" @@ -27,10 +29,6 @@ public std::enable_shared_from_this { public: - - //--------------------------------------------------------------------- - // OptionValueProperties - //--------------------------------------------------------------------- OptionValueProperties () : OptionValue(), m_name (), @@ -42,11 +40,9 @@ OptionValueProperties (const ConstString &name); OptionValueProperties (const OptionValueProperties &global_properties); - - ~OptionValueProperties() override - { - } - + + ~OptionValueProperties() override = default; + Type GetType() const override { @@ -256,21 +252,16 @@ void *baton); 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 NameToIndex; Index: lldb/trunk/include/lldb/Interpreter/OptionValueRegex.h =================================================================== --- lldb/trunk/include/lldb/Interpreter/OptionValueRegex.h +++ lldb/trunk/include/lldb/Interpreter/OptionValueRegex.h @@ -12,8 +12,6 @@ // C Includes // C++ Includes -#include - // Other libraries and framework includes // Project includes #include "lldb/Core/RegularExpression.h" @@ -24,16 +22,14 @@ class OptionValueRegex : public OptionValue { public: - OptionValueRegex (const char *value = NULL) : + OptionValueRegex(const char *value = nullptr) : OptionValue(), m_regex (value) { } - ~OptionValueRegex() override - { - } - + ~OptionValueRegex() override = default; + //--------------------------------------------------------------------- // Virtual subclass pure virtual overrides //--------------------------------------------------------------------- @@ -68,9 +64,7 @@ const RegularExpression * GetCurrentValue() const { - if (m_regex.IsValid()) - return &m_regex; - return NULL; + return (m_regex.IsValid() ? &m_regex : nullptr); } void Index: lldb/trunk/include/lldb/Interpreter/OptionValueString.h =================================================================== --- lldb/trunk/include/lldb/Interpreter/OptionValueString.h +++ lldb/trunk/include/lldb/Interpreter/OptionValueString.h @@ -1,4 +1,4 @@ -//===-- OptionValueString.h --------------------------------------*- C++ -*-===// +//===-- OptionValueString.h -------------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // @@ -24,7 +24,6 @@ class OptionValueString : public OptionValue { public: - typedef Error (*ValidatorCallback) (const char* string, void* baton); @@ -43,8 +42,8 @@ { } - OptionValueString (ValidatorCallback validator, - void* baton = NULL) : + OptionValueString(ValidatorCallback validator, + void* baton = nullptr) : OptionValue(), m_current_value (), m_default_value (), @@ -84,9 +83,9 @@ 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 @@ } } - 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,10 +117,8 @@ m_default_value.assign (default_value); } - ~OptionValueString() override - { - } - + ~OptionValueString() override = default; + //--------------------------------------------------------------------- // Virtual subclass pure virtual overrides //--------------------------------------------------------------------- Index: lldb/trunk/include/lldb/Interpreter/Options.h =================================================================== --- lldb/trunk/include/lldb/Interpreter/Options.h +++ lldb/trunk/include/lldb/Interpreter/Options.h @@ -70,7 +70,7 @@ /// 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; @@ -93,11 +93,11 @@ /// /// 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) @@ -169,7 +169,10 @@ // 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 @@ -191,7 +194,7 @@ /// /// @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&) Index: lldb/trunk/include/lldb/Interpreter/ScriptInterpreter.h =================================================================== --- lldb/trunk/include/lldb/Interpreter/ScriptInterpreter.h +++ lldb/trunk/include/lldb/Interpreter/ScriptInterpreter.h @@ -173,13 +173,13 @@ } 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; } @@ -191,13 +191,13 @@ } 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; }