llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-lldb Author: Michael Buch (Michael137) <details> <summary>Changes</summary> The `CompilerType` is just a wrapper around two pointers, and there is no usage of the `CompilerType` where those are expected to change underneath the caller. To make the interface more straightforward to reason about, this patch changes all instances of `CompilerType&` to `const CompilerType&` around the `DWARFASTParserClang` APIs. We could probably pass these by-value, but all other APIs don't, and this patch just makes the parameter passing convention consistent with the rest of the file. --- Full diff: https://github.com/llvm/llvm-project/pull/103245.diff 3 Files Affected: - (modified) lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.h (+1-1) - (modified) lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp (+9-8) - (modified) lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h (+9-9) ``````````diff diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.h b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.h index abaeb2502cbbdc..636ff4b5cf11dc 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.h +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.h @@ -45,7 +45,7 @@ class DWARFASTParser { const AddressRange &range) = 0; virtual bool CompleteTypeFromDWARF(const DWARFDIE &die, Type *type, - CompilerType &compiler_type) = 0; + const CompilerType &compiler_type) = 0; virtual CompilerDecl GetDeclForUIDFromDWARF(const DWARFDIE &die) = 0; diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp index 86b3117f361cd1..3c58be26c266bb 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp @@ -2057,7 +2057,7 @@ bool DWARFASTParserClang::ParseTemplateParameterInfos( bool DWARFASTParserClang::CompleteRecordType(const DWARFDIE &die, lldb_private::Type *type, - CompilerType &clang_type) { + const CompilerType &clang_type) { const dw_tag_t tag = die.Tag(); SymbolFileDWARF *dwarf = die.GetDWARF(); @@ -2152,7 +2152,7 @@ bool DWARFASTParserClang::CompleteRecordType(const DWARFDIE &die, bool DWARFASTParserClang::CompleteEnumType(const DWARFDIE &die, lldb_private::Type *type, - CompilerType &clang_type) { + const CompilerType &clang_type) { if (TypeSystemClang::StartTagDeclarationDefinition(clang_type)) { if (die.HasChildren()) { bool is_signed = false; @@ -2165,9 +2165,9 @@ bool DWARFASTParserClang::CompleteEnumType(const DWARFDIE &die, return (bool)clang_type; } -bool DWARFASTParserClang::CompleteTypeFromDWARF(const DWARFDIE &die, - lldb_private::Type *type, - CompilerType &clang_type) { +bool DWARFASTParserClang::CompleteTypeFromDWARF( + const DWARFDIE &die, lldb_private::Type *type, + const CompilerType &clang_type) { SymbolFileDWARF *dwarf = die.GetDWARF(); std::lock_guard<std::recursive_mutex> guard( @@ -2244,7 +2244,7 @@ DWARFASTParserClang::GetDeclContextContainingUIDFromDWARF(const DWARFDIE &die) { } size_t DWARFASTParserClang::ParseChildEnumerators( - lldb_private::CompilerType &clang_type, bool is_signed, + const lldb_private::CompilerType &clang_type, bool is_signed, uint32_t enumerator_byte_size, const DWARFDIE &parent_die) { if (!parent_die) return 0; @@ -3032,7 +3032,7 @@ void DWARFASTParserClang::ParseSingleMember( } bool DWARFASTParserClang::ParseChildMembers( - const DWARFDIE &parent_die, CompilerType &class_clang_type, + const DWARFDIE &parent_die, const CompilerType &class_clang_type, std::vector<std::unique_ptr<clang::CXXBaseSpecifier>> &base_classes, std::vector<DWARFDIE> &member_function_dies, std::vector<DWARFDIE> &contained_type_dies, @@ -3763,7 +3763,8 @@ bool DWARFASTParserClang::ShouldCreateUnnamedBitfield( } void DWARFASTParserClang::ParseRustVariantPart( - DWARFDIE &die, const DWARFDIE &parent_die, CompilerType &class_clang_type, + DWARFDIE &die, const DWARFDIE &parent_die, + const CompilerType &class_clang_type, const lldb::AccessType default_accesibility, ClangASTImporter::LayoutInfo &layout_info) { assert(die.Tag() == llvm::dwarf::DW_TAG_variant_part); diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h index 4b0ae026bce7e9..ae6720608121f5 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h @@ -61,10 +61,10 @@ class DWARFASTParserClang : public lldb_private::plugin::dwarf::DWARFASTParser { const lldb_private::plugin::dwarf::DWARFDIE &die, const lldb_private::AddressRange &func_range) override; - bool - CompleteTypeFromDWARF(const lldb_private::plugin::dwarf::DWARFDIE &die, - lldb_private::Type *type, - lldb_private::CompilerType &compiler_type) override; + bool CompleteTypeFromDWARF( + const lldb_private::plugin::dwarf::DWARFDIE &die, + lldb_private::Type *type, + const lldb_private::CompilerType &compiler_type) override; lldb_private::CompilerDecl GetDeclForUIDFromDWARF( const lldb_private::plugin::dwarf::DWARFDIE &die) override; @@ -178,7 +178,7 @@ class DWARFASTParserClang : public lldb_private::plugin::dwarf::DWARFASTParser { bool ParseChildMembers( const lldb_private::plugin::dwarf::DWARFDIE &die, - lldb_private::CompilerType &class_compiler_type, + const lldb_private::CompilerType &class_compiler_type, std::vector<std::unique_ptr<clang::CXXBaseSpecifier>> &base_classes, std::vector<lldb_private::plugin::dwarf::DWARFDIE> &member_function_dies, std::vector<lldb_private::plugin::dwarf::DWARFDIE> &contained_type_dies, @@ -196,7 +196,7 @@ class DWARFASTParserClang : public lldb_private::plugin::dwarf::DWARFASTParser { unsigned &type_quals); size_t ParseChildEnumerators( - lldb_private::CompilerType &compiler_type, bool is_signed, + const lldb_private::CompilerType &compiler_type, bool is_signed, uint32_t enumerator_byte_size, const lldb_private::plugin::dwarf::DWARFDIE &parent_die); @@ -362,10 +362,10 @@ class DWARFASTParserClang : public lldb_private::plugin::dwarf::DWARFASTParser { bool CompleteRecordType(const lldb_private::plugin::dwarf::DWARFDIE &die, lldb_private::Type *type, - lldb_private::CompilerType &clang_type); + const lldb_private::CompilerType &clang_type); bool CompleteEnumType(const lldb_private::plugin::dwarf::DWARFDIE &die, lldb_private::Type *type, - lldb_private::CompilerType &clang_type); + const lldb_private::CompilerType &clang_type); lldb::TypeSP ParseTypeModifier(const lldb_private::SymbolContext &sc, @@ -467,7 +467,7 @@ class DWARFASTParserClang : public lldb_private::plugin::dwarf::DWARFASTParser { void ParseRustVariantPart(lldb_private::plugin::dwarf::DWARFDIE &die, const lldb_private::plugin::dwarf::DWARFDIE &parent_die, - lldb_private::CompilerType &class_clang_type, + const lldb_private::CompilerType &class_clang_type, const lldb::AccessType default_accesibility, lldb_private::ClangASTImporter::LayoutInfo &layout_info); }; `````````` </details> https://github.com/llvm/llvm-project/pull/103245 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits