Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[lldb] Fix crash missing MSInheritanceAttr on CXXRecordDecl with DWARF on Windows #112928

3 changes: 3 additions & 0 deletions lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Copy link
Member

@Michael137 Michael137 Oct 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, so for non-MS ABI isIncompleteType will pretty much work as before, and trivially return true. Otherwise it checks for the MSInheritanceAttr. Seems reasonable to me


default:
break;
}
Expand Down
24 changes: 24 additions & 0 deletions lldb/test/Shell/SymbolFile/DWARF/x86/member-pointers.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// REQUIRES: lld

// Itanium ABI:
// RUN: %clang --target=x86_64-pc-linux -gdwarf -c -o %t_linux.o %s
// RUN: %lldb -f %t_linux.o -b -o "target variable mp" | FileCheck %s
//
// CHECK: (char SI::*) mp = 0x0000000000000000

// Microsoft ABI:
// RUN: %clang_cl --target=x86_64-windows-msvc -c -gdwarf %s -o %t_win.obj
// RUN: lld-link /out:%t_win.exe %t_win.obj /nodefaultlib /entry:main /debug
// RUN: %lldb -f %t_win.exe -b -o "target variable mp" | FileCheck --check-prefix=CHECK-MSVC %s
//
// DWARF has no representation of MSInheritanceAttr, so we cannot determine the size
// of member-pointers yet. For the moment, make sure we don't crash on such variables.
// CHECK-MSVC: error: Unable to determine byte size.

struct SI {
char si;
};

char SI::*mp = &SI::si;

int main() { return 0; }
Loading