From cae9acaf27d786a0b67fa1d76253f6d9a09e2f8b Mon Sep 17 00:00:00 2001 From: Raul Tambre Date: Tue, 2 Apr 2024 15:32:09 +0300 Subject: [PATCH] lldb: fix compiling for P2996 --- .../Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp | 4 +--- .../Plugins/SymbolFile/NativePDB/UdtRecordCompleter.cpp | 2 +- lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp | 5 ++--- lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp | 7 +++---- lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h | 3 +-- lldb/unittests/Symbol/TestTypeSystemClang.cpp | 5 ++--- 6 files changed, 10 insertions(+), 16 deletions(-) diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp index 54d06b1115a229..f31f4718e19def 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp @@ -1440,7 +1440,6 @@ void DWARFASTParserClang::ParseInheritance( DWARFFormValue encoding_form; AccessType accessibility = default_accessibility; bool is_virtual = false; - bool is_base_of_class = true; off_t member_byte_offset = 0; for (uint32_t i = 0; i < attributes.Size(); ++i) { @@ -1493,8 +1492,7 @@ void DWARFASTParserClang::ParseInheritance( } std::unique_ptr result = ast->CreateBaseClassSpecifier(base_class_clang_type.GetOpaqueQualType(), - accessibility, is_virtual, - is_base_of_class); + accessibility, is_virtual); if (!result) return; diff --git a/lldb/source/Plugins/SymbolFile/NativePDB/UdtRecordCompleter.cpp b/lldb/source/Plugins/SymbolFile/NativePDB/UdtRecordCompleter.cpp index fab3ca989c0ec6..7d7451a0fa531d 100644 --- a/lldb/source/Plugins/SymbolFile/NativePDB/UdtRecordCompleter.cpp +++ b/lldb/source/Plugins/SymbolFile/NativePDB/UdtRecordCompleter.cpp @@ -76,7 +76,7 @@ clang::QualType UdtRecordCompleter::AddBaseClassForTypeIndex( std::unique_ptr base_spec = m_ast_builder.clang().CreateBaseClassSpecifier( qt.getAsOpaquePtr(), TranslateMemberAccess(access), - vtable_idx.has_value(), udt_cvt.kind() == LF_CLASS); + vtable_idx.has_value()); if (!base_spec) return {}; diff --git a/lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp b/lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp index e915bff9e4a479..39e2e283805bee 100644 --- a/lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp +++ b/lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp @@ -1387,9 +1387,8 @@ void PDBASTParser::AddRecordBases( auto is_virtual = base->isVirtualBaseClass(); std::unique_ptr base_spec = - m_ast.CreateBaseClassSpecifier( - base_comp_type.GetOpaqueQualType(), access, is_virtual, - record_kind == llvm::to_underlying(clang::TagTypeKind::Class)); + m_ast.CreateBaseClassSpecifier(base_comp_type.GetOpaqueQualType(), + access, is_virtual); lldbassert(base_spec); base_classes.push_back(std::move(base_spec)); diff --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp index 4a1c8d57655215..8e1a4ea1601836 100644 --- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp +++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp @@ -7798,16 +7798,15 @@ void TypeSystemClang::AddMethodOverridesForCXXRecordType( std::unique_ptr TypeSystemClang::CreateBaseClassSpecifier(lldb::opaque_compiler_type_t type, - AccessType access, bool is_virtual, - bool base_of_class) { + AccessType access, bool is_virtual) { if (!type) return nullptr; return std::make_unique( - clang::SourceRange(), is_virtual, base_of_class, + clang::SourceRange(), is_virtual, TypeSystemClang::ConvertAccessTypeToAccessSpecifier(access), getASTContext().getTrivialTypeSourceInfo(GetQualType(type)), - clang::SourceLocation()); + GetAsCXXRecordDecl(type), clang::SourceLocation()); } bool TypeSystemClang::TransferBaseClasses( diff --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h index 05c303baa41640..977fec89454964 100644 --- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h +++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h @@ -966,8 +966,7 @@ class TypeSystemClang : public TypeSystem { // C++ Base Classes std::unique_ptr CreateBaseClassSpecifier(lldb::opaque_compiler_type_t type, - lldb::AccessType access, bool is_virtual, - bool base_of_class); + lldb::AccessType access, bool is_virtual); bool TransferBaseClasses( lldb::opaque_compiler_type_t type, diff --git a/lldb/unittests/Symbol/TestTypeSystemClang.cpp b/lldb/unittests/Symbol/TestTypeSystemClang.cpp index 30d20b9587f913..9ce3311b80c953 100644 --- a/lldb/unittests/Symbol/TestTypeSystemClang.cpp +++ b/lldb/unittests/Symbol/TestTypeSystemClang.cpp @@ -38,7 +38,6 @@ class TestTypeSystemClang : public testing::Test { } protected: - TypeSystemClang *m_ast = nullptr; std::unique_ptr m_holder; @@ -436,7 +435,7 @@ TEST_F(TestTypeSystemClang, TestRecordHasFields) { TypeSystemClang::StartTagDeclarationDefinition(empty_derived); std::unique_ptr non_empty_base_spec = m_ast->CreateBaseClassSpecifier(non_empty_base.GetOpaqueQualType(), - lldb::eAccessPublic, false, false); + lldb::eAccessPublic, false); bases.push_back(std::move(non_empty_base_spec)); bool result = m_ast->TransferBaseClasses(empty_derived.GetOpaqueQualType(), std::move(bases)); @@ -459,7 +458,7 @@ TEST_F(TestTypeSystemClang, TestRecordHasFields) { TypeSystemClang::StartTagDeclarationDefinition(empty_derived2); std::unique_ptr non_empty_vbase_spec = m_ast->CreateBaseClassSpecifier(non_empty_base.GetOpaqueQualType(), - lldb::eAccessPublic, true, false); + lldb::eAccessPublic, true); bases.push_back(std::move(non_empty_vbase_spec)); result = m_ast->TransferBaseClasses(empty_derived2.GetOpaqueQualType(), std::move(bases));