[Lldb-commits] [lldb] [lldb] Fix crash missing MSInheritanceAttr on CXXRecordDecl with DWARF on Windows (PR #112928)

Stefan Gränitz via lldb-commits lldb-commits at lists.llvm.org
Fri Oct 18 09:08:57 PDT 2024


https://github.com/weliveindetail created https://github.com/llvm/llvm-project/pull/112928

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).

>From bb66f56138cab9651aff4ac09096ede975c90701 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20Gr=C3=A4nitz?= <stefan.graenitz at gmail.com>
Date: Fri, 18 Oct 2024 17:44:26 +0200
Subject: [PATCH] [lldb] Fix crash due to missing MSInheritanceAttr on
 CXXRecordDecl for DWARF on Windows

---
 lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp | 3 +++
 1 file changed, 3 insertions(+)

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;
   }



More information about the lldb-commits mailing list