Stefan =?utf-8?q?Gränitz?= <stefan.graen...@gmail.com> Message-ID: In-Reply-To: <llvm.org/llvm/llvm-project/pull/112...@github.com>
llvmbot wrote: <!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-lldb Author: Stefan Gränitz (weliveindetail) <details> <summary>Changes</summary> In the MS ABI, member pointers to `CXXRecordDecl`s must have a `MSInheritanceAttr` in order to be complete. Otherwise we cannot query their size in memory. This patch checks `MemberPointer` types for completeness (eventually looking at the existence of the attribute) to avoid a crash [further down in the clang AST context](https://github.com/llvm/llvm-project/blob/release/19.x/clang/lib/AST/MicrosoftCXXABI.cpp#L282). --- Full diff: https://github.com/llvm/llvm-project/pull/112928.diff 2 Files Affected: - (modified) lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp (+3) - (added) lldb/test/Shell/SymbolFile/DWARF/x86/ms-abi.cpp (+45) ``````````diff diff --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp index fe0c53a7e9a3ea..a23dce97f3f299 100644 --- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp +++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp @@ -2771,6 +2771,9 @@ static bool GetCompleteQualType(clang::ASTContext *ast, ast, llvm::cast<clang::AttributedType>(qual_type)->getModifiedType(), allow_completion); + case clang::Type::MemberPointer: + return !qual_type.getTypePtr()->isIncompleteType(); + default: break; } diff --git a/lldb/test/Shell/SymbolFile/DWARF/x86/ms-abi.cpp b/lldb/test/Shell/SymbolFile/DWARF/x86/ms-abi.cpp new file mode 100644 index 00000000000000..0e51ec99934f4c --- /dev/null +++ b/lldb/test/Shell/SymbolFile/DWARF/x86/ms-abi.cpp @@ -0,0 +1,45 @@ +// REQUIRES: lld + +// Check that we don't crash on variables without MSInheritanceAttr + +// RUN: %clang -c --target=x86_64-windows-msvc -gdwarf %s -o %t.obj +// RUN: lld-link /out:%t.exe %t.obj /nodefaultlib /entry:main /debug +// RUN: %lldb -f %t.exe -b -o "target variable mp1 mp2 mp3 mp4 mp5 mp6 mp7 mp8 mp9" + +class SI { + int si; +}; +struct SI2 { + int si2; +}; +class MI : SI, SI2 { + int mi; +}; +class MI2 : MI { + int mi2; +}; +class VI : virtual MI { + int vi; +}; +class VI2 : virtual SI, virtual SI2 { + int vi; +}; +class /* __unspecified_inheritance*/ UI; + +typedef void (SI::*SITYPE)(); +typedef void (MI::*MITYPE)(); +typedef void (MI2::*MI2TYPE)(); +typedef void (VI::*VITYPE)(); +typedef void (VI2::*VI2TYPE)(); +typedef void (UI::*UITYPE)(); +SITYPE mp1 = nullptr; +MITYPE mp2 = nullptr; +MI2TYPE mp3 = nullptr; +VITYPE mp4 = nullptr; +VI2TYPE mp5 = nullptr; +UITYPE mp6 = nullptr; +MITYPE *mp7 = nullptr; +VI2TYPE *mp8 = nullptr; +int SI::*mp9 = nullptr; + +int main() {} `````````` </details> https://github.com/llvm/llvm-project/pull/112928 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits