forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reland: [lldb] Fix crash missing MSInheritanceAttr with DWARF on Wind…
…ows (llvm#112928) Member pointers refer to data or function members of a `CXXRecordDecl`, which require a `MSInheritanceAttr` in order to be complete. Without that we cannot calculate the size of a member pointer in memory. The attempt has been causing a crash further down in the clang AST context. In order to implement the feature, DWARF will need a new attribtue to convey the information. For the moment, this patch teaches LLDB to handle to situation and avoid the crash.
- Loading branch information
1 parent
af014c9
commit 33b9515
Showing
2 changed files
with
27 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 -o %t_win.obj -- %s | ||
// 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; } |