[lldb] NFC modernize codebase with modernize-use-nullptr

Summary:
NFC = [[ https://llvm.org/docs/Lexicon.html#nfc | Non functional change ]]

This commit is the result of modernizing the LLDB codebase by using
`nullptr` instread of `0` or `NULL`. See
https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-nullptr.html
for more information.

This is the command I ran and I to fix and format the code base:

```
run-clang-tidy.py \
	-header-filter='.*' \
	-checks='-*,modernize-use-nullptr' \
	-fix ~/dev/llvm-project/lldb/.* \
	-format \
	-style LLVM \
	-p ~/llvm-builds/debug-ninja-gcc
```

NOTE: There were also changes to `llvm/utils/unittest` but I did not
include them because I felt that maybe this library shall be updated in
isolation somehow.

NOTE: I know this is a rather large commit but it is a nobrainer in most
parts.

Reviewers: martong, espindola, shafik, #lldb, JDevlieghere

Reviewed By: JDevlieghere

Subscribers: arsenm, jvesely, nhaehnle, hiraditya, JDevlieghere, teemperor, rnkovacs, emaste, kubamracek, nemanjai, ki.stfu, javed.absar, arichardson, kbarton, jrtc27, MaskRay, atanasyan, dexonsmith, arphaman, jfb, jsji, jdoerfert, lldb-commits, llvm-commits

Tags: #lldb, #llvm

Differential Revision: https://reviews.llvm.org/D61847

llvm-svn: 361484
This commit is contained in:
Konrad Kleine
2019-05-23 11:14:47 +00:00
parent 32d976bac1
commit 248a13057a
250 changed files with 1487 additions and 1461 deletions

View File

@@ -28,7 +28,7 @@ using namespace lldb_private;
// PlatformConnectOptions
struct PlatformConnectOptions {
PlatformConnectOptions(const char *url = NULL)
PlatformConnectOptions(const char *url = nullptr)
: m_url(), m_rsync_options(), m_rsync_remote_path_prefix(),
m_rsync_enabled(false), m_rsync_omit_hostname_from_remote_path(false),
m_local_cache_directory() {
@@ -48,7 +48,7 @@ struct PlatformConnectOptions {
// PlatformShellCommand
struct PlatformShellCommand {
PlatformShellCommand(const char *shell_command = NULL)
PlatformShellCommand(const char *shell_command = nullptr)
: m_command(), m_working_dir(), m_status(0), m_signo(0) {
if (shell_command && shell_command[0])
m_command = shell_command;
@@ -94,7 +94,7 @@ const char *SBPlatformConnectOptions::GetURL() {
LLDB_RECORD_METHOD_NO_ARGS(const char *, SBPlatformConnectOptions, GetURL);
if (m_opaque_ptr->m_url.empty())
return NULL;
return nullptr;
return m_opaque_ptr->m_url.c_str();
}
@@ -188,7 +188,7 @@ const char *SBPlatformShellCommand::GetCommand() {
LLDB_RECORD_METHOD_NO_ARGS(const char *, SBPlatformShellCommand, GetCommand);
if (m_opaque_ptr->m_command.empty())
return NULL;
return nullptr;
return m_opaque_ptr->m_command.c_str();
}
@@ -207,7 +207,7 @@ const char *SBPlatformShellCommand::GetWorkingDirectory() {
GetWorkingDirectory);
if (m_opaque_ptr->m_working_dir.empty())
return NULL;
return nullptr;
return m_opaque_ptr->m_working_dir.c_str();
}
@@ -256,7 +256,7 @@ const char *SBPlatformShellCommand::GetOutput() {
LLDB_RECORD_METHOD_NO_ARGS(const char *, SBPlatformShellCommand, GetOutput);
if (m_opaque_ptr->m_output.empty())
return NULL;
return nullptr;
return m_opaque_ptr->m_output.c_str();
}
@@ -282,7 +282,7 @@ bool SBPlatform::IsValid() const {
SBPlatform::operator bool() const {
LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBPlatform, operator bool);
return m_opaque_sp.get() != NULL;
return m_opaque_sp.get() != nullptr;
}
void SBPlatform::Clear() {
@@ -297,7 +297,7 @@ const char *SBPlatform::GetName() {
PlatformSP platform_sp(GetSP());
if (platform_sp)
return platform_sp->GetName().GetCString();
return NULL;
return nullptr;
}
lldb::PlatformSP SBPlatform::GetSP() const { return m_opaque_sp; }
@@ -312,7 +312,7 @@ const char *SBPlatform::GetWorkingDirectory() {
PlatformSP platform_sp(GetSP());
if (platform_sp)
return platform_sp->GetWorkingDirectory().GetCString();
return NULL;
return nullptr;
}
bool SBPlatform::SetWorkingDirectory(const char *path) {
@@ -376,7 +376,7 @@ const char *SBPlatform::GetTriple() {
return ConstString(arch.GetTriple().getTriple().c_str()).GetCString();
}
}
return NULL;
return nullptr;
}
const char *SBPlatform::GetOSBuild() {
@@ -393,7 +393,7 @@ const char *SBPlatform::GetOSBuild() {
}
}
}
return NULL;
return nullptr;
}
const char *SBPlatform::GetOSDescription() {
@@ -410,7 +410,7 @@ const char *SBPlatform::GetOSDescription() {
}
}
}
return NULL;
return nullptr;
}
const char *SBPlatform::GetHostname() {
@@ -419,7 +419,7 @@ const char *SBPlatform::GetHostname() {
PlatformSP platform_sp(GetSP());
if (platform_sp)
return platform_sp->GetHostname();
return NULL;
return nullptr;
}
uint32_t SBPlatform::GetOSMajorVersion() {
@@ -513,7 +513,7 @@ SBError SBPlatform::Run(SBPlatformShellCommand &shell_command) {
return Status("invalid shell command (empty)");
const char *working_dir = shell_command.GetWorkingDirectory();
if (working_dir == NULL) {
if (working_dir == nullptr) {
working_dir = platform_sp->GetWorkingDirectory().GetCString();
if (working_dir)
shell_command.SetWorkingDirectory(working_dir);