diff options
author | Adrian Prantl <aprantl@apple.com> | 2019-01-15 20:33:58 +0000 |
---|---|---|
committer | Adrian Prantl <aprantl@apple.com> | 2019-01-15 20:33:58 +0000 |
commit | d6a9bbf68e2c795d0d2d7f831235ed14af978f87 (patch) | |
tree | 87a0eb5e4ce3d616030c83aa16c8bc6faf085791 /lldb/source/Plugins | |
parent | 3cdd1a7d47f3a51c67979d28ce542a2f03c12d0c (diff) | |
download | bcm5719-llvm-d6a9bbf68e2c795d0d2d7f831235ed14af978f87.tar.gz bcm5719-llvm-d6a9bbf68e2c795d0d2d7f831235ed14af978f87.zip |
Replace auto -> llvm::Optional<uint64_t>
This addresses post-commit feedback for https://reviews.llvm.org/D56688
llvm-svn: 351237
Diffstat (limited to 'lldb/source/Plugins')
22 files changed, 90 insertions, 64 deletions
diff --git a/lldb/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.cpp b/lldb/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.cpp index 6ca0be16e88..9055660f2d6 100644 --- a/lldb/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.cpp +++ b/lldb/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.cpp @@ -1470,7 +1470,7 @@ bool ABIMacOSX_arm::GetArgumentValues(Thread &thread, ValueList &values) const { if (compiler_type) { bool is_signed = false; size_t bit_width = 0; - auto bit_size = compiler_type.GetBitSize(&thread); + llvm::Optional<uint64_t> bit_size = compiler_type.GetBitSize(&thread); if (!bit_size) return false; if (compiler_type.IsIntegerOrEnumerationType(is_signed)) @@ -1576,7 +1576,7 @@ ValueObjectSP ABIMacOSX_arm::GetReturnValueObjectImpl( const RegisterInfo *r0_reg_info = reg_ctx->GetRegisterInfoByName("r0", 0); if (compiler_type.IsIntegerOrEnumerationType(is_signed)) { - auto bit_width = compiler_type.GetBitSize(&thread); + llvm::Optional<uint64_t> bit_width = compiler_type.GetBitSize(&thread); if (!bit_width) return return_valobj_sp; @@ -1596,7 +1596,8 @@ ValueObjectSP ABIMacOSX_arm::GetReturnValueObjectImpl( const RegisterInfo *r3_reg_info = reg_ctx->GetRegisterInfoByName("r3", 0); if (r1_reg_info && r2_reg_info && r3_reg_info) { - auto byte_size = compiler_type.GetByteSize(&thread); + llvm::Optional<uint64_t> byte_size = + compiler_type.GetByteSize(&thread); if (!byte_size) return return_valobj_sp; ProcessSP process_sp(thread.GetProcess()); diff --git a/lldb/source/Plugins/ABI/MacOSX-arm64/ABIMacOSX_arm64.cpp b/lldb/source/Plugins/ABI/MacOSX-arm64/ABIMacOSX_arm64.cpp index 827f80382fd..d8706c4a9cd 100644 --- a/lldb/source/Plugins/ABI/MacOSX-arm64/ABIMacOSX_arm64.cpp +++ b/lldb/source/Plugins/ABI/MacOSX-arm64/ABIMacOSX_arm64.cpp @@ -1762,7 +1762,7 @@ bool ABIMacOSX_arm64::GetArgumentValues(Thread &thread, return false; CompilerType value_type = value->GetCompilerType(); - auto bit_size = value_type.GetBitSize(&thread); + llvm::Optional<uint64_t> bit_size = value_type.GetBitSize(&thread); if (!bit_size) return false; @@ -2111,7 +2111,7 @@ static bool LoadValueFromConsecutiveGPRRegisters( uint32_t &NGRN, // NGRN (see ABI documentation) uint32_t &NSRN, // NSRN (see ABI documentation) DataExtractor &data) { - auto byte_size = value_type.GetByteSize(nullptr); + llvm::Optional<uint64_t> byte_size = value_type.GetByteSize(nullptr); if (!byte_size || *byte_size == 0) return false; @@ -2128,7 +2128,7 @@ static bool LoadValueFromConsecutiveGPRRegisters( if (NSRN < 8 && (8 - NSRN) >= homogeneous_count) { if (!base_type) return false; - auto base_byte_size = base_type.GetByteSize(nullptr); + llvm::Optional<uint64_t> base_byte_size = base_type.GetByteSize(nullptr); if (!base_byte_size) return false; uint32_t data_offset = 0; @@ -2264,7 +2264,8 @@ ValueObjectSP ABIMacOSX_arm64::GetReturnValueObjectImpl( if (!reg_ctx) return return_valobj_sp; - auto byte_size = return_compiler_type.GetByteSize(nullptr); + llvm::Optional<uint64_t> byte_size = + return_compiler_type.GetByteSize(nullptr); if (!byte_size) return return_valobj_sp; diff --git a/lldb/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.cpp b/lldb/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.cpp index b6e0ef4f7bc..a297bd1473b 100644 --- a/lldb/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.cpp +++ b/lldb/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.cpp @@ -824,7 +824,7 @@ bool ABIMacOSX_i386::GetArgumentValues(Thread &thread, // We currently only support extracting values with Clang QualTypes. Do we // care about others? CompilerType compiler_type(value->GetCompilerType()); - auto bit_size = compiler_type.GetBitSize(&thread); + llvm::Optional<uint64_t> bit_size = compiler_type.GetBitSize(&thread); if (bit_size) { bool is_signed; if (compiler_type.IsIntegerOrEnumerationType(is_signed)) @@ -933,7 +933,7 @@ ABIMacOSX_i386::GetReturnValueObjectImpl(Thread &thread, bool is_signed; if (compiler_type.IsIntegerOrEnumerationType(is_signed)) { - auto bit_width = compiler_type.GetBitSize(&thread); + llvm::Optional<uint64_t> bit_width = compiler_type.GetBitSize(&thread); if (!bit_width) return return_valobj_sp; unsigned eax_id = diff --git a/lldb/source/Plugins/ABI/SysV-arm/ABISysV_arm.cpp b/lldb/source/Plugins/ABI/SysV-arm/ABISysV_arm.cpp index b14048154fc..b93a8525010 100644 --- a/lldb/source/Plugins/ABI/SysV-arm/ABISysV_arm.cpp +++ b/lldb/source/Plugins/ABI/SysV-arm/ABISysV_arm.cpp @@ -1473,7 +1473,7 @@ bool ABISysV_arm::GetArgumentValues(Thread &thread, ValueList &values) const { size_t bit_width = 0; if (compiler_type.IsIntegerOrEnumerationType(is_signed) || compiler_type.IsPointerOrReferenceType()) { - if (auto size = compiler_type.GetBitSize(&thread)) + if (llvm::Optional<uint64_t> size = compiler_type.GetBitSize(&thread)) bit_width = *size; } else { // We only handle integer, pointer and reference types currently... @@ -1580,8 +1580,8 @@ ValueObjectSP ABISysV_arm::GetReturnValueObjectImpl( const RegisterInfo *r0_reg_info = reg_ctx->GetRegisterInfo(eRegisterKindGeneric, LLDB_REGNUM_GENERIC_ARG1); - auto bit_width = compiler_type.GetBitSize(&thread); - auto byte_size = compiler_type.GetByteSize(&thread); + llvm::Optional<uint64_t> bit_width = compiler_type.GetBitSize(&thread); + llvm::Optional<uint64_t> byte_size = compiler_type.GetByteSize(&thread); if (!bit_width || !byte_size) return return_valobj_sp; @@ -1717,7 +1717,8 @@ ValueObjectSP ABISysV_arm::GetReturnValueObjectImpl( compiler_type.IsHomogeneousAggregate(&base_type); if (homogeneous_count > 0 && homogeneous_count <= 4) { - auto base_byte_size = base_type.GetByteSize(nullptr); + llvm::Optional<uint64_t> base_byte_size = + base_type.GetByteSize(nullptr); if (base_type.IsVectorType(nullptr, nullptr)) { if (base_byte_size && (*base_byte_size == 8 || *base_byte_size == 16)) { @@ -1745,7 +1746,8 @@ ValueObjectSP ABISysV_arm::GetReturnValueObjectImpl( compiler_type.GetFieldAtIndex(index, name, NULL, NULL, NULL); if (base_type.IsFloatingPointType(float_count, is_complex)) { - auto base_byte_size = base_type.GetByteSize(nullptr); + llvm::Optional<uint64_t> base_byte_size = + base_type.GetByteSize(nullptr); if (float_count == 2 && is_complex) { if (index != 0 && base_byte_size && vfp_byte_size != *base_byte_size) diff --git a/lldb/source/Plugins/ABI/SysV-arm64/ABISysV_arm64.cpp b/lldb/source/Plugins/ABI/SysV-arm64/ABISysV_arm64.cpp index 0ee0b91e207..dd3f47303be 100644 --- a/lldb/source/Plugins/ABI/SysV-arm64/ABISysV_arm64.cpp +++ b/lldb/source/Plugins/ABI/SysV-arm64/ABISysV_arm64.cpp @@ -1767,7 +1767,7 @@ bool ABISysV_arm64::GetArgumentValues(Thread &thread, ValueList &values) const { if (value_type) { bool is_signed = false; size_t bit_width = 0; - auto bit_size = value_type.GetBitSize(&thread); + llvm::Optional<uint64_t> bit_size = value_type.GetBitSize(&thread); if (!bit_size) return false; if (value_type.IsIntegerOrEnumerationType(is_signed)) { @@ -2086,7 +2086,7 @@ static bool LoadValueFromConsecutiveGPRRegisters( uint32_t &NGRN, // NGRN (see ABI documentation) uint32_t &NSRN, // NSRN (see ABI documentation) DataExtractor &data) { - auto byte_size = value_type.GetByteSize(nullptr); + llvm::Optional<uint64_t> byte_size = value_type.GetByteSize(nullptr); if (byte_size || *byte_size == 0) return false; @@ -2104,7 +2104,7 @@ static bool LoadValueFromConsecutiveGPRRegisters( if (NSRN < 8 && (8 - NSRN) >= homogeneous_count) { if (!base_type) return false; - auto base_byte_size = base_type.GetByteSize(nullptr); + llvm::Optional<uint64_t> base_byte_size = base_type.GetByteSize(nullptr); if (!base_byte_size) return false; uint32_t data_offset = 0; @@ -2233,7 +2233,8 @@ ValueObjectSP ABISysV_arm64::GetReturnValueObjectImpl( if (!reg_ctx) return return_valobj_sp; - auto byte_size = return_compiler_type.GetByteSize(nullptr); + llvm::Optional<uint64_t> byte_size = + return_compiler_type.GetByteSize(nullptr); if (!byte_size) return return_valobj_sp; diff --git a/lldb/source/Plugins/ABI/SysV-i386/ABISysV_i386.cpp b/lldb/source/Plugins/ABI/SysV-i386/ABISysV_i386.cpp index f359b52e129..3358eb8c277 100644 --- a/lldb/source/Plugins/ABI/SysV-i386/ABISysV_i386.cpp +++ b/lldb/source/Plugins/ABI/SysV-i386/ABISysV_i386.cpp @@ -308,7 +308,7 @@ bool ABISysV_i386::GetArgumentValues(Thread &thread, ValueList &values) const { // Currently: Support for extracting values with Clang QualTypes only. CompilerType compiler_type(value->GetCompilerType()); - auto bit_size = compiler_type.GetBitSize(&thread); + llvm::Optional<uint64_t> bit_size = compiler_type.GetBitSize(&thread); if (bit_size) { bool is_signed; if (compiler_type.IsIntegerOrEnumerationType(is_signed)) { @@ -513,7 +513,8 @@ ValueObjectSP ABISysV_i386::GetReturnValueObjectSimple( (type_flags & eTypeIsEnumeration)) //'Integral' + 'Floating Point' { value.SetValueType(Value::eValueTypeScalar); - auto byte_size = return_compiler_type.GetByteSize(nullptr); + llvm::Optional<uint64_t> byte_size = + return_compiler_type.GetByteSize(nullptr); if (!byte_size) return return_valobj_sp; bool success = false; @@ -637,7 +638,8 @@ ValueObjectSP ABISysV_i386::GetReturnValueObjectSimple( // ToDo: Yet to be implemented } else if (type_flags & eTypeIsVector) // 'Packed' { - auto byte_size = return_compiler_type.GetByteSize(nullptr); + llvm::Optional<uint64_t> byte_size = + return_compiler_type.GetByteSize(nullptr); if (byte_size && *byte_size > 0) { const RegisterInfo *vec_reg = reg_ctx->GetRegisterInfoByName("xmm0", 0); if (vec_reg == nullptr) diff --git a/lldb/source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp b/lldb/source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp index df86c0cedff..6f3d2e3b369 100644 --- a/lldb/source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp +++ b/lldb/source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp @@ -812,7 +812,7 @@ ValueObjectSP ABISysV_mips::GetReturnValueObjectImpl( // In MIPS register "r2" (v0) holds the integer function return values const RegisterInfo *r2_reg_info = reg_ctx->GetRegisterInfoByName("r2", 0); - auto bit_width = return_compiler_type.GetBitSize(&thread); + llvm::Optional<uint64_t> bit_width = return_compiler_type.GetBitSize(&thread); if (!bit_width) return return_valobj_sp; if (return_compiler_type.IsIntegerOrEnumerationType(is_signed)) { diff --git a/lldb/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp b/lldb/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp index 10f33ea1cb5..1d6738d9fda 100644 --- a/lldb/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp +++ b/lldb/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp @@ -762,7 +762,8 @@ ValueObjectSP ABISysV_mips64::GetReturnValueObjectImpl( Target *target = exe_ctx.GetTargetPtr(); const ArchSpec target_arch = target->GetArchitecture(); ByteOrder target_byte_order = target_arch.GetByteOrder(); - auto byte_size = return_compiler_type.GetByteSize(nullptr); + llvm::Optional<uint64_t> byte_size = + return_compiler_type.GetByteSize(nullptr); if (!byte_size) return return_valobj_sp; const uint32_t type_flags = return_compiler_type.GetTypeInfo(nullptr); @@ -970,7 +971,8 @@ ValueObjectSP ABISysV_mips64::GetReturnValueObjectImpl( CompilerType field_compiler_type = return_compiler_type.GetFieldAtIndex( idx, name, &field_bit_offset, nullptr, nullptr); - auto field_byte_width = field_compiler_type.GetByteSize(nullptr); + llvm::Optional<uint64_t> field_byte_width = + field_compiler_type.GetByteSize(nullptr); if (!field_byte_width) return return_valobj_sp; @@ -1041,7 +1043,8 @@ ValueObjectSP ABISysV_mips64::GetReturnValueObjectImpl( CompilerType field_compiler_type = return_compiler_type.GetFieldAtIndex( idx, name, &field_bit_offset, nullptr, nullptr); - auto field_byte_width = field_compiler_type.GetByteSize(nullptr); + llvm::Optional<uint64_t> field_byte_width = + field_compiler_type.GetByteSize(nullptr); // if we don't know the size of the field (e.g. invalid type), just // bail out diff --git a/lldb/source/Plugins/ABI/SysV-ppc/ABISysV_ppc.cpp b/lldb/source/Plugins/ABI/SysV-ppc/ABISysV_ppc.cpp index 3e3de6eeed3..1fe7a6718a9 100644 --- a/lldb/source/Plugins/ABI/SysV-ppc/ABISysV_ppc.cpp +++ b/lldb/source/Plugins/ABI/SysV-ppc/ABISysV_ppc.cpp @@ -398,7 +398,7 @@ bool ABISysV_ppc::GetArgumentValues(Thread &thread, ValueList &values) const { // We currently only support extracting values with Clang QualTypes. Do we // care about others? CompilerType compiler_type = value->GetCompilerType(); - auto bit_size = compiler_type.GetBitSize(&thread); + llvm::Optional<uint64_t> bit_size = compiler_type.GetBitSize(&thread); if (!bit_size) return false; bool is_signed; @@ -466,7 +466,8 @@ Status ABISysV_ppc::SetReturnValueObject(lldb::StackFrameSP &frame_sp, error.SetErrorString( "We don't support returning complex values at present"); else { - auto bit_width = compiler_type.GetBitSize(frame_sp.get()); + llvm::Optional<uint64_t> bit_width = + compiler_type.GetBitSize(frame_sp.get()); if (!bit_width) { error.SetErrorString("can't get type size"); return error; @@ -529,7 +530,8 @@ ValueObjectSP ABISysV_ppc::GetReturnValueObjectSimple( if (type_flags & eTypeIsInteger) { // Extract the register context so we can read arguments from registers - auto byte_size = return_compiler_type.GetByteSize(nullptr); + llvm::Optional<uint64_t> byte_size = + return_compiler_type.GetByteSize(nullptr); if (!byte_size) return return_valobj_sp; uint64_t raw_value = thread.GetRegisterContext()->ReadRegisterAsUnsigned( @@ -575,7 +577,8 @@ ValueObjectSP ABISysV_ppc::GetReturnValueObjectSimple( if (type_flags & eTypeIsComplex) { // Don't handle complex yet. } else { - auto byte_size = return_compiler_type.GetByteSize(nullptr); + llvm::Optional<uint64_t> byte_size = + return_compiler_type.GetByteSize(nullptr); if (byte_size && *byte_size <= sizeof(long double)) { const RegisterInfo *f1_info = reg_ctx->GetRegisterInfoByName("f1", 0); RegisterValue f1_value; @@ -608,7 +611,8 @@ ValueObjectSP ABISysV_ppc::GetReturnValueObjectSimple( return_valobj_sp = ValueObjectConstResult::Create( thread.GetStackFrameAtIndex(0).get(), value, ConstString("")); } else if (type_flags & eTypeIsVector) { - auto byte_size = return_compiler_type.GetByteSize(nullptr); + llvm::Optional<uint64_t> byte_size = + return_compiler_type.GetByteSize(nullptr); if (byte_size && *byte_size > 0) { const RegisterInfo *altivec_reg = reg_ctx->GetRegisterInfoByName("v2", 0); if (altivec_reg) { @@ -658,7 +662,7 @@ ValueObjectSP ABISysV_ppc::GetReturnValueObjectImpl( if (!reg_ctx_sp) return return_valobj_sp; - auto bit_width = return_compiler_type.GetBitSize(&thread); + llvm::Optional<uint64_t> bit_width = return_compiler_type.GetBitSize(&thread); if (!bit_width) return return_valobj_sp; if (return_compiler_type.IsAggregateType()) { @@ -702,7 +706,8 @@ ValueObjectSP ABISysV_ppc::GetReturnValueObjectImpl( CompilerType field_compiler_type = return_compiler_type.GetFieldAtIndex( idx, name, &field_bit_offset, nullptr, nullptr); - auto field_bit_width = field_compiler_type.GetBitSize(&thread); + llvm::Optional<uint64_t> field_bit_width = + field_compiler_type.GetBitSize(&thread); if (!field_bit_width) return return_valobj_sp; diff --git a/lldb/source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.cpp b/lldb/source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.cpp index 0bbf9a6648f..b6240d90878 100644 --- a/lldb/source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.cpp +++ b/lldb/source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.cpp @@ -280,7 +280,7 @@ bool ABISysV_ppc64::GetArgumentValues(Thread &thread, ValueList &values) const { // We currently only support extracting values with Clang QualTypes. Do we // care about others? CompilerType compiler_type = value->GetCompilerType(); - auto bit_size = compiler_type.GetBitSize(&thread); + llvm::Optional<uint64_t> bit_size = compiler_type.GetBitSize(&thread); if (!bit_size) return false; bool is_signed; @@ -350,7 +350,8 @@ Status ABISysV_ppc64::SetReturnValueObject(lldb::StackFrameSP &frame_sp, error.SetErrorString( "We don't support returning complex values at present"); else { - auto bit_width = compiler_type.GetBitSize(frame_sp.get()); + llvm::Optional<uint64_t> bit_width = + compiler_type.GetBitSize(frame_sp.get()); if (!bit_width) { error.SetErrorString("can't get size of type"); return error; @@ -653,7 +654,7 @@ private: DataExtractor de(&raw_data, sizeof(raw_data), m_byte_order, m_addr_size); offset_t offset = 0; - auto byte_size = type.GetByteSize(nullptr); + llvm::Optional<uint64_t> byte_size = type.GetByteSize(nullptr); if (!byte_size) return {}; switch (*byte_size) { @@ -787,7 +788,7 @@ private: CompilerType elem_type; if (m_type.IsHomogeneousAggregate(&elem_type)) { uint32_t type_flags = elem_type.GetTypeInfo(); - auto elem_size = elem_type.GetByteSize(nullptr); + llvm::Optional<uint64_t> elem_size = elem_type.GetByteSize(nullptr); if (!elem_size) return {}; if (type_flags & eTypeIsComplex || !(type_flags & eTypeIsFloat)) { diff --git a/lldb/source/Plugins/ABI/SysV-s390x/ABISysV_s390x.cpp b/lldb/source/Plugins/ABI/SysV-s390x/ABISysV_s390x.cpp index c4b28b67661..d8056ea7d35 100644 --- a/lldb/source/Plugins/ABI/SysV-s390x/ABISysV_s390x.cpp +++ b/lldb/source/Plugins/ABI/SysV-s390x/ABISysV_s390x.cpp @@ -376,7 +376,7 @@ bool ABISysV_s390x::GetArgumentValues(Thread &thread, ValueList &values) const { // We currently only support extracting values with Clang QualTypes. Do we // care about others? CompilerType compiler_type = value->GetCompilerType(); - auto bit_size = compiler_type.GetBitSize(&thread); + llvm::Optional<uint64_t> bit_size = compiler_type.GetBitSize(&thread); if (!bit_size) return false; bool is_signed; @@ -446,7 +446,8 @@ Status ABISysV_s390x::SetReturnValueObject(lldb::StackFrameSP &frame_sp, error.SetErrorString( "We don't support returning complex values at present"); else { - auto bit_width = compiler_type.GetBitSize(frame_sp.get()); + llvm::Optional<uint64_t> bit_width = + compiler_type.GetBitSize(frame_sp.get()); if (!bit_width) { error.SetErrorString("can't get type size"); return error; @@ -511,9 +512,9 @@ ValueObjectSP ABISysV_s390x::GetReturnValueObjectSimple( bool success = false; if (type_flags & eTypeIsInteger) { - // Extract the register context so we can read arguments from registers - - auto byte_size = return_compiler_type.GetByteSize(nullptr); + // Extract the register context so we can read arguments from registers. + llvm::Optional<uint64_t> byte_size = + return_compiler_type.GetByteSize(nullptr); if (!byte_size) return return_valobj_sp; uint64_t raw_value = thread.GetRegisterContext()->ReadRegisterAsUnsigned( @@ -559,7 +560,8 @@ ValueObjectSP ABISysV_s390x::GetReturnValueObjectSimple( if (type_flags & eTypeIsComplex) { // Don't handle complex yet. } else { - auto byte_size = return_compiler_type.GetByteSize(nullptr); + llvm::Optional<uint64_t> byte_size = + return_compiler_type.GetByteSize(nullptr); if (byte_size && *byte_size <= sizeof(long double)) { const RegisterInfo *f0_info = reg_ctx->GetRegisterInfoByName("f0", 0); RegisterValue f0_value; diff --git a/lldb/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp b/lldb/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp index 9a3cb2f2902..dc3e475e3b8 100644 --- a/lldb/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp +++ b/lldb/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp @@ -1263,7 +1263,7 @@ bool ABISysV_x86_64::GetArgumentValues(Thread &thread, // We currently only support extracting values with Clang QualTypes. Do we // care about others? CompilerType compiler_type = value->GetCompilerType(); - auto bit_size = compiler_type.GetBitSize(&thread); + llvm::Optional<uint64_t> bit_size = compiler_type.GetBitSize(&thread); if (!bit_size) return false; bool is_signed; @@ -1333,7 +1333,8 @@ Status ABISysV_x86_64::SetReturnValueObject(lldb::StackFrameSP &frame_sp, error.SetErrorString( "We don't support returning complex values at present"); else { - auto bit_width = compiler_type.GetBitSize(frame_sp.get()); + llvm::Optional<uint64_t> bit_width = + compiler_type.GetBitSize(frame_sp.get()); if (!bit_width) { error.SetErrorString("can't get type size"); return error; @@ -1401,7 +1402,8 @@ ValueObjectSP ABISysV_x86_64::GetReturnValueObjectSimple( if (type_flags & eTypeIsInteger) { // Extract the register context so we can read arguments from registers - auto byte_size = return_compiler_type.GetByteSize(nullptr); + llvm::Optional<uint64_t> byte_size = + return_compiler_type.GetByteSize(nullptr); if (!byte_size) return return_valobj_sp; uint64_t raw_value = thread.GetRegisterContext()->ReadRegisterAsUnsigned( @@ -1447,7 +1449,8 @@ ValueObjectSP ABISysV_x86_64::GetReturnValueObjectSimple( if (type_flags & eTypeIsComplex) { // Don't handle complex yet. } else { - auto byte_size = return_compiler_type.GetByteSize(nullptr); + llvm::Optional<uint64_t> byte_size = + return_compiler_type.GetByteSize(nullptr); if (byte_size && *byte_size <= sizeof(long double)) { const RegisterInfo *xmm0_info = reg_ctx->GetRegisterInfoByName("xmm0", 0); @@ -1485,7 +1488,8 @@ ValueObjectSP ABISysV_x86_64::GetReturnValueObjectSimple( return_valobj_sp = ValueObjectConstResult::Create( thread.GetStackFrameAtIndex(0).get(), value, ConstString("")); } else if (type_flags & eTypeIsVector) { - auto byte_size = return_compiler_type.GetByteSize(nullptr); + llvm::Optional<uint64_t> byte_size = + return_compiler_type.GetByteSize(nullptr); if (byte_size && *byte_size > 0) { const RegisterInfo *altivec_reg = reg_ctx->GetRegisterInfoByName("xmm0", 0); @@ -1571,7 +1575,7 @@ ValueObjectSP ABISysV_x86_64::GetReturnValueObjectImpl( if (!reg_ctx_sp) return return_valobj_sp; - auto bit_width = return_compiler_type.GetBitSize(&thread); + llvm::Optional<uint64_t> bit_width = return_compiler_type.GetBitSize(&thread); if (!bit_width) return return_valobj_sp; if (return_compiler_type.IsAggregateType()) { @@ -1624,7 +1628,8 @@ ValueObjectSP ABISysV_x86_64::GetReturnValueObjectImpl( CompilerType field_compiler_type = return_compiler_type.GetFieldAtIndex( idx, name, &field_bit_offset, nullptr, nullptr); - auto field_bit_width = field_compiler_type.GetBitSize(&thread); + llvm::Optional<uint64_t> field_bit_width = + field_compiler_type.GetBitSize(&thread); // if we don't know the size of the field (e.g. invalid type), just // bail out diff --git a/lldb/source/Plugins/Architecture/Mips/ArchitectureMips.cpp b/lldb/source/Plugins/Architecture/Mips/ArchitectureMips.cpp index a8f99e2cc39..0cbbd992232 100644 --- a/lldb/source/Plugins/Architecture/Mips/ArchitectureMips.cpp +++ b/lldb/source/Plugins/Architecture/Mips/ArchitectureMips.cpp @@ -127,7 +127,7 @@ lldb::addr_t ArchitectureMips::GetBreakableLoadAddress(lldb::addr_t addr, return addr; // Adjust the breakable address - auto breakable_addr = addr - insn->GetOpcode().GetByteSize(); + uint64_t breakable_addr = addr - insn->GetOpcode().GetByteSize(); if (log) log->Printf("Target::%s Breakpoint at 0x%8.8" PRIx64 " is adjusted to 0x%8.8" PRIx64 " due to delay slot\n", diff --git a/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp b/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp index 1a4a1432dda..d66ee83e0fe 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp @@ -310,7 +310,7 @@ bool IRForTarget::CreateResultVariable(llvm::Function &llvm_function) { lldb::TargetSP target_sp(m_execution_unit.GetTarget()); lldb_private::ExecutionContext exe_ctx(target_sp, true); - auto bit_size = + llvm::Optional<uint64_t> bit_size = m_result_type.GetBitSize(exe_ctx.GetBestExecutionContextScope()); if (!bit_size) { lldb_private::StreamString type_desc_stream; @@ -1372,7 +1372,7 @@ bool IRForTarget::MaybeHandleVariable(Value *llvm_value_ptr) { value_type = global_variable->getType(); } - auto value_size = compiler_type.GetByteSize(nullptr); + llvm::Optional<uint64_t> value_size = compiler_type.GetByteSize(nullptr); if (!value_size) return false; lldb::offset_t value_alignment = diff --git a/lldb/source/Plugins/Language/CPlusPlus/CxxStringTypes.cpp b/lldb/source/Plugins/Language/CPlusPlus/CxxStringTypes.cpp index 6a41ff84e0b..24185b31446 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/CxxStringTypes.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/CxxStringTypes.cpp @@ -101,7 +101,7 @@ bool lldb_private::formatters::WCharStringSummaryProvider( return false; // Safe to pass nullptr for exe_scope here. - auto size = wchar_compiler_type.GetBitSize(nullptr); + llvm::Optional<uint64_t> size = wchar_compiler_type.GetBitSize(nullptr); if (!size) return false; const uint32_t wchar_size = *size; @@ -198,7 +198,7 @@ bool lldb_private::formatters::WCharSummaryProvider( return false; // Safe to pass nullptr for exe_scope here. - auto size = wchar_compiler_type.GetBitSize(nullptr); + llvm::Optional<uint64_t> size = wchar_compiler_type.GetBitSize(nullptr); if (!size) return false; const uint32_t wchar_size = *size; diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp b/lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp index af118a71d09..7e8c06bd4c7 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp @@ -255,7 +255,7 @@ bool lldb_private::formatters::LibCxxMapIteratorSyntheticFrontEnd::Update() { ast_ctx->GetBasicType(lldb::eBasicTypeVoid).GetPointerType()}, {"cw", ast_ctx->GetBasicType(lldb::eBasicTypeBool)}, {"payload", pair_type}}); - auto size = tree_node_type.GetByteSize(nullptr); + llvm::Optional<uint64_t> size = tree_node_type.GetByteSize(nullptr); if (!size) return false; DataBufferSP buffer_sp(new DataBufferHeap(*size, 0)); diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxxBitset.cpp b/lldb/source/Plugins/Language/CPlusPlus/LibCxxBitset.cpp index 0d39e5a57cf..489ac4d9607 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/LibCxxBitset.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxxBitset.cpp @@ -80,7 +80,8 @@ ValueObjectSP BitsetFrontEnd::GetChildAtIndex(size_t idx) { ValueObjectSP chunk; // For small bitsets __first_ is not an array, but a plain size_t. if (m_first->GetCompilerType().IsArrayType(&type, nullptr, nullptr)) { - auto bit_size = type.GetBitSize(ctx.GetBestExecutionContextScope()); + llvm::Optional<uint64_t> bit_size = + type.GetBitSize(ctx.GetBestExecutionContextScope()); if (!bit_size || *bit_size == 0) return {}; chunk = m_first->GetChildAtIndex(idx / *bit_size, true); @@ -91,7 +92,8 @@ ValueObjectSP BitsetFrontEnd::GetChildAtIndex(size_t idx) { if (!type || !chunk) return {}; - auto bit_size = type.GetBitSize(ctx.GetBestExecutionContextScope()); + llvm::Optional<uint64_t> bit_size = + type.GetBitSize(ctx.GetBestExecutionContextScope()); if (!bit_size || *bit_size == 0) return {}; size_t chunk_idx = idx % *bit_size; diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxxInitializerList.cpp b/lldb/source/Plugins/Language/CPlusPlus/LibCxxInitializerList.cpp index a692c120b35..390483d0266 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/LibCxxInitializerList.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxxInitializerList.cpp @@ -94,7 +94,7 @@ bool lldb_private::formatters::LibcxxInitializerListSyntheticFrontEnd:: if (!m_element_type.IsValid()) return false; - if (auto size = m_element_type.GetByteSize(nullptr)) { + if (llvm::Optional<uint64_t> size = m_element_type.GetByteSize(nullptr)) { m_element_size = *size; // Store raw pointers or end up with a circular dependency. m_start = m_backend.GetChildMemberWithName(g___begin_, true).get(); diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxxVector.cpp b/lldb/source/Plugins/Language/CPlusPlus/LibCxxVector.cpp index 9cde54b4f4f..ed405c87517 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/LibCxxVector.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxxVector.cpp @@ -145,7 +145,7 @@ bool lldb_private::formatters::LibcxxStdVectorSyntheticFrontEnd::Update() { if (!data_type_finder_sp) return false; m_element_type = data_type_finder_sp->GetCompilerType().GetPointeeType(); - if (auto size = m_element_type.GetByteSize(nullptr)) { + if (llvm::Optional<uint64_t> size = m_element_type.GetByteSize(nullptr)) { m_element_size = *size; if (m_element_size > 0) { @@ -213,7 +213,7 @@ lldb_private::formatters::LibcxxVectorBoolSyntheticFrontEnd::GetChildAtIndex( return {}; mask = 1 << bit_index; bool bit_set = ((byte & mask) != 0); - auto size = m_bool_type.GetByteSize(nullptr); + llvm::Optional<uint64_t> size = m_bool_type.GetByteSize(nullptr); if (!size) return {}; DataBufferSP buffer_sp(new DataBufferHeap(*size, 0)); diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibStdcpp.cpp b/lldb/source/Plugins/Language/CPlusPlus/LibStdcpp.cpp index f25391f9512..695371fc399 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/LibStdcpp.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/LibStdcpp.cpp @@ -298,7 +298,7 @@ bool lldb_private::formatters::LibStdcppWStringSummaryProvider( return false; // Safe to pass nullptr for exe_scope here. - auto size = wchar_compiler_type.GetBitSize(nullptr); + llvm::Optional<uint64_t> size = wchar_compiler_type.GetBitSize(nullptr); if (!size) return false; const uint32_t wchar_size = *size; diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp index b0d93460e01..8253fc8cfb4 100644 --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp @@ -513,7 +513,7 @@ void ClassDescriptorV2::iVarsStorage::fill(AppleObjCRuntimeV2 &runtime, CompilerType ivar_type = encoding_to_type_sp->RealizeType(type, for_expression); if (ivar_type) { - auto ivar_size = ivar_type.GetByteSize(nullptr); + llvm::Optional<uint64_t> ivar_size = ivar_type.GetByteSize(nullptr); LLDB_LOGV(log, "name = {0}, encoding = {1}, offset_ptr = {2:x}, size = " "{3}, type_size = {4}", diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp index 1d9a18dcbbe..70d48e5f1df 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp @@ -1850,7 +1850,8 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc, clang_type = ClangASTContext::CreateMemberPointerType( class_clang_type, pointee_clang_type); - if (auto clang_type_size = clang_type.GetByteSize(nullptr)) { + if (llvm::Optional<uint64_t> clang_type_size = + clang_type.GetByteSize(nullptr)) { byte_size = *clang_type_size; type_sp.reset(new Type(die.GetID(), dwarf, type_name_const_str, byte_size, NULL, LLDB_INVALID_UID, @@ -2046,7 +2047,7 @@ bool DWARFASTParserClang::ParseTemplateDIE( clang_type.IsIntegerOrEnumerationType(is_signed); if (tag == DW_TAG_template_value_parameter && uval64_valid) { - auto size = clang_type.GetBitSize(nullptr); + llvm::Optional<uint64_t> size = clang_type.GetBitSize(nullptr); if (!size) return false; llvm::APInt apint(*size, uval64, is_signed); |