Page MenuHomePhabricator

[libclang] Add support for querying cursor availability
ClosedPublic

Authored by jklaehn on Aug 21 2017, 11:38 AM.

Details

Summary

This patch allows checking the availability of cursors through libclang and clang.cindex (Python).
This e.g. allows to check whether a C++ member function has been marked as deleted.

Diff Detail

Repository
rL LLVM

Event Timeline

jklaehn created this revision.Aug 21 2017, 11:38 AM
jbcoe requested changes to this revision.Sep 8 2017, 12:32 PM
jbcoe added inline comments.
bindings/python/tests/cindex/test_cursor.py
399 ↗(On Diff #112020)

Can you add tests for the other AvailabilityKinds?

This revision now requires changes to proceed.Sep 8 2017, 12:32 PM
jklaehn updated this revision to Diff 116456.Sep 23 2017, 3:48 AM
jklaehn edited edge metadata.
jklaehn marked an inline comment as done.

Added test for AvailabilityKind.DEPRECATED. NOT_ACCESSIBLE is never returned by clang_getCursorAvailability but only only used in CodeCompletionResult.

jbcoe added inline comments.Sep 25 2017, 8:11 AM
bindings/python/tests/cindex/test_cursor.py
407 ↗(On Diff #116456)

It might be better to use a user-defined function that is explicitly deprecated rather than relying on 3rd party standard includes deprecating things for you.

jbcoe requested changes to this revision.Sep 26 2017, 12:56 AM
This revision now requires changes to proceed.Sep 26 2017, 12:56 AM
jklaehn updated this revision to Diff 118333.Oct 10 2017, 2:14 AM
jklaehn edited edge metadata.

Use user-defined function for test of AvailabilityKind.DEPRECATED.

jbcoe accepted this revision.Oct 10 2017, 2:22 PM

LGTM

Would you like me to commit this for you?

This revision is now accepted and ready to land.Oct 10 2017, 2:22 PM
jklaehn marked an inline comment as done.Oct 11 2017, 1:05 AM

LGTM

Would you like me to commit this for you?

Yes, that would be great!

This revision was automatically updated to reflect the committed changes.