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

Commit 63da6e2

Browse files
committed
Fix Clang-tidy modernize-use-nullptr warnings in include/lldb/API and 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
1 parent 900c4cc commit 63da6e2

File tree

9 files changed

+334
-429
lines changed

9 files changed

+334
-429
lines changed

include/lldb/API/SBCommandInterpreter.h

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@
1010
#ifndef LLDB_SBCommandInterpreter_h_
1111
#define LLDB_SBCommandInterpreter_h_
1212

13+
// C Includes
14+
// C++ Includes
15+
#include <memory>
16+
17+
// Other libraries and framework includes
18+
// Project includes
1319
#include "lldb/API/SBDefines.h"
1420
#include "lldb/API/SBDebugger.h"
1521

@@ -59,6 +65,7 @@ friend class SBCommandInterpreter;
5965

6066
void
6167
SetAddToHistory (bool);
68+
6269
private:
6370
lldb_private::CommandInterpreterRunOptions *
6471
get () const;
@@ -84,11 +91,11 @@ class SBCommandInterpreter
8491

8592
SBCommandInterpreter (const lldb::SBCommandInterpreter &rhs);
8693

94+
~SBCommandInterpreter ();
95+
8796
const lldb::SBCommandInterpreter &
8897
operator = (const lldb::SBCommandInterpreter &rhs);
8998

90-
~SBCommandInterpreter ();
91-
9299
static const char *
93100
GetArgumentTypeAsCString (const lldb::CommandArgumentType arg_type);
94101

@@ -187,7 +194,7 @@ class SBCommandInterpreter
187194
lldb::CommandOverrideCallback callback,
188195
void *baton);
189196

190-
SBCommandInterpreter (lldb_private::CommandInterpreter *interpreter_ptr = NULL); // Access using SBDebugger::GetCommandInterpreter();
197+
SBCommandInterpreter(lldb_private::CommandInterpreter *interpreter_ptr = nullptr); // Access using SBDebugger::GetCommandInterpreter();
191198

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

235242
protected:
236-
237243
lldb_private::CommandInterpreter &
238244
ref ();
239245

@@ -242,6 +248,7 @@ class SBCommandInterpreter
242248

243249
void
244250
reset (lldb_private::CommandInterpreter *);
251+
245252
private:
246253
friend class SBDebugger;
247254

@@ -254,23 +261,21 @@ class SBCommandInterpreter
254261
class SBCommandPluginInterface
255262
{
256263
public:
264+
virtual
265+
~SBCommandPluginInterface() = default;
266+
257267
virtual bool
258268
DoExecute (lldb::SBDebugger /*debugger*/,
259269
char** /*command*/,
260270
lldb::SBCommandReturnObject & /*result*/)
261271
{
262272
return false;
263273
}
264-
265-
virtual
266-
~SBCommandPluginInterface ()
267-
{}
268274
};
269275

270276
class SBCommand
271277
{
272278
public:
273-
274279
SBCommand ();
275280

276281
bool
@@ -298,13 +303,12 @@ class SBCommand
298303
SetFlags (uint32_t flags);
299304

300305
lldb::SBCommand
301-
AddMultiwordCommand (const char* name, const char* help = NULL);
306+
AddMultiwordCommand(const char* name, const char* help = nullptr);
302307

303308
lldb::SBCommand
304-
AddCommand (const char* name, lldb::SBCommandPluginInterface* impl, const char* help = NULL);
309+
AddCommand(const char* name, lldb::SBCommandPluginInterface* impl, const char* help = nullptr);
305310

306311
private:
307-
308312
friend class SBDebugger;
309313
friend class SBCommandInterpreter;
310314

include/lldb/API/SBCommandReturnObject.h

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,31 +10,35 @@
1010
#ifndef LLDB_SBCommandReturnObject_h_
1111
#define LLDB_SBCommandReturnObject_h_
1212

13+
// C Includes
1314
#include <stdio.h>
1415

16+
// C++ Includes
17+
#include <memory>
18+
19+
// Other libraries and framework includes
20+
// Project includes
1521
#include "lldb/API/SBDefines.h"
1622

1723
namespace lldb {
1824

1925
class LLDB_API SBCommandReturnObject
2026
{
2127
public:
22-
2328
SBCommandReturnObject ();
2429

2530
SBCommandReturnObject (const lldb::SBCommandReturnObject &rhs);
2631

32+
~SBCommandReturnObject ();
33+
2734
const lldb::SBCommandReturnObject &
2835
operator = (const lldb::SBCommandReturnObject &rhs);
29-
3036

3137
SBCommandReturnObject (lldb_private::CommandReturnObject *ptr);
3238

3339
lldb_private::CommandReturnObject *
3440
Release ();
3541

36-
~SBCommandReturnObject ();
37-
3842
bool
3943
IsValid() const;
4044

@@ -99,8 +103,8 @@ class LLDB_API SBCommandReturnObject
99103
GetError (bool only_if_no_immediate);
100104

101105
void
102-
SetError (lldb::SBError &error,
103-
const char *fallback_error_cstr = NULL);
106+
SetError(lldb::SBError &error,
107+
const char *fallback_error_cstr = nullptr);
104108

105109
void
106110
SetError (const char* error_cstr);
@@ -124,10 +128,10 @@ class LLDB_API SBCommandReturnObject
124128
void
125129
SetLLDBObjectPtr (lldb_private::CommandReturnObject *ptr);
126130

127-
private:
131+
private:
128132
std::unique_ptr<lldb_private::CommandReturnObject> m_opaque_ap;
129133
};
130134

131135
} // namespace lldb
132136

133-
#endif // LLDB_SBCommandReturnObject_h_
137+
#endif // LLDB_SBCommandReturnObject_h_

include/lldb/API/SBDebugger.h

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@
1616
#include "lldb/API/SBPlatform.h"
1717

1818
namespace lldb {
19-
2019

2120
class LLDB_API SBInputReader
2221
{
2322
public:
24-
SBInputReader();
25-
~SBInputReader();
23+
SBInputReader() = default;
24+
~SBInputReader() = default;
25+
2626
SBError Initialize(lldb::SBDebugger&, unsigned long (*)(void*, lldb::SBInputReader*, lldb::InputReaderAction, char const*, unsigned long), void*, lldb::InputReaderGranularity, char const*, char const*, bool);
2727
void SetIsDone(bool);
2828
bool IsActive() const;
@@ -31,6 +31,16 @@ class LLDB_API SBInputReader
3131
class LLDB_API SBDebugger
3232
{
3333
public:
34+
SBDebugger();
35+
36+
SBDebugger(const lldb::SBDebugger &rhs);
37+
38+
SBDebugger(const lldb::DebuggerSP &debugger_sp);
39+
40+
~SBDebugger();
41+
42+
lldb::SBDebugger &
43+
operator = (const lldb::SBDebugger &rhs);
3444

3545
static void
3646
Initialize();
@@ -54,17 +64,6 @@ class LLDB_API SBDebugger
5464
static void
5565
MemoryPressureDetected ();
5666

57-
SBDebugger();
58-
59-
SBDebugger(const lldb::SBDebugger &rhs);
60-
61-
SBDebugger(const lldb::DebuggerSP &debugger_sp);
62-
63-
lldb::SBDebugger &
64-
operator = (const lldb::SBDebugger &rhs);
65-
66-
~SBDebugger();
67-
6867
bool
6968
IsValid() const;
7069

@@ -332,8 +331,8 @@ class LLDB_API SBDebugger
332331

333332
SBError
334333
RunREPL (lldb::LanguageType language, const char *repl_options);
335-
private:
336334

335+
private:
337336
friend class SBCommandInterpreter;
338337
friend class SBInputReader;
339338
friend class SBListener;
@@ -360,7 +359,6 @@ class LLDB_API SBDebugger
360359

361360
}; // class SBDebugger
362361

363-
364362
} // namespace lldb
365363

366364
#endif // LLDB_SBDebugger_h_

include/lldb/API/SBTarget.h

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010
#ifndef LLDB_SBTarget_h_
1111
#define LLDB_SBTarget_h_
1212

13+
// C Includes
14+
// C++ Includes
15+
// Other libraries and framework includes
16+
// Project includes
1317
#include "lldb/API/SBDefines.h"
1418
#include "lldb/API/SBAddress.h"
1519
#include "lldb/API/SBAttachInfo.h"
@@ -50,14 +54,14 @@ class LLDB_API SBTarget
5054

5155
SBTarget (const lldb::TargetSP& target_sp);
5256

53-
const lldb::SBTarget&
54-
operator = (const lldb::SBTarget& rhs);
55-
5657
//------------------------------------------------------------------
5758
// Destructor
5859
//------------------------------------------------------------------
5960
~SBTarget();
6061

62+
const lldb::SBTarget&
63+
operator = (const lldb::SBTarget& rhs);
64+
6165
bool
6266
IsValid() const;
6367

@@ -135,17 +139,17 @@ class LLDB_API SBTarget
135139
///
136140
/// @param[in] stdin_path
137141
/// The path to use when re-directing the STDIN of the new
138-
/// process. If all stdXX_path arguments are NULL, a pseudo
142+
/// process. If all stdXX_path arguments are nullptr, a pseudo
139143
/// terminal will be used.
140144
///
141145
/// @param[in] stdout_path
142146
/// The path to use when re-directing the STDOUT of the new
143-
/// process. If all stdXX_path arguments are NULL, a pseudo
147+
/// process. If all stdXX_path arguments are nullptr, a pseudo
144148
/// terminal will be used.
145149
///
146150
/// @param[in] stderr_path
147151
/// The path to use when re-directing the STDERR of the new
148-
/// process. If all stdXX_path arguments are NULL, a pseudo
152+
/// process. If all stdXX_path arguments are nullptr, a pseudo
149153
/// terminal will be used.
150154
///
151155
/// @param[in] working_directory
@@ -175,8 +179,7 @@ class LLDB_API SBTarget
175179
uint32_t launch_flags, // See LaunchFlags
176180
bool stop_at_entry,
177181
lldb::SBError& error);
178-
179-
182+
180183
//------------------------------------------------------------------
181184
/// Launch a new process with sensible defaults.
182185
///
@@ -248,6 +251,7 @@ class LLDB_API SBTarget
248251
::pid_t pid, // 32 bit int process ID
249252
lldb::SBError& error); // DEPRECATED
250253
#endif
254+
251255
//------------------------------------------------------------------
252256
/// Attach to process with name.
253257
///
@@ -288,7 +292,7 @@ class LLDB_API SBTarget
288292
/// The url to connect to, e.g., 'connect://localhost:12345'.
289293
///
290294
/// @param[in] plugin_name
291-
/// The plugin name to be used; can be NULL.
295+
/// The plugin name to be used; can be nullptr.
292296
///
293297
/// @param[out] error
294298
/// An error explaining what went wrong if the connect fails.
@@ -421,7 +425,6 @@ class LLDB_API SBTarget
421425
lldb::SBError
422426
SetModuleLoadAddress (lldb::SBModule module,
423427
int64_t sections_offset);
424-
425428

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

620623
lldb::SBBreakpoint
621-
BreakpointCreateByName (const char *symbol_name, const char *module_name = NULL);
624+
BreakpointCreateByName(const char *symbol_name, const char *module_name = nullptr);
622625

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

642645
lldb::SBBreakpoint
643-
BreakpointCreateByRegex (const char *symbol_name_regex, const char *module_name = NULL);
646+
BreakpointCreateByRegex(const char *symbol_name_regex, const char *module_name = nullptr);
644647

645648
lldb::SBBreakpoint
646649
BreakpointCreateByRegex (const char *symbol_name_regex,
647650
const SBFileSpecList &module_list,
648651
const SBFileSpecList &comp_unit_list);
649652

650653
lldb::SBBreakpoint
651-
BreakpointCreateBySourceRegex (const char *source_regex,
652-
const SBFileSpec &source_file,
653-
const char *module_name = NULL);
654+
BreakpointCreateBySourceRegex(const char *source_regex,
655+
const SBFileSpec &source_file,
656+
const char *module_name = nullptr);
654657

655658
lldb::SBBreakpoint
656659
BreakpointCreateBySourceRegex (const char *source_regex,
@@ -808,15 +811,10 @@ class LLDB_API SBTarget
808811
void
809812
SetSP (const lldb::TargetSP& target_sp);
810813

811-
812814
private:
813-
//------------------------------------------------------------------
814-
// For Target only
815-
//------------------------------------------------------------------
816-
817815
lldb::TargetSP m_opaque_sp;
818816
};
819817

820818
} // namespace lldb
821819

822-
#endif // LLDB_SBTarget_h_
820+
#endif // LLDB_SBTarget_h_

0 commit comments

Comments
 (0)