[clang] [libclang]Return *OperatorKind for oveloaded operators (PR #182303)

via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 20 10:19:34 PST 2026


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff origin/main HEAD --extensions c,cpp -- clang/test/Index/unaryop.cpp clang/test/Index/binop.cpp clang/tools/c-index-test/c-index-test.c clang/tools/libclang/CIndex.cpp --diff_from_common_commit
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/clang/tools/libclang/CIndex.cpp b/clang/tools/libclang/CIndex.cpp
index 986da893d..fbcee7359 100644
--- a/clang/tools/libclang/CIndex.cpp
+++ b/clang/tools/libclang/CIndex.cpp
@@ -10205,7 +10205,7 @@ enum CXBinaryOperatorKind clang_getCursorBinaryOperatorKind(CXCursor cursor) {
   if (const auto *OCE = dyn_cast<CXXOperatorCallExpr>(expr)) {
     const OverloadedOperatorKind Kind = OCE->getOperator();
     bool isPostfixOp = (OCE->getNumArgs() == 2 &&
-                    (Kind == OO_PlusPlus || Kind == OO_MinusMinus));
+                        (Kind == OO_PlusPlus || Kind == OO_MinusMinus));
     if (OCE->getNumArgs() == 2 && !isPostfixOp) {
       auto opcode = BinaryOperator::getOverloadedOpcode(Kind);
       return static_cast<CXBinaryOperatorKind>(opcode + 1);
@@ -10239,7 +10239,7 @@ enum CXUnaryOperatorKind clang_getCursorUnaryOperatorKind(CXCursor cursor) {
   if (const auto *OCE = dyn_cast<CXXOperatorCallExpr>(expr)) {
     const OverloadedOperatorKind Kind = OCE->getOperator();
     bool isPostfixOp = (OCE->getNumArgs() == 2 &&
-                    (Kind == OO_PlusPlus || Kind == OO_MinusMinus));
+                        (Kind == OO_PlusPlus || Kind == OO_MinusMinus));
     if (OCE->getNumArgs() == 1 || isPostfixOp) {
       auto opcode = UnaryOperator::getOverloadedOpcode(Kind, isPostfixOp);
       return static_cast<CXUnaryOperatorKind>(opcode + 1);

``````````

</details>


https://github.com/llvm/llvm-project/pull/182303


More information about the cfe-commits mailing list