This is an archive of the discontinued LLVM Phabricator instance.

Add clang_CXXMethod_isMoveAssignmentOperator to libclang
ClosedPublic

Authored by diseraluca on Nov 2 2022, 5:33 AM.

Details

Summary

The new method is a wrapper of CXXMethodDecl::isMoveAssignmentOperator and
can be used to recognized move-assignment operators in libclang.

An export for the function, together with its documentation, was added to
"clang/include/clang-c/Index.h" with an implementation provided in
"clang/tools/libclang/CIndex.cpp". The implementation was based on
similar clang_CXXMethod.* implementations, following the same
structure but calling CXXMethodDecl::isMoveAssignmentOperator for its
main logic.

The new symbol was further added to "clang/tools/libclang/libclang.map"
to be exported, under the LLVM16 tag.

"clang/tools/c-index-test/c-index-test.c" was modified to print a
specific tag, "(move-assignment operator)", for cursors that are
recognized by clang_CXXMethod_isMoveAssignmentOperator.
A new regression test file,
"clang/test/Index/move-assignment-operator.cpp", was added to ensure
whether the correct constructs were recognized or not by the new function.

The "clang/test/Index/get-cursor.cpp" regression test file was updated
as it was affected by the new "(move-assignment operator)" tag.

A binding for the new function was added to libclang's python's
bindings, in "clang/bindings/python/clang/cindex.py", adding a new
method for Cursor, is_move_assignment_operator_method.
An accompanying test was added to
clang/bindings/python/tests/cindex/test_cursor.py, testing the new
function with the same methodology as the corresponding libclang test.

The current release note, clang/docs/ReleaseNotes.rst, was modified to
report the new addition under the "libclang" section.

Diff Detail

Event Timeline

diseraluca created this revision.Nov 2 2022, 5:33 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 2 2022, 5:33 AM
Herald added a subscriber: arphaman. · View Herald Transcript
diseraluca requested review of this revision.Nov 2 2022, 5:33 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 2 2022, 5:33 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript

I finally had some time to look into the pre-merge failure. I couldn't replicate it on my machine by following https://buildkite.com/llvm-project/premerge-checks/builds/119952#01843856-e8c7-4709-89c6-d52d0286862a .

Looking at the log it does not seem related to the patch, I think it might be a flaky failing.
Is there a way to rerun the pre-merge checks?

aaron.ballman accepted this revision.Nov 10 2022, 9:37 AM

I finally had some time to look into the pre-merge failure. I couldn't replicate it on my machine by following https://buildkite.com/llvm-project/premerge-checks/builds/119952#01843856-e8c7-4709-89c6-d52d0286862a .

Looking at the log it does not seem related to the patch, I think it might be a flaky failing.
Is there a way to rerun the pre-merge checks?

Yeah, that looks like a flaky test. You can restart CI by clicking the "Restart Build" link on the Harbormaster instance, I believe (https://reviews.llvm.org/harbormaster/build/296625/). If all else fails, you can usually rebase the patch on main and upload the new patch.

LGTM!

This revision is now accepted and ready to land.Nov 10 2022, 9:37 AM
This revision was landed with ongoing or failed builds.Nov 14 2022, 6:22 AM
This revision was automatically updated to reflect the committed changes.

I finally had some time to look into the pre-merge failure. I couldn't replicate it on my machine by following https://buildkite.com/llvm-project/premerge-checks/builds/119952#01843856-e8c7-4709-89c6-d52d0286862a .

Looking at the log it does not seem related to the patch, I think it might be a flaky failing.
Is there a way to rerun the pre-merge checks?

Yeah, that looks like a flaky test. You can restart CI by clicking the "Restart Build" link on the Harbormaster instance, I believe (https://reviews.llvm.org/harbormaster/build/296625/). If all else fails, you can usually rebase the patch on main and upload the new patch.

LGTM!

Thank you for the explanation! I've landed this one as it seemed safe enough and testing locally brought nothing up. I'll be sure to be around to check if anything fails because of it, albeit I expect it will not.