Skip to content

Conversation

@PathogenDavid
Copy link
Contributor

clangsharp_Cursor_getDefinition currently tries to create a CXCursor for the defining the definition without checking if the definition was actually found. This causes this assert to be hit in debug builds:

https://github.com/llvm/llvm-project/blob/d28af7c654d8db0b68c175db5ce212d74fb5e9bc/clang/tools/libclang/CXCursor.cpp#L142

and differs from the implementation of clang_getCursorDefinition:

https://github.com/llvm/llvm-project/blob/d28af7c654d8db0b68c175db5ce212d74fb5e9bc/clang/tools/libclang/CIndex.cpp#L6444-L6446

This PR reworks clangsharp_Cursor_getDefinition to return a null cursor if the definition is null.

@tannergooding tannergooding merged commit 84e5f96 into dotnet:main Sep 5, 2021
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