llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-lldb Author: Stefan Gränitz (weliveindetail) <details> <summary>Changes</summary> Following up from https://github.com/llvm/llvm-project/pull/112928, we can reuse the [approach from Clang Sema](https://github.com/llvm/llvm-project/blob/release/19.x/clang/lib/Sema/SemaType.cpp#L9039) to infer the `MSInheritanceModel` and add the necessary attribute manually. This allows the inspection of member function pointers with DWARF on Windows. --- Full diff: https://github.com/llvm/llvm-project/pull/115177.diff 2 Files Affected: - (modified) lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp (+5) - (modified) lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp (+7-1) ``````````diff diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp index a30d898a93cc4d..319540389c05ee 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp @@ -2138,6 +2138,11 @@ bool DWARFASTParserClang::CompleteRecordType(const DWARFDIE &die, if (record_decl) GetClangASTImporter().SetRecordLayout(record_decl, layout_info); + // TODO: Only necessary if we target the Microsoft C++ ABI + auto IM = record_decl->calculateInheritanceModel(); + record_decl->addAttr(clang::MSInheritanceAttr::CreateImplicit( + m_ast.getASTContext(), true, {}, clang::MSInheritanceAttr::Spelling(IM))); + // Now parse all contained types inside of the class. We make forward // declarations to all classes, but we need the CXXRecordDecl to have decls // for all contained types because we don't get asked for them via the diff --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp index f5063175d6e070..a1e224a395e69f 100644 --- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp +++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp @@ -2771,8 +2771,14 @@ static bool GetCompleteQualType(clang::ASTContext *ast, ast, llvm::cast<clang::AttributedType>(qual_type)->getModifiedType(), allow_completion); - case clang::Type::MemberPointer: + case clang::Type::MemberPointer: { + auto *MPT = qual_type.getTypePtr()->castAs<clang::MemberPointerType>(); + if (MPT->getClass()->isRecordType()) + GetCompleteRecordType(ast, clang::QualType(MPT->getClass(), 0), + allow_completion); + return !qual_type.getTypePtr()->isIncompleteType(); + } default: break; `````````` </details> https://github.com/llvm/llvm-project/pull/115177 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits