diff options
author | Konrad Kleine <kkleine@redhat.com> | 2019-05-23 11:14:47 +0000 |
---|---|---|
committer | Konrad Kleine <kkleine@redhat.com> | 2019-05-23 11:14:47 +0000 |
commit | 248a13057a4adbdb8d511b1458daf39d01a4b520 (patch) | |
tree | 1209fb0822f0c14237eb9935e30da465014a6eda /lldb/source/Plugins/ObjectFile/ELF | |
parent | 32d976bac194d78656974e3e05bf52997a06f509 (diff) | |
download | bcm5719-llvm-248a13057a4adbdb8d511b1458daf39d01a4b520.tar.gz bcm5719-llvm-248a13057a4adbdb8d511b1458daf39d01a4b520.zip |
[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
Diffstat (limited to 'lldb/source/Plugins/ObjectFile/ELF')
-rw-r--r-- | lldb/source/Plugins/ObjectFile/ELF/ELFHeader.cpp | 32 | ||||
-rw-r--r-- | lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp | 30 |
2 files changed, 31 insertions, 31 deletions
diff --git a/lldb/source/Plugins/ObjectFile/ELF/ELFHeader.cpp b/lldb/source/Plugins/ObjectFile/ELF/ELFHeader.cpp index 7f9665af9a3..aa9871071b0 100644 --- a/lldb/source/Plugins/ObjectFile/ELF/ELFHeader.cpp +++ b/lldb/source/Plugins/ObjectFile/ELF/ELFHeader.cpp @@ -114,7 +114,7 @@ void ELFHeader::ParseHeaderExtension(lldb_private::DataExtractor &data) { 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 @@ bool ELFHeader::Parse(lldb_private::DataExtractor &data, 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 @@ bool ELFHeader::Parse(lldb_private::DataExtractor &data, 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 @@ bool ELFSectionHeader::Parse(const lldb_private::DataExtractor &data, 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 @@ bool ELFSectionHeader::Parse(const lldb_private::DataExtractor &data, 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 @@ bool ELFSymbol::Parse(const lldb_private::DataExtractor &data, 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 @@ bool ELFSymbol::Parse(const lldb_private::DataExtractor &data, 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 @@ bool ELFProgramHeader::Parse(const lldb_private::DataExtractor &data, 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 @@ bool ELFProgramHeader::Parse(const lldb_private::DataExtractor &data, 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 @@ bool ELFProgramHeader::Parse(const lldb_private::DataExtractor &data, 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 0040599c1b5..bc802040bf7 100644 --- a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp +++ b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp @@ -162,7 +162,7 @@ ELFRelocation::ELFRelocation(unsigned type) { reloc = new ELFRela(); else { assert(false && "unexpected relocation type"); - reloc = static_cast<ELFRel *>(NULL); + reloc = static_cast<ELFRel *>(nullptr); } } @@ -243,7 +243,7 @@ static user_id_t SegmentID(size_t PHdrIndex) { return ~PHdrIndex; } 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 @@ bool ELFNote::Parse(const DataExtractor &data, lldb::offset_t *offset) { } 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 @@ ObjectFile *ObjectFileELF::CreateInstance(const lldb::ModuleSP &module_sp, return objfile_up.release(); } - return NULL; + return nullptr; } ObjectFile *ObjectFileELF::CreateMemoryInstance( @@ -415,7 +415,7 @@ ObjectFile *ObjectFileELF::CreateMemoryInstance( } } } - return NULL; + return nullptr; } bool ObjectFileELF::MagicBytesMatch(DataBufferSP &data_sp, @@ -1656,12 +1656,12 @@ size_t ObjectFileELF::ParseSectionHeaders() { 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 @@ size_t ObjectFileELF::ParseDynamicSymbols() { 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 @@ const ELFDynamic *ObjectFileELF::FindDynamicSymbol(unsigned tag) { return symbol; } - return NULL; + return nullptr; } unsigned ObjectFileELF::PLTRelocationType() { @@ -2604,7 +2604,7 @@ unsigned ObjectFileELF::ApplyRelocations( if (!rel.Parse(rel_data, &offset)) break; - Symbol *symbol = NULL; + Symbol *symbol = nullptr; if (hdr->Is32Bit()) { switch (reloc_type(rel)) { @@ -2723,7 +2723,7 @@ unsigned ObjectFileELF::RelocateDebugSections(const ELFSectionHeader *rel_hdr, 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 @@ Symtab *ObjectFileELF::GetSymtab() { 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 @@ void ObjectFileELF::Dump(Stream *s) { 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(); |