Skip to content
This repository has been archived by the owner on Apr 23, 2020. It is now read-only.

Commit

Permalink
Fix Clang-tidy modernize-use-nullptr warnings in include/lldb/API and…
Browse files Browse the repository at this point in the history
… source/API; other minor fixes.

Other fixes should reduce number of readability-redundant-smartptr-get and readability-implicit-bool-cast.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@251733 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
EugeneZelenko committed Oct 31, 2015
1 parent 900c4cc commit 63da6e2
Show file tree
Hide file tree
Showing 9 changed files with 334 additions and 429 deletions.
30 changes: 17 additions & 13 deletions include/lldb/API/SBCommandInterpreter.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@
#ifndef LLDB_SBCommandInterpreter_h_
#define LLDB_SBCommandInterpreter_h_

// C Includes
// C++ Includes
#include <memory>

// Other libraries and framework includes
// Project includes
#include "lldb/API/SBDefines.h"
#include "lldb/API/SBDebugger.h"

Expand Down Expand Up @@ -59,6 +65,7 @@ friend class SBCommandInterpreter;

void
SetAddToHistory (bool);

private:
lldb_private::CommandInterpreterRunOptions *
get () const;
Expand All @@ -84,11 +91,11 @@ class SBCommandInterpreter

SBCommandInterpreter (const lldb::SBCommandInterpreter &rhs);

~SBCommandInterpreter ();

const lldb::SBCommandInterpreter &
operator = (const lldb::SBCommandInterpreter &rhs);

~SBCommandInterpreter ();

static const char *
GetArgumentTypeAsCString (const lldb::CommandArgumentType arg_type);

Expand Down Expand Up @@ -187,7 +194,7 @@ class SBCommandInterpreter
lldb::CommandOverrideCallback callback,
void *baton);

SBCommandInterpreter (lldb_private::CommandInterpreter *interpreter_ptr = NULL); // Access using SBDebugger::GetCommandInterpreter();
SBCommandInterpreter(lldb_private::CommandInterpreter *interpreter_ptr = nullptr); // Access using SBDebugger::GetCommandInterpreter();

//----------------------------------------------------------------------
/// Return true if the command interpreter is the active IO handler.
Expand All @@ -213,7 +220,7 @@ class SBCommandInterpreter
///
/// @return
/// The string that should be written into the file handle that is
/// feeding the input stream for the debugger, or NULL if there is
/// feeding the input stream for the debugger, or nullptr if there is
/// no string for this control key.
//----------------------------------------------------------------------
const char *
Expand All @@ -233,7 +240,6 @@ class SBCommandInterpreter
ResolveCommand(const char *command_line, SBCommandReturnObject &result);

protected:

lldb_private::CommandInterpreter &
ref ();

Expand All @@ -242,6 +248,7 @@ class SBCommandInterpreter

void
reset (lldb_private::CommandInterpreter *);

private:
friend class SBDebugger;

Expand All @@ -254,23 +261,21 @@ class SBCommandInterpreter
class SBCommandPluginInterface
{
public:
virtual
~SBCommandPluginInterface() = default;

virtual bool
DoExecute (lldb::SBDebugger /*debugger*/,
char** /*command*/,
lldb::SBCommandReturnObject & /*result*/)
{
return false;
}

virtual
~SBCommandPluginInterface ()
{}
};

class SBCommand
{
public:

SBCommand ();

bool
Expand Down Expand Up @@ -298,13 +303,12 @@ class SBCommand
SetFlags (uint32_t flags);

lldb::SBCommand
AddMultiwordCommand (const char* name, const char* help = NULL);
AddMultiwordCommand(const char* name, const char* help = nullptr);

lldb::SBCommand
AddCommand (const char* name, lldb::SBCommandPluginInterface* impl, const char* help = NULL);
AddCommand(const char* name, lldb::SBCommandPluginInterface* impl, const char* help = nullptr);

private:

friend class SBDebugger;
friend class SBCommandInterpreter;

Expand Down
20 changes: 12 additions & 8 deletions include/lldb/API/SBCommandReturnObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,31 +10,35 @@
#ifndef LLDB_SBCommandReturnObject_h_
#define LLDB_SBCommandReturnObject_h_

// C Includes
#include <stdio.h>

// C++ Includes
#include <memory>

// Other libraries and framework includes
// Project includes
#include "lldb/API/SBDefines.h"

namespace lldb {

class LLDB_API SBCommandReturnObject
{
public:

SBCommandReturnObject ();

SBCommandReturnObject (const lldb::SBCommandReturnObject &rhs);

~SBCommandReturnObject ();

const lldb::SBCommandReturnObject &
operator = (const lldb::SBCommandReturnObject &rhs);


SBCommandReturnObject (lldb_private::CommandReturnObject *ptr);

lldb_private::CommandReturnObject *
Release ();

~SBCommandReturnObject ();

bool
IsValid() const;

Expand Down Expand Up @@ -99,8 +103,8 @@ class LLDB_API SBCommandReturnObject
GetError (bool only_if_no_immediate);

void
SetError (lldb::SBError &error,
const char *fallback_error_cstr = NULL);
SetError(lldb::SBError &error,
const char *fallback_error_cstr = nullptr);

void
SetError (const char* error_cstr);
Expand All @@ -124,10 +128,10 @@ class LLDB_API SBCommandReturnObject
void
SetLLDBObjectPtr (lldb_private::CommandReturnObject *ptr);

private:
private:
std::unique_ptr<lldb_private::CommandReturnObject> m_opaque_ap;
};

} // namespace lldb

#endif // LLDB_SBCommandReturnObject_h_
#endif // LLDB_SBCommandReturnObject_h_
30 changes: 14 additions & 16 deletions include/lldb/API/SBDebugger.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@
#include "lldb/API/SBPlatform.h"

namespace lldb {


class LLDB_API SBInputReader
{
public:
SBInputReader();
~SBInputReader();
SBInputReader() = default;
~SBInputReader() = default;

SBError Initialize(lldb::SBDebugger&, unsigned long (*)(void*, lldb::SBInputReader*, lldb::InputReaderAction, char const*, unsigned long), void*, lldb::InputReaderGranularity, char const*, char const*, bool);
void SetIsDone(bool);
bool IsActive() const;
Expand All @@ -31,6 +31,16 @@ class LLDB_API SBInputReader
class LLDB_API SBDebugger
{
public:
SBDebugger();

SBDebugger(const lldb::SBDebugger &rhs);

SBDebugger(const lldb::DebuggerSP &debugger_sp);

~SBDebugger();

lldb::SBDebugger &
operator = (const lldb::SBDebugger &rhs);

static void
Initialize();
Expand All @@ -54,17 +64,6 @@ class LLDB_API SBDebugger
static void
MemoryPressureDetected ();

SBDebugger();

SBDebugger(const lldb::SBDebugger &rhs);

SBDebugger(const lldb::DebuggerSP &debugger_sp);

lldb::SBDebugger &
operator = (const lldb::SBDebugger &rhs);

~SBDebugger();

bool
IsValid() const;

Expand Down Expand Up @@ -332,8 +331,8 @@ class LLDB_API SBDebugger

SBError
RunREPL (lldb::LanguageType language, const char *repl_options);
private:

private:
friend class SBCommandInterpreter;
friend class SBInputReader;
friend class SBListener;
Expand All @@ -360,7 +359,6 @@ class LLDB_API SBDebugger

}; // class SBDebugger


} // namespace lldb

#endif // LLDB_SBDebugger_h_
40 changes: 19 additions & 21 deletions include/lldb/API/SBTarget.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
#ifndef LLDB_SBTarget_h_
#define LLDB_SBTarget_h_

// C Includes
// C++ Includes
// Other libraries and framework includes
// Project includes
#include "lldb/API/SBDefines.h"
#include "lldb/API/SBAddress.h"
#include "lldb/API/SBAttachInfo.h"
Expand Down Expand Up @@ -50,14 +54,14 @@ class LLDB_API SBTarget

SBTarget (const lldb::TargetSP& target_sp);

const lldb::SBTarget&
operator = (const lldb::SBTarget& rhs);

//------------------------------------------------------------------
// Destructor
//------------------------------------------------------------------
~SBTarget();

const lldb::SBTarget&
operator = (const lldb::SBTarget& rhs);

bool
IsValid() const;

Expand Down Expand Up @@ -135,17 +139,17 @@ class LLDB_API SBTarget
///
/// @param[in] stdin_path
/// The path to use when re-directing the STDIN of the new
/// process. If all stdXX_path arguments are NULL, a pseudo
/// process. If all stdXX_path arguments are nullptr, a pseudo
/// terminal will be used.
///
/// @param[in] stdout_path
/// The path to use when re-directing the STDOUT of the new
/// process. If all stdXX_path arguments are NULL, a pseudo
/// process. If all stdXX_path arguments are nullptr, a pseudo
/// terminal will be used.
///
/// @param[in] stderr_path
/// The path to use when re-directing the STDERR of the new
/// process. If all stdXX_path arguments are NULL, a pseudo
/// process. If all stdXX_path arguments are nullptr, a pseudo
/// terminal will be used.
///
/// @param[in] working_directory
Expand Down Expand Up @@ -175,8 +179,7 @@ class LLDB_API SBTarget
uint32_t launch_flags, // See LaunchFlags
bool stop_at_entry,
lldb::SBError& error);



//------------------------------------------------------------------
/// Launch a new process with sensible defaults.
///
Expand Down Expand Up @@ -248,6 +251,7 @@ class LLDB_API SBTarget
::pid_t pid, // 32 bit int process ID
lldb::SBError& error); // DEPRECATED
#endif

//------------------------------------------------------------------
/// Attach to process with name.
///
Expand Down Expand Up @@ -288,7 +292,7 @@ class LLDB_API SBTarget
/// The url to connect to, e.g., 'connect://localhost:12345'.
///
/// @param[in] plugin_name
/// The plugin name to be used; can be NULL.
/// The plugin name to be used; can be nullptr.
///
/// @param[out] error
/// An error explaining what went wrong if the connect fails.
Expand Down Expand Up @@ -421,7 +425,6 @@ class LLDB_API SBTarget
lldb::SBError
SetModuleLoadAddress (lldb::SBModule module,
int64_t sections_offset);


//------------------------------------------------------------------
/// Clear the section base load addresses for all sections in a module.
Expand Down Expand Up @@ -618,7 +621,7 @@ class LLDB_API SBTarget
BreakpointCreateByLocation (const lldb::SBFileSpec &file_spec, uint32_t line);

lldb::SBBreakpoint
BreakpointCreateByName (const char *symbol_name, const char *module_name = NULL);
BreakpointCreateByName(const char *symbol_name, const char *module_name = nullptr);

// This version uses name_type_mask = eFunctionNameTypeAuto
lldb::SBBreakpoint
Expand All @@ -640,17 +643,17 @@ class LLDB_API SBTarget
const SBFileSpecList &comp_unit_list);

lldb::SBBreakpoint
BreakpointCreateByRegex (const char *symbol_name_regex, const char *module_name = NULL);
BreakpointCreateByRegex(const char *symbol_name_regex, const char *module_name = nullptr);

lldb::SBBreakpoint
BreakpointCreateByRegex (const char *symbol_name_regex,
const SBFileSpecList &module_list,
const SBFileSpecList &comp_unit_list);

lldb::SBBreakpoint
BreakpointCreateBySourceRegex (const char *source_regex,
const SBFileSpec &source_file,
const char *module_name = NULL);
BreakpointCreateBySourceRegex(const char *source_regex,
const SBFileSpec &source_file,
const char *module_name = nullptr);

lldb::SBBreakpoint
BreakpointCreateBySourceRegex (const char *source_regex,
Expand Down Expand Up @@ -808,15 +811,10 @@ class LLDB_API SBTarget
void
SetSP (const lldb::TargetSP& target_sp);


private:
//------------------------------------------------------------------
// For Target only
//------------------------------------------------------------------

lldb::TargetSP m_opaque_sp;
};

} // namespace lldb

#endif // LLDB_SBTarget_h_
#endif // LLDB_SBTarget_h_
Loading

0 comments on commit 63da6e2

Please sign in to comment.