[clang] libclang: Query operator kind on declaration and expression cursors (PR #216553)

via cfe-commits cfe-commits at lists.llvm.org
Sun Aug 16 12:48:38 PDT 2026


Martin =?utf-8?q?Bednár?= <martin at serafean.cz>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/216553 at github.com>


github-actions[bot] wrote:

<!--PREMERGE ADVISOR COMMENT: Linux-->
# :penguin: Linux x64 Test Results

* 90873 tests passed
* 1798 tests skipped
* 1 test failed

## Failed Tests
(click on a test name to see its output)

### Clang
<details>
<summary>Clang.Index/binop.cpp</summary>

```
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 1
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/c-index-test -test-print-binops /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/Index/binop.cpp | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/Index/binop.cpp
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/c-index-test -test-print-binops /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/Index/binop.cpp
# .---command stderr------------
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/Index/binop.cpp:464:15: warning: '<=>' is a single token in C++20; add a space to avoid a change in behavior [-Wc++20-compat]
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/Index/binop.cpp:464:7: error: 'operator<=' cannot be the name of a variable or data member
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/Index/binop.cpp:464:17: error: expected ';' at end of declaration list
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/Index/binop.cpp:472:6: warning: '<=>' is a single token in C++20; add a space to avoid a change in behavior [-Wc++20-compat]
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/Index/binop.cpp:472:8: error: expected expression
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/Index/binop.cpp:473:6: error: invalid operands to binary expression ('space1' and 'space1')
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/Index/binop.cpp:293:6: note: candidate function not viable: no known conversion from 'space1' to 'const E' for 1st argument
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/Index/binop.cpp:474:6: error: invalid operands to binary expression ('space1' and 'space1')
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/Index/binop.cpp:294:6: note: candidate function not viable: no known conversion from 'space1' to 'const E' for 1st argument
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/Index/binop.cpp:475:6: error: invalid operands to binary expression ('space1' and 'space1')
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/Index/binop.cpp:295:6: note: candidate function not viable: no known conversion from 'space1' to 'const E' for 1st argument
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/Index/binop.cpp:476:6: error: invalid operands to binary expression ('space1' and 'space1')
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/Index/binop.cpp:296:6: note: candidate function not viable: no known conversion from 'space1' to 'const E' for 1st argument
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/Index/binop.cpp:478:6: error: invalid operands to binary expression ('space1' and 'space1')
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/Index/binop.cpp:298:6: note: candidate function not viable: no known conversion from 'space1' to 'const E' for 1st argument
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/Index/binop.cpp:498:13: warning: '<=>' is a single token in C++20; add a space to avoid a change in behavior [-Wc++20-compat]
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/Index/binop.cpp:498:5: error: 'operator<=' cannot be the name of a variable or data member
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/Index/binop.cpp:498:15: error: expected ';' after top level declarator
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/Index/binop.cpp:504:6: warning: '<=>' is a single token in C++20; add a space to avoid a change in behavior [-Wc++20-compat]
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/Index/binop.cpp:504:8: error: expected expression
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/Index/binop.cpp:505:6: error: invalid operands to binary expression ('space2' and 'space2')
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/Index/binop.cpp:293:6: note: candidate function not viable: no known conversion from 'space2' to 'const E' for 1st argument
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/Index/binop.cpp:506:6: error: invalid operands to binary expression ('space2' and 'space2')
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/Index/binop.cpp:294:6: note: candidate function not viable: no known conversion from 'space2' to 'const E' for 1st argument
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/Index/binop.cpp:507:6: error: invalid operands to binary expression ('space2' and 'space2')
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/Index/binop.cpp:295:6: note: candidate function not viable: no known conversion from 'space2' to 'const E' for 1st argument
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/Index/binop.cpp:508:6: error: invalid operands to binary expression ('space2' and 'space2')
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/Index/binop.cpp:296:6: note: candidate function not viable: no known conversion from 'space2' to 'const E' for 1st argument
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/Index/binop.cpp:510:6: error: invalid operands to binary expression ('space2' and 'space2')
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/Index/binop.cpp:298:6: note: candidate function not viable: no known conversion from 'space2' to 'const E' for 1st argument
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/Index/binop.cpp:464:15: warning: '<=>' is a single token in C++20; add a space to avoid a change in behavior [-Wc++20-compat]
# | Number FIX-ITs = 1
# | FIX-IT: Insert " " at 464:17
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/Index/binop.cpp:464:7: error: 'operator<=' cannot be the name of a variable or data member
# | Number FIX-ITs = 0
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/Index/binop.cpp:464:17: error: expected ';' at end of declaration list
# | Number FIX-ITs = 1
# | FIX-IT: Insert ";" at 464:17
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/Index/binop.cpp:472:6: warning: '<=>' is a single token in C++20; add a space to avoid a change in behavior [-Wc++20-compat]
# | Number FIX-ITs = 1
# | FIX-IT: Insert " " at 472:8
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/Index/binop.cpp:472:8: error: expected expression
# | Number FIX-ITs = 0
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/Index/binop.cpp:473:6:{473:3-473:5}{473:8-473:10}: error: invalid operands to binary expression ('space1' and 'space1')
# | Number FIX-ITs = 0
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/Index/binop.cpp:293:6:{293:16-293:24}: note: candidate function not viable: no known conversion from 'space1' to 'const E' for 1st argument
# | Number FIX-ITs = 0
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/Index/binop.cpp:474:6:{474:3-474:5}{474:8-474:10}: error: invalid operands to binary expression ('space1' and 'space1')
# | Number FIX-ITs = 0
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/Index/binop.cpp:294:6:{294:16-294:24}: note: candidate function not viable: no known conversion from 'space1' to 'const E' for 1st argument
# | Number FIX-ITs = 0
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/Index/binop.cpp:475:6:{475:3-475:5}{475:9-475:11}: error: invalid operands to binary expression ('space1' and 'space1')
# | Number FIX-ITs = 0
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/Index/binop.cpp:295:6:{295:17-295:25}: note: candidate function not viable: no known conversion from 'space1' to 'const E' for 1st argument
# | Number FIX-ITs = 0
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/Index/binop.cpp:476:6:{476:3-476:5}{476:9-476:11}: error: invalid operands to binary expression ('space1' and 'space1')
# | Number FIX-ITs = 0
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/Index/binop.cpp:296:6:{296:17-296:25}: note: candidate function not viable: no known conversion from 'space1' to 'const E' for 1st argument
# | Number FIX-ITs = 0
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/Index/binop.cpp:478:6:{478:3-478:5}{478:9-478:11}: error: invalid operands to binary expression ('space1' and 'space1')
# | Number FIX-ITs = 0
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/Index/binop.cpp:298:6:{298:17-298:25}: note: candidate function not viable: no known conversion from 'space1' to 'const E' for 1st argument
# | Number FIX-ITs = 0
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/Index/binop.cpp:498:13: warning: '<=>' is a single token in C++20; add a space to avoid a change in behavior [-Wc++20-compat]
# | Number FIX-ITs = 1
# | FIX-IT: Insert " " at 498:15
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/Index/binop.cpp:498:5: error: 'operator<=' cannot be the name of a variable or data member
# | Number FIX-ITs = 0
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/Index/binop.cpp:498:15: error: expected ';' after top level declarator
# | Number FIX-ITs = 1
# | FIX-IT: Insert ";" at 498:15
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/Index/binop.cpp:504:6: warning: '<=>' is a single token in C++20; add a space to avoid a change in behavior [-Wc++20-compat]
# | Number FIX-ITs = 1
# | FIX-IT: Insert " " at 504:8
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/Index/binop.cpp:504:8: error: expected expression
# | Number FIX-ITs = 0
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/Index/binop.cpp:505:6:{505:3-505:5}{505:8-505:10}: error: invalid operands to binary expression ('space2' and 'space2')
# | Number FIX-ITs = 0
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/Index/binop.cpp:293:6:{293:16-293:24}: note: candidate function not viable: no known conversion from 'space2' to 'const E' for 1st argument
# | Number FIX-ITs = 0
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/Index/binop.cpp:506:6:{506:3-506:5}{506:8-506:10}: error: invalid operands to binary expression ('space2' and 'space2')
# | Number FIX-ITs = 0
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/Index/binop.cpp:294:6:{294:16-294:24}: note: candidate function not viable: no known conversion from 'space2' to 'const E' for 1st argument
# | Number FIX-ITs = 0
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/Index/binop.cpp:507:6:{507:3-507:5}{507:
# | ...
# `---data was truncated (10240/11434) (change limit with -D output_limit=N)
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/Index/binop.cpp
# .---command stderr------------
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/Index/binop.cpp:485:11: error: CHECK: expected string not found in input
# | // CHECK: CallExpr=operator<=>:464:7 BinOp=<=> 10
# |           ^
# | <stdin>:193:31: note: scanning from here
# | CallExpr=space1:463:8 BinOp= 0
# |                               ^
# | <stdin>:194:1: note: possible intended match here
# | CallExpr=operator==:465:8 BinOp=== 15
# | ^
# | 
# | Input file: <stdin>
# | Check file: /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/Index/binop.cpp
# | 
# | -dump-input=help explains the following input dump.
# | 
# | Input was:
# | <<<<<<
# |              .
# |              .
# |              .
# |            188: CallExpr=operator+:320:3 BinOp= 0 
# |            189: CallExpr=operator-:321:3 BinOp= 0 
# |            190: CXXMethod=operator==:465:8 (const) BinOp=== 15 
# |            191: FunctionDecl=func4:468:6 (Definition) BinOp= 0 
# |            192: CallExpr=space1:463:8 BinOp= 0 
# |            193: CallExpr=space1:463:8 BinOp= 0 
# | check:485'0                                  {   search range start (exclusive)
# | check:485'1                                      error: no match found in search range
# |            194: CallExpr=operator==:465:8 BinOp=== 15 
# | check:485'2     ?                                       possible intended match
# |            195: FunctionDecl=operator==:499:6 BinOp=== 15 
# |            196: FunctionDecl=func5:500:6 (Definition) BinOp= 0 
# |            197: CallExpr=space2:497:8 BinOp= 0 
# |            198: CallExpr=space2:497:8 BinOp= 0 
# |            199: CallExpr=operator==:499:6 BinOp=== 15 
# | check:485'3                                           } search range end (exclusive)
# | >>>>>>
# `-----------------------------
# error: command failed with exit status: 1

--

```
</details>

If these failures are unrelated to your changes (for example tests are broken or flaky at HEAD), please open an issue at https://github.com/llvm/llvm-project/issues and add the `infrastructure` label.

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


More information about the cfe-commits mailing list