aboutsummaryrefslogtreecommitdiff
path: root/clang/tools/c-index-test/c-index-test.c
diff options
context:
space:
mode:
authorLuca Di Sera <disera.luca@gmail.com>2022-10-27 06:42:35 +0200
committerLuca Di Sera <luca.disera@qt.io>2022-10-27 06:55:11 +0200
commit476a497f729a408ba436f75fc50a41254ce65bc8 (patch)
treeb9e23d26dc66d4830b9577f5a0594f2878d59f6e /clang/tools/c-index-test/c-index-test.c
parent89ba240f4b65f8e8e0876c7d066cebf85d1163b5 (diff)
downloadllvm-476a497f729a408ba436f75fc50a41254ce65bc8.zip
llvm-476a497f729a408ba436f75fc50a41254ce65bc8.tar.gz
llvm-476a497f729a408ba436f75fc50a41254ce65bc8.tar.bz2
Add clang_CXXMethod_isCopyAssignmentOperator to libclang
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. Reviewed By: aaron.ballman Differential Revision: https://reviews.llvm.org/D136604
Diffstat (limited to 'clang/tools/c-index-test/c-index-test.c')
-rw-r--r--clang/tools/c-index-test/c-index-test.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/clang/tools/c-index-test/c-index-test.c b/clang/tools/c-index-test/c-index-test.c
index 805f790..108b445 100644
--- a/clang/tools/c-index-test/c-index-test.c
+++ b/clang/tools/c-index-test/c-index-test.c
@@ -910,6 +910,8 @@ static void PrintCursor(CXCursor Cursor, const char *CommentSchemaFile) {
printf(" (const)");
if (clang_CXXMethod_isPureVirtual(Cursor))
printf(" (pure)");
+ if (clang_CXXMethod_isCopyAssignmentOperator(Cursor))
+ printf(" (copy-assignment operator)");
if (clang_CXXRecord_isAbstract(Cursor))
printf(" (abstract)");
if (clang_EnumDecl_isScoped(Cursor))