Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix clangsharp_Cursor_getDefinition not handling declarations with no definition #264

Merged

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