Revert "[lldb] Use nullptr instead of 0 or NULL (NFC)"

This reverts commit 24d2405588.
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.
This commit is contained in:
Nico Weber 2022-01-01 13:35:54 -05:00
parent dd2ad7fa47
commit 4f2eeb6a65
9 changed files with 22 additions and 24 deletions

View File

@ -46,7 +46,7 @@ protected:
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;
};
}

View File

@ -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;

View File

@ -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;
}

View File

@ -768,9 +768,9 @@ public:
// 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 {

View File

@ -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

View File

@ -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)

View File

@ -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 {};

View File

@ -269,7 +269,7 @@ protected:
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 @@ protected:
const DWARFDebugInfoEntry *DIEPtr() {
ExtractDIEsIfNeeded();
if (m_die_array.empty())
return nullptr;
return NULL;
return &m_die_array[0];
}

View File

@ -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());