@@ -14,7 +14,7 @@ public class CXXRecordDecl : RecordDecl
1414 private readonly Lazy < IReadOnlyList < CXXConstructorDecl > > _ctors ;
1515 private readonly Lazy < FunctionTemplateDecl > _dependentLambdaCallOperator ;
1616 private readonly Lazy < ClassTemplateDecl > _describedClassTemplate ;
17- private readonly Lazy < CXXDestructorDecl > _destructor ;
17+ private readonly Lazy < CXXDestructorDecl ? > _destructor ;
1818 private readonly Lazy < IReadOnlyList < FriendDecl > > _friends ;
1919 private readonly Lazy < CXXRecordDecl > _instantiatedFromMemberClass ;
2020 private readonly Lazy < CXXMethodDecl > _lambdaCallOperator ;
@@ -63,7 +63,10 @@ private protected CXXRecordDecl(CXCursor handle, CXCursorKind expectedCursorKind
6363
6464 _dependentLambdaCallOperator = new Lazy < FunctionTemplateDecl > ( ( ) => TranslationUnit . GetOrCreate < FunctionTemplateDecl > ( Handle . DependentLambdaCallOperator ) ) ;
6565 _describedClassTemplate = new Lazy < ClassTemplateDecl > ( ( ) => TranslationUnit . GetOrCreate < ClassTemplateDecl > ( Handle . DescribedCursorTemplate ) ) ;
66- _destructor = new Lazy < CXXDestructorDecl > ( ( ) => TranslationUnit . GetOrCreate < CXXDestructorDecl > ( Handle . Destructor ) ) ;
66+ _destructor = new Lazy < CXXDestructorDecl ? > ( ( ) => {
67+ CXCursor destructor = Handle . Destructor ;
68+ return destructor . IsNull ? null : TranslationUnit . GetOrCreate < CXXDestructorDecl > ( Handle . Destructor ) ;
69+ } ) ;
6770
6871 _friends = new Lazy < IReadOnlyList < FriendDecl > > ( ( ) => {
6972 var numFriends = Handle . NumFriends ;
@@ -126,7 +129,7 @@ private protected CXXRecordDecl(CXCursor handle, CXCursorKind expectedCursorKind
126129
127130 public ClassTemplateDecl DescribedClassTemplate => _describedClassTemplate . Value ;
128131
129- public CXXDestructorDecl Destructor => _destructor . Value ;
132+ public CXXDestructorDecl ? Destructor => _destructor . Value ;
130133
131134 public IReadOnlyList < FriendDecl > Friends => _friends . Value ;
132135
0 commit comments