This is an archive of the discontinued LLVM Phabricator instance.

Add clang_CXXMethod_isCopyAssignmentOperator to libclang
ClosedPublic

Authored by diseraluca on Oct 24 2022, 7:44 AM.

Details

Summary

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

An export for the method, 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::isCopyAssignmentOperator 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, "(copy-assignment operator)", for cursors that are
recognized by clang_CXXMethod_isCopyAssignmentOperator.
A new regression test file,
"clang/test/Index/copy-assignment-operator.cpp", was added to ensure
that 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 "(copy-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_copy_assignment_operator_method.

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.Oct 24 2022, 7:44 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 24 2022, 7:44 AM
Herald added a subscriber: arphaman. · View Herald Transcript
diseraluca requested review of this revision.Oct 24 2022, 7:44 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 24 2022, 7:44 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
aaron.ballman accepted this revision.Oct 24 2022, 10:21 AM

LGTM!

Would you like to obtain commit access to land this one on your own (https://llvm.org/docs/DeveloperPolicy.html#obtaining-commit-access)? If not, that's fine, I can also land it on your behalf.

This revision is now accepted and ready to land.Oct 24 2022, 10:21 AM

LGTM!

Would you like to obtain commit access to land this one on your own (https://llvm.org/docs/DeveloperPolicy.html#obtaining-commit-access)? If not, that's fine, I can also land it on your behalf.

That seems like a nice idea, especially if it can save other people's time by having me finalize the commit. I've sent an email as detailed in the link you posted. I'll wait for an answer and, if it is positive, I'll try to do the landing myself.

LGTM!

Would you like to obtain commit access to land this one on your own (https://llvm.org/docs/DeveloperPolicy.html#obtaining-commit-access)? If not, that's fine, I can also land it on your behalf.

That seems like a nice idea, especially if it can save other people's time by having me finalize the commit. I've sent an email as detailed in the link you posted. I'll wait for an answer and, if it is positive, I'll try to do the landing myself.

Sounds great! If you run into problems or have questions, let me know and I'm happy to help. Thanks again for the improvements!

LGTM!

Would you like to obtain commit access to land this one on your own (https://llvm.org/docs/DeveloperPolicy.html#obtaining-commit-access)? If not, that's fine, I can also land it on your behalf.

That seems like a nice idea, especially if it can save other people's time by having me finalize the commit. I've sent an email as detailed in the link you posted. I'll wait for an answer and, if it is positive, I'll try to do the landing myself.

Sounds great! If you run into problems or have questions, let me know and I'm happy to help. Thanks again for the improvements!

Followed the guidelines to push the change. Hopefully I've done everything correctly.