[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
diff --git a/lldb/source/Plugins/ObjectFile/ELF/ELFHeader.cpp b/lldb/source/Plugins/ObjectFile/ELF/ELFHeader.cpp
index 7f9665a..aa987107 100644
--- a/lldb/source/Plugins/ObjectFile/ELF/ELFHeader.cpp
+++ b/lldb/source/Plugins/ObjectFile/ELF/ELFHeader.cpp
@@ -114,7 +114,7 @@
bool ELFHeader::Parse(lldb_private::DataExtractor &data,
lldb::offset_t *offset) {
// Read e_ident. This provides byte order and address size info.
- if (data.GetU8(offset, &e_ident, EI_NIDENT) == NULL)
+ if (data.GetU8(offset, &e_ident, EI_NIDENT) == nullptr)
return false;
const unsigned byte_size = Is32Bit() ? 4 : 8;
@@ -122,11 +122,11 @@
data.SetAddressByteSize(byte_size);
// Read e_type and e_machine.
- if (data.GetU16(offset, &e_type, 2) == NULL)
+ if (data.GetU16(offset, &e_type, 2) == nullptr)
return false;
// Read e_version.
- if (data.GetU32(offset, &e_version, 1) == NULL)
+ if (data.GetU32(offset, &e_version, 1) == nullptr)
return false;
// Read e_entry, e_phoff and e_shoff.
@@ -134,11 +134,11 @@
return false;
// Read e_flags.
- if (data.GetU32(offset, &e_flags, 1) == NULL)
+ if (data.GetU32(offset, &e_flags, 1) == nullptr)
return false;
// Read e_ehsize, e_phentsize, e_phnum, e_shentsize, e_shnum and e_shstrndx.
- if (data.GetU16(offset, &e_ehsize, 6) == NULL)
+ if (data.GetU16(offset, &e_ehsize, 6) == nullptr)
return false;
// Initialize e_phnum, e_shnum, and e_shstrndx with the values read from the
@@ -224,7 +224,7 @@
const unsigned byte_size = data.GetAddressByteSize();
// Read sh_name and sh_type.
- if (data.GetU32(offset, &sh_name, 2) == NULL)
+ if (data.GetU32(offset, &sh_name, 2) == nullptr)
return false;
// Read sh_flags.
@@ -236,7 +236,7 @@
return false;
// Read sh_link and sh_info.
- if (data.GetU32(offset, &sh_link, 2) == NULL)
+ if (data.GetU32(offset, &sh_link, 2) == nullptr)
return false;
// Read sh_addralign and sh_entsize.
@@ -322,7 +322,7 @@
const bool parsing_32 = byte_size == 4;
// Read st_name.
- if (data.GetU32(offset, &st_name, 1) == NULL)
+ if (data.GetU32(offset, &st_name, 1) == nullptr)
return false;
if (parsing_32) {
@@ -331,23 +331,23 @@
return false;
// Read st_info and st_other.
- if (data.GetU8(offset, &st_info, 2) == NULL)
+ if (data.GetU8(offset, &st_info, 2) == nullptr)
return false;
// Read st_shndx.
- if (data.GetU16(offset, &st_shndx, 1) == NULL)
+ if (data.GetU16(offset, &st_shndx, 1) == nullptr)
return false;
} else {
// Read st_info and st_other.
- if (data.GetU8(offset, &st_info, 2) == NULL)
+ if (data.GetU8(offset, &st_info, 2) == nullptr)
return false;
// Read st_shndx.
- if (data.GetU16(offset, &st_shndx, 1) == NULL)
+ if (data.GetU16(offset, &st_shndx, 1) == nullptr)
return false;
// Read st_value and st_size.
- if (data.GetU64(offset, &st_value, 2) == NULL)
+ if (data.GetU64(offset, &st_value, 2) == nullptr)
return false;
}
return true;
@@ -365,7 +365,7 @@
const bool parsing_32 = byte_size == 4;
// Read p_type;
- if (data.GetU32(offset, &p_type, 1) == NULL)
+ if (data.GetU32(offset, &p_type, 1) == nullptr)
return false;
if (parsing_32) {
@@ -374,7 +374,7 @@
return false;
// Read p_flags.
- if (data.GetU32(offset, &p_flags, 1) == NULL)
+ if (data.GetU32(offset, &p_flags, 1) == nullptr)
return false;
// Read p_align.
@@ -382,7 +382,7 @@
return false;
} else {
// Read p_flags.
- if (data.GetU32(offset, &p_flags, 1) == NULL)
+ if (data.GetU32(offset, &p_flags, 1) == nullptr)
return false;
// Read p_offset, p_vaddr, p_paddr, p_filesz, p_memsz and p_align.
diff --git a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
index 0040599..bc80204 100644
--- a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
+++ b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
@@ -162,7 +162,7 @@
reloc = new ELFRela();
else {
assert(false && "unexpected relocation type");
- reloc = static_cast<ELFRel *>(NULL);
+ reloc = static_cast<ELFRel *>(nullptr);
}
}
@@ -243,7 +243,7 @@
bool ELFNote::Parse(const DataExtractor &data, lldb::offset_t *offset) {
// Read all fields.
- if (data.GetU32(offset, &n_namesz, 3) == NULL)
+ if (data.GetU32(offset, &n_namesz, 3) == nullptr)
return false;
// The name field is required to be nul-terminated, and n_namesz includes the
@@ -262,7 +262,7 @@
}
const char *cstr = data.GetCStr(offset, llvm::alignTo(n_namesz, 4));
- if (cstr == NULL) {
+ if (cstr == nullptr) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SYMBOLS));
if (log)
log->Printf("Failed to parse note name lacking nul terminator");
@@ -396,7 +396,7 @@
return objfile_up.release();
}
- return NULL;
+ return nullptr;
}
ObjectFile *ObjectFileELF::CreateMemoryInstance(
@@ -415,7 +415,7 @@
}
}
}
- return NULL;
+ return nullptr;
}
bool ObjectFileELF::MagicBytesMatch(DataBufferSP &data_sp,
@@ -1656,12 +1656,12 @@
const ObjectFileELF::ELFSectionHeaderInfo *
ObjectFileELF::GetSectionHeaderByIndex(lldb::user_id_t id) {
if (!ParseSectionHeaders())
- return NULL;
+ return nullptr;
if (id < m_section_headers.size())
return &m_section_headers[id];
- return NULL;
+ return nullptr;
}
lldb::user_id_t ObjectFileELF::GetSectionIndexByName(const char *name) {
@@ -2376,7 +2376,7 @@
const ELFDynamic *ObjectFileELF::FindDynamicSymbol(unsigned tag) {
if (!ParseDynamicSymbols())
- return NULL;
+ return nullptr;
DynamicSymbolCollIter I = m_dynamic_symbols.begin();
DynamicSymbolCollIter E = m_dynamic_symbols.end();
@@ -2387,7 +2387,7 @@
return symbol;
}
- return NULL;
+ return nullptr;
}
unsigned ObjectFileELF::PLTRelocationType() {
@@ -2604,7 +2604,7 @@
if (!rel.Parse(rel_data, &offset))
break;
- Symbol *symbol = NULL;
+ Symbol *symbol = nullptr;
if (hdr->Is32Bit()) {
switch (reloc_type(rel)) {
@@ -2723,7 +2723,7 @@
Symtab *ObjectFileELF::GetSymtab() {
ModuleSP module_sp(GetModule());
if (!module_sp)
- return NULL;
+ return nullptr;
// We always want to use the main object file so we (hopefully) only have one
// cached copy of our symtab, dynamic sections, etc.
@@ -2731,10 +2731,10 @@
if (module_obj_file && module_obj_file != this)
return module_obj_file->GetSymtab();
- if (m_symtab_up == NULL) {
+ if (m_symtab_up == nullptr) {
SectionList *section_list = module_sp->GetSectionList();
if (!section_list)
- return NULL;
+ return nullptr;
uint64_t symbol_id = 0;
std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex());
@@ -2934,10 +2934,10 @@
s->EOL();
SectionList *section_list = GetSectionList();
if (section_list)
- section_list->Dump(s, NULL, true, UINT32_MAX);
+ section_list->Dump(s, nullptr, true, UINT32_MAX);
Symtab *symtab = GetSymtab();
if (symtab)
- symtab->Dump(s, NULL, eSortOrderNone);
+ symtab->Dump(s, nullptr, eSortOrderNone);
s->EOL();
DumpDependentModules(s);
s->EOL();
diff --git a/lldb/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp b/lldb/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp
index ad15f96..7d7453c 100644
--- a/lldb/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp
+++ b/lldb/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp
@@ -66,7 +66,7 @@
lldb::offset_t length) {
// JIT'ed object file is backed by the ObjectFileJITDelegate, never read from
// a file
- return NULL;
+ return nullptr;
}
ObjectFile *ObjectFileJIT::CreateMemoryInstance(const lldb::ModuleSP &module_sp,
@@ -75,7 +75,7 @@
lldb::addr_t header_addr) {
// JIT'ed object file is backed by the ObjectFileJITDelegate, never read from
// memory
- return NULL;
+ return nullptr;
}
size_t ObjectFileJIT::GetModuleSpecifications(
@@ -88,7 +88,7 @@
ObjectFileJIT::ObjectFileJIT(const lldb::ModuleSP &module_sp,
const ObjectFileJITDelegateSP &delegate_sp)
- : ObjectFile(module_sp, NULL, 0, 0, DataBufferSP(), 0), m_delegate_wp() {
+ : ObjectFile(module_sp, nullptr, 0, 0, DataBufferSP(), 0), m_delegate_wp() {
if (delegate_sp) {
m_delegate_wp = delegate_sp;
m_data.SetByteOrder(delegate_sp->GetByteOrder());
@@ -115,7 +115,7 @@
ModuleSP module_sp(GetModule());
if (module_sp) {
std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex());
- if (m_symtab_up == NULL) {
+ if (m_symtab_up == nullptr) {
m_symtab_up.reset(new Symtab(this));
std::lock_guard<std::recursive_mutex> symtab_guard(
m_symtab_up->GetMutex());
@@ -159,10 +159,10 @@
SectionList *sections = GetSectionList();
if (sections)
- sections->Dump(s, NULL, true, UINT32_MAX);
+ sections->Dump(s, nullptr, true, UINT32_MAX);
if (m_symtab_up)
- m_symtab_up->Dump(s, NULL, eSortOrderNone);
+ m_symtab_up->Dump(s, nullptr, eSortOrderNone);
}
}
diff --git a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
index b6db8d7..62991dc 100644
--- a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
+++ b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
@@ -173,7 +173,7 @@
const char *alt_name, size_t reg_byte_size,
Stream &data) {
const RegisterInfo *reg_info = reg_ctx->GetRegisterInfoByName(name);
- if (reg_info == NULL)
+ if (reg_info == nullptr)
reg_info = reg_ctx->GetRegisterInfoByName(alt_name);
if (reg_info) {
lldb_private::RegisterValue reg_value;
@@ -202,27 +202,27 @@
data.PutHex32(GPRRegSet); // Flavor
data.PutHex32(GPRWordCount);
- WriteRegister(reg_ctx, "rax", NULL, 8, data);
- WriteRegister(reg_ctx, "rbx", NULL, 8, data);
- WriteRegister(reg_ctx, "rcx", NULL, 8, data);
- WriteRegister(reg_ctx, "rdx", NULL, 8, data);
- WriteRegister(reg_ctx, "rdi", NULL, 8, data);
- WriteRegister(reg_ctx, "rsi", NULL, 8, data);
- WriteRegister(reg_ctx, "rbp", NULL, 8, data);
- WriteRegister(reg_ctx, "rsp", NULL, 8, data);
- WriteRegister(reg_ctx, "r8", NULL, 8, data);
- WriteRegister(reg_ctx, "r9", NULL, 8, data);
- WriteRegister(reg_ctx, "r10", NULL, 8, data);
- WriteRegister(reg_ctx, "r11", NULL, 8, data);
- WriteRegister(reg_ctx, "r12", NULL, 8, data);
- WriteRegister(reg_ctx, "r13", NULL, 8, data);
- WriteRegister(reg_ctx, "r14", NULL, 8, data);
- WriteRegister(reg_ctx, "r15", NULL, 8, data);
- WriteRegister(reg_ctx, "rip", NULL, 8, data);
- WriteRegister(reg_ctx, "rflags", NULL, 8, data);
- WriteRegister(reg_ctx, "cs", NULL, 8, data);
- WriteRegister(reg_ctx, "fs", NULL, 8, data);
- WriteRegister(reg_ctx, "gs", NULL, 8, data);
+ WriteRegister(reg_ctx, "rax", nullptr, 8, data);
+ WriteRegister(reg_ctx, "rbx", nullptr, 8, data);
+ WriteRegister(reg_ctx, "rcx", nullptr, 8, data);
+ WriteRegister(reg_ctx, "rdx", nullptr, 8, data);
+ WriteRegister(reg_ctx, "rdi", nullptr, 8, data);
+ WriteRegister(reg_ctx, "rsi", nullptr, 8, data);
+ WriteRegister(reg_ctx, "rbp", nullptr, 8, data);
+ WriteRegister(reg_ctx, "rsp", nullptr, 8, data);
+ WriteRegister(reg_ctx, "r8", nullptr, 8, data);
+ WriteRegister(reg_ctx, "r9", nullptr, 8, data);
+ WriteRegister(reg_ctx, "r10", nullptr, 8, data);
+ WriteRegister(reg_ctx, "r11", nullptr, 8, data);
+ WriteRegister(reg_ctx, "r12", nullptr, 8, data);
+ WriteRegister(reg_ctx, "r13", nullptr, 8, data);
+ WriteRegister(reg_ctx, "r14", nullptr, 8, data);
+ WriteRegister(reg_ctx, "r15", nullptr, 8, data);
+ WriteRegister(reg_ctx, "rip", nullptr, 8, data);
+ WriteRegister(reg_ctx, "rflags", nullptr, 8, data);
+ WriteRegister(reg_ctx, "cs", nullptr, 8, data);
+ WriteRegister(reg_ctx, "fs", nullptr, 8, data);
+ WriteRegister(reg_ctx, "gs", nullptr, 8, data);
// // Write out the FPU registers
// const size_t fpu_byte_size = sizeof(FPU);
@@ -311,9 +311,9 @@
// Write out the EXC registers
data.PutHex32(EXCRegSet);
data.PutHex32(EXCWordCount);
- WriteRegister(reg_ctx, "trapno", NULL, 4, data);
- WriteRegister(reg_ctx, "err", NULL, 4, data);
- WriteRegister(reg_ctx, "faultvaddr", NULL, 8, data);
+ WriteRegister(reg_ctx, "trapno", nullptr, 4, data);
+ WriteRegister(reg_ctx, "err", nullptr, 4, data);
+ WriteRegister(reg_ctx, "faultvaddr", nullptr, 8, data);
return true;
}
return false;
@@ -404,7 +404,7 @@
const char *alt_name, size_t reg_byte_size,
Stream &data) {
const RegisterInfo *reg_info = reg_ctx->GetRegisterInfoByName(name);
- if (reg_info == NULL)
+ if (reg_info == nullptr)
reg_info = reg_ctx->GetRegisterInfoByName(alt_name);
if (reg_info) {
lldb_private::RegisterValue reg_value;
@@ -433,29 +433,29 @@
data.PutHex32(GPRRegSet); // Flavor
data.PutHex32(GPRWordCount);
- WriteRegister(reg_ctx, "eax", NULL, 4, data);
- WriteRegister(reg_ctx, "ebx", NULL, 4, data);
- WriteRegister(reg_ctx, "ecx", NULL, 4, data);
- WriteRegister(reg_ctx, "edx", NULL, 4, data);
- WriteRegister(reg_ctx, "edi", NULL, 4, data);
- WriteRegister(reg_ctx, "esi", NULL, 4, data);
- WriteRegister(reg_ctx, "ebp", NULL, 4, data);
- WriteRegister(reg_ctx, "esp", NULL, 4, data);
- WriteRegister(reg_ctx, "ss", NULL, 4, data);
- WriteRegister(reg_ctx, "eflags", NULL, 4, data);
- WriteRegister(reg_ctx, "eip", NULL, 4, data);
- WriteRegister(reg_ctx, "cs", NULL, 4, data);
- WriteRegister(reg_ctx, "ds", NULL, 4, data);
- WriteRegister(reg_ctx, "es", NULL, 4, data);
- WriteRegister(reg_ctx, "fs", NULL, 4, data);
- WriteRegister(reg_ctx, "gs", NULL, 4, data);
+ WriteRegister(reg_ctx, "eax", nullptr, 4, data);
+ WriteRegister(reg_ctx, "ebx", nullptr, 4, data);
+ WriteRegister(reg_ctx, "ecx", nullptr, 4, data);
+ WriteRegister(reg_ctx, "edx", nullptr, 4, data);
+ WriteRegister(reg_ctx, "edi", nullptr, 4, data);
+ WriteRegister(reg_ctx, "esi", nullptr, 4, data);
+ WriteRegister(reg_ctx, "ebp", nullptr, 4, data);
+ WriteRegister(reg_ctx, "esp", nullptr, 4, data);
+ WriteRegister(reg_ctx, "ss", nullptr, 4, data);
+ WriteRegister(reg_ctx, "eflags", nullptr, 4, data);
+ WriteRegister(reg_ctx, "eip", nullptr, 4, data);
+ WriteRegister(reg_ctx, "cs", nullptr, 4, data);
+ WriteRegister(reg_ctx, "ds", nullptr, 4, data);
+ WriteRegister(reg_ctx, "es", nullptr, 4, data);
+ WriteRegister(reg_ctx, "fs", nullptr, 4, data);
+ WriteRegister(reg_ctx, "gs", nullptr, 4, data);
// Write out the EXC registers
data.PutHex32(EXCRegSet);
data.PutHex32(EXCWordCount);
- WriteRegister(reg_ctx, "trapno", NULL, 4, data);
- WriteRegister(reg_ctx, "err", NULL, 4, data);
- WriteRegister(reg_ctx, "faultvaddr", NULL, 4, data);
+ WriteRegister(reg_ctx, "trapno", nullptr, 4, data);
+ WriteRegister(reg_ctx, "err", nullptr, 4, data);
+ WriteRegister(reg_ctx, "faultvaddr", nullptr, 4, data);
return true;
}
return false;
@@ -555,7 +555,7 @@
const char *alt_name, size_t reg_byte_size,
Stream &data) {
const RegisterInfo *reg_info = reg_ctx->GetRegisterInfoByName(name);
- if (reg_info == NULL)
+ if (reg_info == nullptr)
reg_info = reg_ctx->GetRegisterInfoByName(alt_name);
if (reg_info) {
lldb_private::RegisterValue reg_value;
@@ -584,23 +584,23 @@
data.PutHex32(GPRRegSet); // Flavor
data.PutHex32(GPRWordCount);
- WriteRegister(reg_ctx, "r0", NULL, 4, data);
- WriteRegister(reg_ctx, "r1", NULL, 4, data);
- WriteRegister(reg_ctx, "r2", NULL, 4, data);
- WriteRegister(reg_ctx, "r3", NULL, 4, data);
- WriteRegister(reg_ctx, "r4", NULL, 4, data);
- WriteRegister(reg_ctx, "r5", NULL, 4, data);
- WriteRegister(reg_ctx, "r6", NULL, 4, data);
- WriteRegister(reg_ctx, "r7", NULL, 4, data);
- WriteRegister(reg_ctx, "r8", NULL, 4, data);
- WriteRegister(reg_ctx, "r9", NULL, 4, data);
- WriteRegister(reg_ctx, "r10", NULL, 4, data);
- WriteRegister(reg_ctx, "r11", NULL, 4, data);
- WriteRegister(reg_ctx, "r12", NULL, 4, data);
- WriteRegister(reg_ctx, "sp", NULL, 4, data);
- WriteRegister(reg_ctx, "lr", NULL, 4, data);
- WriteRegister(reg_ctx, "pc", NULL, 4, data);
- WriteRegister(reg_ctx, "cpsr", NULL, 4, data);
+ WriteRegister(reg_ctx, "r0", nullptr, 4, data);
+ WriteRegister(reg_ctx, "r1", nullptr, 4, data);
+ WriteRegister(reg_ctx, "r2", nullptr, 4, data);
+ WriteRegister(reg_ctx, "r3", nullptr, 4, data);
+ WriteRegister(reg_ctx, "r4", nullptr, 4, data);
+ WriteRegister(reg_ctx, "r5", nullptr, 4, data);
+ WriteRegister(reg_ctx, "r6", nullptr, 4, data);
+ WriteRegister(reg_ctx, "r7", nullptr, 4, data);
+ WriteRegister(reg_ctx, "r8", nullptr, 4, data);
+ WriteRegister(reg_ctx, "r9", nullptr, 4, data);
+ WriteRegister(reg_ctx, "r10", nullptr, 4, data);
+ WriteRegister(reg_ctx, "r11", nullptr, 4, data);
+ WriteRegister(reg_ctx, "r12", nullptr, 4, data);
+ WriteRegister(reg_ctx, "sp", nullptr, 4, data);
+ WriteRegister(reg_ctx, "lr", nullptr, 4, data);
+ WriteRegister(reg_ctx, "pc", nullptr, 4, data);
+ WriteRegister(reg_ctx, "cpsr", nullptr, 4, data);
// Write out the EXC registers
// data.PutHex32 (EXCRegSet);
@@ -710,7 +710,7 @@
const char *alt_name, size_t reg_byte_size,
Stream &data) {
const RegisterInfo *reg_info = reg_ctx->GetRegisterInfoByName(name);
- if (reg_info == NULL)
+ if (reg_info == nullptr)
reg_info = reg_ctx->GetRegisterInfoByName(alt_name);
if (reg_info) {
lldb_private::RegisterValue reg_value;
@@ -739,40 +739,40 @@
data.PutHex32(GPRRegSet); // Flavor
data.PutHex32(GPRWordCount);
- WriteRegister(reg_ctx, "x0", NULL, 8, data);
- WriteRegister(reg_ctx, "x1", NULL, 8, data);
- WriteRegister(reg_ctx, "x2", NULL, 8, data);
- WriteRegister(reg_ctx, "x3", NULL, 8, data);
- WriteRegister(reg_ctx, "x4", NULL, 8, data);
- WriteRegister(reg_ctx, "x5", NULL, 8, data);
- WriteRegister(reg_ctx, "x6", NULL, 8, data);
- WriteRegister(reg_ctx, "x7", NULL, 8, data);
- WriteRegister(reg_ctx, "x8", NULL, 8, data);
- WriteRegister(reg_ctx, "x9", NULL, 8, data);
- WriteRegister(reg_ctx, "x10", NULL, 8, data);
- WriteRegister(reg_ctx, "x11", NULL, 8, data);
- WriteRegister(reg_ctx, "x12", NULL, 8, data);
- WriteRegister(reg_ctx, "x13", NULL, 8, data);
- WriteRegister(reg_ctx, "x14", NULL, 8, data);
- WriteRegister(reg_ctx, "x15", NULL, 8, data);
- WriteRegister(reg_ctx, "x16", NULL, 8, data);
- WriteRegister(reg_ctx, "x17", NULL, 8, data);
- WriteRegister(reg_ctx, "x18", NULL, 8, data);
- WriteRegister(reg_ctx, "x19", NULL, 8, data);
- WriteRegister(reg_ctx, "x20", NULL, 8, data);
- WriteRegister(reg_ctx, "x21", NULL, 8, data);
- WriteRegister(reg_ctx, "x22", NULL, 8, data);
- WriteRegister(reg_ctx, "x23", NULL, 8, data);
- WriteRegister(reg_ctx, "x24", NULL, 8, data);
- WriteRegister(reg_ctx, "x25", NULL, 8, data);
- WriteRegister(reg_ctx, "x26", NULL, 8, data);
- WriteRegister(reg_ctx, "x27", NULL, 8, data);
- WriteRegister(reg_ctx, "x28", NULL, 8, data);
- WriteRegister(reg_ctx, "fp", NULL, 8, data);
- WriteRegister(reg_ctx, "lr", NULL, 8, data);
- WriteRegister(reg_ctx, "sp", NULL, 8, data);
- WriteRegister(reg_ctx, "pc", NULL, 8, data);
- WriteRegister(reg_ctx, "cpsr", NULL, 4, data);
+ WriteRegister(reg_ctx, "x0", nullptr, 8, data);
+ WriteRegister(reg_ctx, "x1", nullptr, 8, data);
+ WriteRegister(reg_ctx, "x2", nullptr, 8, data);
+ WriteRegister(reg_ctx, "x3", nullptr, 8, data);
+ WriteRegister(reg_ctx, "x4", nullptr, 8, data);
+ WriteRegister(reg_ctx, "x5", nullptr, 8, data);
+ WriteRegister(reg_ctx, "x6", nullptr, 8, data);
+ WriteRegister(reg_ctx, "x7", nullptr, 8, data);
+ WriteRegister(reg_ctx, "x8", nullptr, 8, data);
+ WriteRegister(reg_ctx, "x9", nullptr, 8, data);
+ WriteRegister(reg_ctx, "x10", nullptr, 8, data);
+ WriteRegister(reg_ctx, "x11", nullptr, 8, data);
+ WriteRegister(reg_ctx, "x12", nullptr, 8, data);
+ WriteRegister(reg_ctx, "x13", nullptr, 8, data);
+ WriteRegister(reg_ctx, "x14", nullptr, 8, data);
+ WriteRegister(reg_ctx, "x15", nullptr, 8, data);
+ WriteRegister(reg_ctx, "x16", nullptr, 8, data);
+ WriteRegister(reg_ctx, "x17", nullptr, 8, data);
+ WriteRegister(reg_ctx, "x18", nullptr, 8, data);
+ WriteRegister(reg_ctx, "x19", nullptr, 8, data);
+ WriteRegister(reg_ctx, "x20", nullptr, 8, data);
+ WriteRegister(reg_ctx, "x21", nullptr, 8, data);
+ WriteRegister(reg_ctx, "x22", nullptr, 8, data);
+ WriteRegister(reg_ctx, "x23", nullptr, 8, data);
+ WriteRegister(reg_ctx, "x24", nullptr, 8, data);
+ WriteRegister(reg_ctx, "x25", nullptr, 8, data);
+ WriteRegister(reg_ctx, "x26", nullptr, 8, data);
+ WriteRegister(reg_ctx, "x27", nullptr, 8, data);
+ WriteRegister(reg_ctx, "x28", nullptr, 8, data);
+ WriteRegister(reg_ctx, "fp", nullptr, 8, data);
+ WriteRegister(reg_ctx, "lr", nullptr, 8, data);
+ WriteRegister(reg_ctx, "sp", nullptr, 8, data);
+ WriteRegister(reg_ctx, "pc", nullptr, 8, data);
+ WriteRegister(reg_ctx, "cpsr", nullptr, 4, data);
// Write out the EXC registers
// data.PutHex32 (EXCRegSet);
@@ -889,7 +889,7 @@
if (objfile_up.get() && objfile_up->ParseHeader())
return objfile_up.release();
}
- return NULL;
+ return nullptr;
}
size_t ObjectFileMachO::GetModuleSpecifications(
@@ -1312,7 +1312,7 @@
ModuleSP module_sp(GetModule());
if (module_sp) {
std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex());
- if (m_symtab_up == NULL) {
+ if (m_symtab_up == nullptr) {
m_symtab_up.reset(new Symtab(this));
std::lock_guard<std::recursive_mutex> symtab_guard(
m_symtab_up->GetMutex());
@@ -1332,14 +1332,14 @@
const lldb::offset_t load_cmd_offset = offset;
load_command lc;
- if (m_data.GetU32(&offset, &lc.cmd, 2) == NULL)
+ if (m_data.GetU32(&offset, &lc.cmd, 2) == nullptr)
break;
if (lc.cmd == LC_DYSYMTAB) {
m_dysymtab.cmd = lc.cmd;
m_dysymtab.cmdsize = lc.cmdsize;
if (m_data.GetU32(&offset, &m_dysymtab.ilocalsym,
(sizeof(m_dysymtab) / sizeof(uint32_t)) - 2) ==
- NULL) {
+ nullptr) {
// Clear m_dysymtab if we were unable to read all items from the
// load command
::memset(&m_dysymtab, 0, sizeof(m_dysymtab));
@@ -1361,7 +1361,7 @@
encryption_info_command encryption_cmd;
for (uint32_t i = 0; i < m_header.ncmds; ++i) {
const lldb::offset_t load_cmd_offset = offset;
- if (m_data.GetU32(&offset, &encryption_cmd, 2) == NULL)
+ if (m_data.GetU32(&offset, &encryption_cmd, 2) == nullptr)
break;
// LC_ENCRYPTION_INFO and LC_ENCRYPTION_INFO_64 have the same sizes for the
@@ -1713,15 +1713,15 @@
for (segment_sect_idx = 0; segment_sect_idx < load_cmd.nsects;
++segment_sect_idx) {
if (m_data.GetU8(&offset, (uint8_t *)sect64.sectname,
- sizeof(sect64.sectname)) == NULL)
+ sizeof(sect64.sectname)) == nullptr)
break;
if (m_data.GetU8(&offset, (uint8_t *)sect64.segname,
- sizeof(sect64.segname)) == NULL)
+ sizeof(sect64.segname)) == nullptr)
break;
sect64.addr = m_data.GetAddress(&offset);
sect64.size = m_data.GetAddress(&offset);
- if (m_data.GetU32(&offset, §64.offset, num_u32s) == NULL)
+ if (m_data.GetU32(&offset, §64.offset, num_u32s) == nullptr)
break;
// Keep a list of mach sections around in case we need to get at data that
@@ -1830,7 +1830,7 @@
bool section_is_encrypted = false;
if (!segment_is_encrypted && load_cmd.filesize != 0)
section_is_encrypted = context.EncryptedRanges.FindEntryThatContains(
- sect64.offset) != NULL;
+ sect64.offset) != nullptr;
section_sp->SetIsEncrypted(segment_is_encrypted || section_is_encrypted);
section_sp->SetPermissions(segment_permissions);
@@ -1856,7 +1856,7 @@
if (curr_section_sp.get()) {
if (curr_section_sp->GetByteSize() == 0) {
- if (next_section_sp.get() != NULL)
+ if (next_section_sp.get() != nullptr)
curr_section_sp->SetByteSize(next_section_sp->GetFileAddress() -
curr_section_sp->GetFileAddress());
else
@@ -1892,7 +1892,7 @@
struct load_command load_cmd;
for (uint32_t i = 0; i < m_header.ncmds; ++i) {
const lldb::offset_t load_cmd_offset = offset;
- if (m_data.GetU32(&offset, &load_cmd, 2) == NULL)
+ if (m_data.GetU32(&offset, &load_cmd, 2) == nullptr)
break;
if (load_cmd.cmd == LC_SEGMENT || load_cmd.cmd == LC_SEGMENT_64)
@@ -2021,7 +2021,7 @@
if (terminalSize != 0) {
TrieEntryWithOffset e(offset);
e.entry.flags = data.GetULEB128(&offset);
- const char *import_name = NULL;
+ const char *import_name = nullptr;
if (e.entry.flags & EXPORT_SYMBOL_FLAGS_REEXPORT) {
e.entry.address = 0;
e.entry.other = data.GetULEB128(&offset); // dylib ordinal
@@ -2129,7 +2129,7 @@
const lldb::offset_t cmd_offset = offset;
// Read in the load command and load command size
struct load_command lc;
- if (m_data.GetU32(&offset, &lc, 2) == NULL)
+ if (m_data.GetU32(&offset, &lc, 2) == nullptr)
break;
// Watch for the symbol table load command
switch (lc.cmd) {
@@ -2138,7 +2138,7 @@
symtab_load_command.cmdsize = lc.cmdsize;
// Read in the rest of the symtab load command
if (m_data.GetU32(&offset, &symtab_load_command.symoff, 4) ==
- 0) // fill in symoff, nsyms, stroff, strsize fields
+ nullptr) // fill in symoff, nsyms, stroff, strsize fields
return 0;
if (symtab_load_command.symoff == 0) {
if (log)
@@ -2201,7 +2201,7 @@
function_starts_load_command.cmd = lc.cmd;
function_starts_load_command.cmdsize = lc.cmdsize;
if (m_data.GetU32(&offset, &function_starts_load_command.dataoff, 2) ==
- NULL) // fill in symoff, nsyms, stroff, strsize fields
+ nullptr) // fill in symoff, nsyms, stroff, strsize fields
memset(&function_starts_load_command, 0,
sizeof(function_starts_load_command));
break;
@@ -2215,7 +2215,7 @@
if (symtab_load_command.cmd) {
Symtab *symtab = m_symtab_up.get();
SectionList *section_list = GetSectionList();
- if (section_list == NULL)
+ if (section_list == nullptr)
return 0;
const uint32_t addr_byte_size = m_data.GetAddressByteSize();
@@ -2224,12 +2224,12 @@
const size_t nlist_byte_size =
bit_width_32 ? sizeof(struct nlist) : sizeof(struct nlist_64);
- DataExtractor nlist_data(NULL, 0, byte_order, addr_byte_size);
- DataExtractor strtab_data(NULL, 0, byte_order, addr_byte_size);
- DataExtractor function_starts_data(NULL, 0, byte_order, addr_byte_size);
- DataExtractor indirect_symbol_index_data(NULL, 0, byte_order,
+ DataExtractor nlist_data(nullptr, 0, byte_order, addr_byte_size);
+ DataExtractor strtab_data(nullptr, 0, byte_order, addr_byte_size);
+ DataExtractor function_starts_data(nullptr, 0, byte_order, addr_byte_size);
+ DataExtractor indirect_symbol_index_data(nullptr, 0, byte_order,
addr_byte_size);
- DataExtractor dyld_trie_data(NULL, 0, byte_order, addr_byte_size);
+ DataExtractor dyld_trie_data(nullptr, 0, byte_order, addr_byte_size);
const addr_t nlist_data_byte_size =
symtab_load_command.nsyms * nlist_byte_size;
@@ -2550,10 +2550,10 @@
// so we know
NListIndexToSymbolIndexMap m_nlist_idx_to_sym_idx;
uint32_t nlist_idx = 0;
- Symbol *symbol_ptr = NULL;
+ Symbol *symbol_ptr = nullptr;
uint32_t sym_idx = 0;
- Symbol *sym = NULL;
+ Symbol *sym = nullptr;
size_t num_syms = 0;
std::string memory_symbol_name;
uint32_t unmapped_local_symbols_found = 0;
@@ -3749,7 +3749,7 @@
// If the sym array was not created while parsing the DSC unmapped
// symbols, create it now.
- if (sym == NULL) {
+ if (sym == nullptr) {
sym = symtab->Resize(symtab_load_command.nsyms +
m_dysymtab.nindirectsyms);
num_syms = symtab->GetNumSymbols();
@@ -3780,12 +3780,12 @@
nlist.n_value = nlist_data.GetAddress_unchecked(&nlist_data_offset);
SymbolType type = eSymbolTypeInvalid;
- const char *symbol_name = NULL;
+ const char *symbol_name = nullptr;
if (have_strtab_data) {
symbol_name = strtab_data.PeekCStr(nlist.n_strx);
- if (symbol_name == NULL) {
+ if (symbol_name == nullptr) {
// No symbol should be NULL, even the symbols with no string values
// should have an offset zero which points to an empty C-string
Host::SystemLog(Host::eSystemLogError,
@@ -3796,7 +3796,7 @@
continue;
}
if (symbol_name[0] == '\0')
- symbol_name = NULL;
+ symbol_name = nullptr;
} else {
const addr_t str_addr = strtab_addr + nlist.n_strx;
Status str_error;
@@ -3804,7 +3804,7 @@
str_error))
symbol_name = memory_symbol_name.c_str();
}
- const char *symbol_name_non_abi_mangled = NULL;
+ const char *symbol_name_non_abi_mangled = nullptr;
SectionSP symbol_section;
lldb::addr_t symbol_byte_size = 0;
@@ -3957,7 +3957,7 @@
case N_SO:
// source file name
type = eSymbolTypeSourceFile;
- if (symbol_name == NULL) {
+ if (symbol_name == nullptr) {
add_nlist = false;
if (N_SO_index != UINT32_MAX) {
// Set the size of the N_SO to the terminating index of this
@@ -4426,7 +4426,7 @@
if (func_start_entry->addr != symbol_lookup_file_addr &&
func_start_entry->addr != (symbol_lookup_file_addr + 1)) {
// Not the right entry, NULL it out...
- func_start_entry = NULL;
+ func_start_entry = nullptr;
}
}
if (func_start_entry) {
@@ -4710,7 +4710,7 @@
NListIndexToSymbolIndexMap::const_iterator index_pos =
m_nlist_idx_to_sym_idx.find(stub_sym_id);
- Symbol *stub_symbol = NULL;
+ Symbol *stub_symbol = nullptr;
if (index_pos != end_index_pos) {
// We have a remapping from the original nlist index to a
// current symbol index, so just look this up by index
@@ -4742,7 +4742,7 @@
Mangled stub_symbol_mangled_name(stub_symbol->GetMangled());
if (sym_idx >= num_syms) {
sym = symtab->Resize(++num_syms);
- stub_symbol = NULL; // this pointer no longer valid
+ stub_symbol = nullptr; // this pointer no longer valid
}
sym[sym_idx].SetID(synthetic_sym_id++);
sym[sym_idx].GetMangled() = stub_symbol_mangled_name;
@@ -4828,10 +4828,10 @@
SectionList *sections = GetSectionList();
if (sections)
- sections->Dump(s, NULL, true, UINT32_MAX);
+ sections->Dump(s, nullptr, true, UINT32_MAX);
if (m_symtab_up)
- m_symtab_up->Dump(s, NULL, eSortOrderNone);
+ m_symtab_up->Dump(s, nullptr, eSortOrderNone);
}
}
@@ -4844,7 +4844,7 @@
lldb::offset_t offset = lc_offset;
for (i = 0; i < header.ncmds; ++i) {
const lldb::offset_t cmd_offset = offset;
- if (data.GetU32(&offset, &load_cmd, 2) == NULL)
+ if (data.GetU32(&offset, &load_cmd, 2) == nullptr)
break;
if (load_cmd.cmd == LC_UUID) {
@@ -4982,7 +4982,7 @@
lldb::offset_t offset = lc_offset;
for (uint32_t i = 0; i < header.ncmds; ++i) {
const lldb::offset_t cmd_offset = offset;
- if (data.GetU32(&offset, &load_cmd, 2) == NULL)
+ if (data.GetU32(&offset, &load_cmd, 2) == nullptr)
break;
struct version_min_command version_min;
@@ -5015,7 +5015,7 @@
offset = lc_offset;
for (uint32_t i = 0; i < header.ncmds; ++i) {
const lldb::offset_t cmd_offset = offset;
- if (data.GetU32(&offset, &load_cmd, 2) == NULL)
+ if (data.GetU32(&offset, &load_cmd, 2) == nullptr)
break;
do {
if (load_cmd.cmd == llvm::MachO::LC_BUILD_VERSION) {
@@ -5077,7 +5077,7 @@
uint32_t i;
for (i = 0; i < m_header.ncmds; ++i) {
const uint32_t cmd_offset = offset;
- if (m_data.GetU32(&offset, &load_cmd, 2) == NULL)
+ if (m_data.GetU32(&offset, &load_cmd, 2) == nullptr)
break;
switch (load_cmd.cmd) {
@@ -5211,7 +5211,7 @@
for (i = 0; i < m_header.ncmds; ++i) {
const lldb::offset_t cmd_offset = offset;
- if (m_data.GetU32(&offset, &load_cmd, 2) == NULL)
+ if (m_data.GetU32(&offset, &load_cmd, 2) == nullptr)
break;
switch (load_cmd.cmd) {
@@ -5350,7 +5350,7 @@
thread_command thread_cmd;
for (uint32_t i = 0; i < m_header.ncmds; ++i) {
const uint32_t cmd_offset = offset;
- if (m_data.GetU32(&offset, &thread_cmd, 2) == NULL)
+ if (m_data.GetU32(&offset, &thread_cmd, 2) == nullptr)
break;
if (thread_cmd.cmd == LC_THREAD) {
@@ -5377,8 +5377,8 @@
for (uint32_t i = 0; i < m_header.ncmds; ++i) {
const uint32_t cmd_offset = offset;
load_command lc;
- if (m_data.GetU32(&offset, &lc.cmd, 2) == NULL)
- break;
+ if (m_data.GetU32(&offset, &lc.cmd, 2) == nullptr)
+ break;
if (lc.cmd == LC_NOTE)
{
char data_owner[17];
@@ -5422,7 +5422,7 @@
for (uint32_t i = 0; i < m_header.ncmds; ++i) {
const uint32_t cmd_offset = offset;
struct ident_command ident_command;
- if (m_data.GetU32(&offset, &ident_command, 2) == NULL)
+ if (m_data.GetU32(&offset, &ident_command, 2) == nullptr)
break;
if (ident_command.cmd == LC_IDENT && ident_command.cmdsize != 0) {
char *buf = (char *) malloc (ident_command.cmdsize);
@@ -5451,8 +5451,8 @@
for (uint32_t i = 0; i < m_header.ncmds; ++i) {
const uint32_t cmd_offset = offset;
load_command lc;
- if (m_data.GetU32(&offset, &lc.cmd, 2) == NULL)
- break;
+ if (m_data.GetU32(&offset, &lc.cmd, 2) == nullptr)
+ break;
if (lc.cmd == LC_NOTE)
{
char data_owner[17];
@@ -5649,13 +5649,13 @@
uint32_t i;
for (i = 0; i < m_header.ncmds; ++i) {
const lldb::offset_t cmd_offset = offset;
- if (m_data.GetU32(&offset, &load_cmd, 2) == NULL)
+ if (m_data.GetU32(&offset, &load_cmd, 2) == nullptr)
break;
if (load_cmd.cmd == LC_ID_DYLIB) {
if (version_cmd == 0) {
version_cmd = load_cmd.cmd;
- if (m_data.GetU32(&offset, &load_cmd.dylib, 4) == NULL)
+ if (m_data.GetU32(&offset, &load_cmd.dylib, 4) == nullptr)
break;
version = load_cmd.dylib.current_version;
}
@@ -5795,7 +5795,7 @@
const lldb::offset_t load_cmd_offset = offset;
version_min_command lc;
- if (m_data.GetU32(&offset, &lc.cmd, 2) == NULL)
+ if (m_data.GetU32(&offset, &lc.cmd, 2) == nullptr)
break;
if (lc.cmd == llvm::MachO::LC_VERSION_MIN_MACOSX ||
lc.cmd == llvm::MachO::LC_VERSION_MIN_IPHONEOS ||
@@ -5855,7 +5855,7 @@
const lldb::offset_t load_cmd_offset = offset;
version_min_command lc;
- if (m_data.GetU32(&offset, &lc.cmd, 2) == NULL)
+ if (m_data.GetU32(&offset, &lc.cmd, 2) == nullptr)
break;
if (lc.cmd == llvm::MachO::LC_VERSION_MIN_MACOSX ||
lc.cmd == llvm::MachO::LC_VERSION_MIN_IPHONEOS ||
@@ -5886,7 +5886,7 @@
const lldb::offset_t load_cmd_offset = offset;
version_min_command lc;
- if (m_data.GetU32(&offset, &lc.cmd, 2) == NULL)
+ if (m_data.GetU32(&offset, &lc.cmd, 2) == nullptr)
break;
if (lc.cmd == llvm::MachO::LC_BUILD_VERSION) {
// struct build_version_command {
@@ -5932,7 +5932,7 @@
// the sentinel value indicating that this object file
// does not have a valid minimum os version #.
if (m_sdk_versions.size() > 1) {
- if (versions != NULL && num_versions > 0) {
+ if (versions != nullptr && num_versions > 0) {
for (size_t i = 0; i < num_versions; ++i) {
if (i < m_sdk_versions.size())
versions[i] = m_sdk_versions[i];
diff --git a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
index 2bd75a4..fab37903 100644
--- a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
+++ b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
@@ -596,7 +596,7 @@
ModuleSP module_sp(GetModule());
if (module_sp) {
std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex());
- if (m_symtab_up == NULL) {
+ if (m_symtab_up == nullptr) {
SectionList *sect_list = GetSectionList();
m_symtab_up.reset(new Symtab(this));
std::lock_guard<std::recursive_mutex> guard(m_symtab_up->GetMutex());
@@ -627,7 +627,7 @@
for (uint32_t i = 0; i < num_syms; ++i) {
coff_symbol_t symbol;
const uint32_t symbol_offset = offset;
- const char *symbol_name_cstr = NULL;
+ const char *symbol_name_cstr = nullptr;
// If the first 4 bytes of the symbol string are zero, then they
// are followed by a 4-byte string table offset. Else these
// 8 bytes contain the symbol name
@@ -642,7 +642,7 @@
// bytes
offset += sizeof(symbol.name) - 4; // Skip remaining
symbol_name_cstr = symtab_data.PeekCStr(symbol_offset);
- if (symbol_name_cstr == NULL)
+ if (symbol_name_cstr == nullptr)
break;
symbol_name.assign(symbol_name_cstr, sizeof(symbol.name));
}
@@ -1006,10 +1006,10 @@
SectionList *sections = GetSectionList();
if (sections)
- sections->Dump(s, NULL, true, UINT32_MAX);
+ sections->Dump(s, nullptr, true, UINT32_MAX);
if (m_symtab_up)
- m_symtab_up->Dump(s, NULL, eSortOrderNone);
+ m_symtab_up->Dump(s, nullptr, eSortOrderNone);
if (m_dos_header.e_magic)
DumpDOSHeader(s, m_dos_header);