[Lldb-commits] [lldb] 4f2eeb6 - Revert "[lldb] Use nullptr instead of 0 or NULL (NFC)"
Nico Weber via lldb-commits
lldb-commits at lists.llvm.org
Sat Jan 1 10:36:53 PST 2022
Author: Nico Weber
Date: 2022-01-01T13:35:54-05:00
New Revision: 4f2eeb6a657abf82d13e95c7ab0d7d02fab98ed1
URL: https://github.com/llvm/llvm-project/commit/4f2eeb6a657abf82d13e95c7ab0d7d02fab98ed1
DIFF: https://github.com/llvm/llvm-project/commit/4f2eeb6a657abf82d13e95c7ab0d7d02fab98ed1.diff
LOG: Revert "[lldb] Use nullptr instead of 0 or NULL (NFC)"
This reverts commit 24d240558811604354a8d6080405f6bad8d15b5c.
Breaks building on Windows:
../../lldb/include\lldb/Host/HostNativeThreadBase.h(49,36): error:
cannot initialize a member subobject of type 'lldb::thread_result_t'
(aka 'unsigned int') with an rvalue of type 'std::nullptr_t'
lldb::thread_result_t m_result = nullptr;
^~~~~~~
1 error generated.
Added:
Modified:
lldb/include/lldb/Host/HostNativeThreadBase.h
lldb/source/API/SystemInitializerFull.cpp
lldb/source/Host/common/HostNativeThreadBase.cpp
lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.cpp
lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_arm64.cpp
lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
lldb/source/Symbol/Symbol.cpp
Removed:
################################################################################
diff --git a/lldb/include/lldb/Host/HostNativeThreadBase.h b/lldb/include/lldb/Host/HostNativeThreadBase.h
index 57707f07cea81..bfd70d745593e 100644
--- a/lldb/include/lldb/Host/HostNativeThreadBase.h
+++ b/lldb/include/lldb/Host/HostNativeThreadBase.h
@@ -46,7 +46,7 @@ class HostNativeThreadBase {
ThreadCreateTrampoline(lldb::thread_arg_t arg);
lldb::thread_t m_thread = LLDB_INVALID_HOST_THREAD;
- lldb::thread_result_t m_result = nullptr;
+ lldb::thread_result_t m_result = 0;
};
}
diff --git a/lldb/source/API/SystemInitializerFull.cpp b/lldb/source/API/SystemInitializerFull.cpp
index d662d370f8130..b01cb2ff545be 100644
--- a/lldb/source/API/SystemInitializerFull.cpp
+++ b/lldb/source/API/SystemInitializerFull.cpp
@@ -39,7 +39,7 @@ constexpr lldb_private::HostInfo::SharedLibraryDirectoryHelper
#else
constexpr lldb_private::HostInfo::SharedLibraryDirectoryHelper
- *g_shlib_dir_helper = nullptr;
+ *g_shlib_dir_helper = 0;
#endif
using namespace lldb_private;
diff --git a/lldb/source/Host/common/HostNativeThreadBase.cpp b/lldb/source/Host/common/HostNativeThreadBase.cpp
index e7966d9ebaa56..b15160b143ca7 100644
--- a/lldb/source/Host/common/HostNativeThreadBase.cpp
+++ b/lldb/source/Host/common/HostNativeThreadBase.cpp
@@ -18,7 +18,7 @@ using namespace lldb;
using namespace lldb_private;
HostNativeThreadBase::HostNativeThreadBase(thread_t thread)
- : m_thread(thread), m_result(nullptr) {}
+ : m_thread(thread), m_result(0) {}
lldb::thread_t HostNativeThreadBase::GetSystemHandle() const {
return m_thread;
@@ -34,7 +34,7 @@ bool HostNativeThreadBase::IsJoinable() const {
void HostNativeThreadBase::Reset() {
m_thread = LLDB_INVALID_HOST_THREAD;
- m_result = nullptr;
+ m_result = 0;
}
bool HostNativeThreadBase::EqualsThread(lldb::thread_t thread) const {
@@ -44,7 +44,7 @@ bool HostNativeThreadBase::EqualsThread(lldb::thread_t thread) const {
lldb::thread_t HostNativeThreadBase::Release() {
lldb::thread_t result = m_thread;
m_thread = LLDB_INVALID_HOST_THREAD;
- m_result = nullptr;
+ m_result = 0;
return result;
}
diff --git a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
index 30d7d239834b0..e72d55dd2aba8 100644
--- a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
+++ b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
@@ -768,9 +768,9 @@ class RegisterContextDarwin_arm64_Mach : public RegisterContextDarwin_arm64 {
// Write out the EXC registers
data.PutHex32(EXCRegSet);
data.PutHex32(EXCWordCount);
- PrintRegisterValue(reg_ctx, "far", nullptr, 8, data);
- PrintRegisterValue(reg_ctx, "esr", nullptr, 4, data);
- PrintRegisterValue(reg_ctx, "exception", nullptr, 4, data);
+ PrintRegisterValue(reg_ctx, "far", NULL, 8, data);
+ PrintRegisterValue(reg_ctx, "esr", NULL, 4, data);
+ PrintRegisterValue(reg_ctx, "exception", NULL, 4, data);
return true;
}
return false;
@@ -5073,7 +5073,7 @@ void ObjectFileMachO::GetAllArchSpecs(const llvm::MachO::mach_header &header,
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) == nullptr)
+ if (data.GetU32(&offset, &load_cmd, 2) == NULL)
break;
llvm::MachO::version_min_command version_min;
@@ -5123,7 +5123,7 @@ void ObjectFileMachO::GetAllArchSpecs(const llvm::MachO::mach_header &header,
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) == nullptr)
+ if (data.GetU32(&offset, &load_cmd, 2) == NULL)
break;
do {
diff --git a/lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.cpp b/lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.cpp
index 516bcb21b0193..ef419d9a89e8a 100644
--- a/lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.cpp
+++ b/lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.cpp
@@ -272,8 +272,7 @@ Status MinidumpFileBuilder::AddModuleList(Target &target) {
mod->GetObjectFile()->GetBaseAddress().GetLoadAddress(&target));
m.SizeOfImage = static_cast<llvm::support::ulittle32_t>(mod_size);
m.Checksum = static_cast<llvm::support::ulittle32_t>(0);
- m.TimeDateStamp =
- static_cast<llvm::support::ulittle32_t>(std::time(nullptr));
+ m.TimeDateStamp = static_cast<llvm::support::ulittle32_t>(std::time(0));
m.ModuleNameRVA = static_cast<llvm::support::ulittle32_t>(
size_before + module_stream_size + helper_data.GetByteSize());
m.VersionInfo = info;
@@ -720,7 +719,7 @@ Status MinidumpFileBuilder::Dump(lldb::FileUP &core_file) const {
header.Checksum = static_cast<llvm::support::ulittle32_t>(
0u), // not used in most of the writers
header.TimeDateStamp =
- static_cast<llvm::support::ulittle32_t>(std::time(nullptr));
+ static_cast<llvm::support::ulittle32_t>(std::time(0));
header.Flags =
static_cast<llvm::support::ulittle64_t>(0u); // minidump normal flag
diff --git a/lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_arm64.cpp b/lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_arm64.cpp
index d6c4a8687ec5c..6c130be7b7411 100644
--- a/lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_arm64.cpp
+++ b/lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_arm64.cpp
@@ -178,10 +178,10 @@ static const lldb_private::RegisterSet g_reg_sets_arm64[k_num_register_sets] = {
g_sve_regnums_arm64}};
static const lldb_private::RegisterSet g_reg_set_pauth_arm64 = {
- "Pointer Authentication Registers", "pauth", k_num_pauth_register, nullptr};
+ "Pointer Authentication Registers", "pauth", k_num_pauth_register, NULL};
static const lldb_private::RegisterSet g_reg_set_mte_arm64 = {
- "MTE Control Register", "mte", k_num_mte_register, nullptr};
+ "MTE Control Register", "mte", k_num_mte_register, NULL};
RegisterInfoPOSIX_arm64::RegisterInfoPOSIX_arm64(
const lldb_private::ArchSpec &target_arch, lldb_private::Flags opt_regsets)
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
index be555c130bfee..b90f104c4d213 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -933,7 +933,7 @@ TypeSP DWARFASTParserClang::ParseSubroutine(const DWARFDIE &die,
DW_TAG_value_to_name(tag), type_name_cstr);
CompilerType return_clang_type;
- Type *func_type = nullptr;
+ Type *func_type = NULL;
if (attrs.type.IsValid())
func_type = dwarf->ResolveTypeUID(attrs.type.Reference(), true);
@@ -1027,7 +1027,7 @@ TypeSP DWARFASTParserClang::ParseSubroutine(const DWARFDIE &die,
class_opaque_type, attrs.name.GetCString(), clang_type,
attrs.accessibility, attrs.is_artificial, is_variadic,
attrs.is_objc_direct_call);
- type_handled = objc_method_decl != nullptr;
+ type_handled = objc_method_decl != NULL;
if (type_handled) {
LinkDeclContextToDIE(objc_method_decl, die);
m_ast.SetMetadataAsUserID(objc_method_decl, die.GetID());
@@ -1178,7 +1178,7 @@ TypeSP DWARFASTParserClang::ParseSubroutine(const DWARFDIE &die,
is_static, attrs.is_inline, attrs.is_explicit,
is_attr_used, attrs.is_artificial);
- type_handled = cxx_method_decl != nullptr;
+ type_handled = cxx_method_decl != NULL;
// Artificial methods are always handled even when we
// don't create a new declaration for them.
type_handled |= attrs.is_artificial;
@@ -2036,7 +2036,7 @@ bool DWARFASTParserClang::ParseTemplateDIE(
if (name && name[0])
template_param_infos.names.push_back(name);
else
- template_param_infos.names.push_back(nullptr);
+ template_param_infos.names.push_back(NULL);
// Get the signed value for any integer or enumeration if available
clang_type.IsIntegerOrEnumerationType(is_signed);
@@ -3336,8 +3336,7 @@ DWARFASTParserClang::GetOwningClangModule(const DWARFDIE &die) {
auto it = m_die_to_module.find(module_die.GetDIE());
if (it != m_die_to_module.end())
return it->second;
- const char *name =
- module_die.GetAttributeValueAsString(DW_AT_name, nullptr);
+ const char *name = module_die.GetAttributeValueAsString(DW_AT_name, 0);
if (!name)
return {};
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
index 2457e8276e209..71d4c1e6c52f0 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
@@ -269,7 +269,7 @@ class DWARFUnit : public lldb_private::UserID {
ExtractUnitDIENoDwoIfNeeded();
// m_first_die_mutex is not required as m_first_die is never cleared.
if (!m_first_die)
- return nullptr;
+ return NULL;
return &m_first_die;
}
@@ -277,7 +277,7 @@ class DWARFUnit : public lldb_private::UserID {
const DWARFDebugInfoEntry *DIEPtr() {
ExtractDIEsIfNeeded();
if (m_die_array.empty())
- return nullptr;
+ return NULL;
return &m_die_array[0];
}
diff --git a/lldb/source/Symbol/Symbol.cpp b/lldb/source/Symbol/Symbol.cpp
index 5ee5b0fe22231..fa7226dfd0466 100644
--- a/lldb/source/Symbol/Symbol.cpp
+++ b/lldb/source/Symbol/Symbol.cpp
@@ -680,7 +680,7 @@ void Symbol::Encode(DataEncoder &file, ConstStringTable &strtab) const {
// symbol's base address doesn't have a section, then it is a constant value.
// If it does have a section, we will encode the file address and re-resolve
// the address when we decode it.
- bool is_addr = m_addr_range.GetBaseAddress().GetSection().get() != nullptr;
+ bool is_addr = m_addr_range.GetBaseAddress().GetSection().get() != NULL;
file.AppendU8(is_addr);
file.AppendU64(m_addr_range.GetBaseAddress().GetFileAddress());
file.AppendU64(m_addr_range.GetByteSize());
More information about the lldb-commits
mailing list