Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

ceresgalax
Copy link
Contributor

  • Work around a clang crash in clangsharp_Cursor_getLambdaStaticInvoker when CRD->getLambdaCallOperator() returns null and CRD->getLambdaStaticInvoker() is called.

  • clangsharp_Cursor_getNumAttrs: Calling D->getAttrs() will assert if D->hasAttrs() returns false. Fix by checking D->hasAttrs() first.

  • A CXXRecordDecl may return null for getDestructor. Change the C# CXXRecordDecl Destructor property to be nullable to support this case.

Hopefully these changes make inspecting ClangSharp objects in the debugger much less likely to crash.

…uctor property.

* Work around a clang crash in clangsharp_Cursor_getLambdaStaticInvoker when
  CRD->getLambdaCallOperator() returns null and
  CRD->getLambdaStaticInvoker() is called.

* clangsharp_Cursor_getNumAttrs: Calling D->getAttrs() will assert if
  D->hasAttrs() returns false. Fix by checking D->hasAttrs() first.

* A CXXRecordDecl may return null for getDestructor. Change the C# CXXRecordDecl
  Destructor property to be nullable to support this case.
@ceresgalax
Copy link
Contributor Author

@dotnet-policy-service agree

tannergooding
tannergooding previously approved these changes Feb 4, 2024
@tannergooding
Copy link
Member

Looks like there's a compile failure since Destructor is now marked nullable, which means that explicit handling needs to be added

@ceresgalax ceresgalax changed the title Fix native crashes / asserts in libClangSharp and CXXRecordDecl Destuuctor property. Fix native crashes / asserts in libClangSharp and CXXRecordDecl Destuctor property. Feb 5, 2024
* Add a diagnostic if the destructor property is null despite other
  bool properties suggesting the precense of a destructor.
@ceresgalax ceresgalax changed the title Fix native crashes / asserts in libClangSharp and CXXRecordDecl Destuctor property. Fix native crashes / asserts in libClangSharp and CXXRecordDecl Destructor property. Feb 5, 2024
@tannergooding tannergooding merged commit b9479d2 into dotnet:main Feb 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants