[clang] Retrieve BinaryOperator::getOpcode and BinaryOperator::getOpcodeStr via libclang and its python interface (PR #98489)
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Thu Jul 11 08:13:15 PDT 2024
https://github.com/AaronBallman commented:
Thank you for picking this back up! Hopefully @Endilll can comment on the python bits, but the changes generally LGTM aside from some very minor nits. One thing that should be added is a release note (in `clang/docs/ReleaseNotes.rst` so users know about the new functionality.
Precommit CI did find a relevant failure to address though:
```
FAIL: Clang :: Index/index-concepts.cpp (12051 of 20439)
******************** TEST 'Clang :: Index/index-concepts.cpp' FAILED ********************
Exit Code: 1
Command Output (stdout):
--
# RUN: at line 1
c:\ws\src\build\bin\c-index-test.exe -test-load-source all C:\ws\src\clang\test\Index\index-concepts.cpp -std=gnu++20 -fno-delayed-template-parsing | c:\ws\src\build\bin\filecheck.exe C:\ws\src\clang\test\Index\index-concepts.cpp
# executed command: 'c:\ws\src\build\bin\c-index-test.exe' -test-load-source all 'C:\ws\src\clang\test\Index\index-concepts.cpp' -std=gnu++20 -fno-delayed-template-parsing
# note: command had no output on stdout or stderr
# executed command: 'c:\ws\src\build\bin\filecheck.exe' 'C:\ws\src\clang\test\Index\index-concepts.cpp'
# .---command stderr------------
# | C:\ws\src\clang\test\Index\index-concepts.cpp:44:11: error: CHECK: expected string not found in input
# | // CHECK: index-concepts.cpp:[[@LINE-3]]:29: BinaryOperator= Extent=[[[@LINE-3]]:29 - [[@LINE-3]]:62]
# | ^
# | <stdin>:494:118: note: scanning from here
# | // CHECK: index-concepts.cpp:40:17: TemplateTypeParameter=T:40:17 (Definition) Extent=[40:11 - 40:18] [access=public]
# | ^
# | <stdin>:494:118: note: with "@LINE-3" equal to "41"
# | // CHECK: index-concepts.cpp:40:17: TemplateTypeParameter=T:40:17 (Definition) Extent=[40:11 - 40:18] [access=public]
# | ^
# | <stdin>:494:118: note: with "@LINE-3" equal to "41"
# | // CHECK: index-concepts.cpp:40:17: TemplateTypeParameter=T:40:17 (Definition) Extent=[40:11 - 40:18] [access=public]
# | ^
# | <stdin>:494:118: note: with "@LINE-3" equal to "41"
# | // CHECK: index-concepts.cpp:40:17: TemplateTypeParameter=T:40:17 (Definition) Extent=[40:11 - 40:18] [access=public]
# | ^
# | <stdin>:495:11: note: possible intended match here
# | // CHECK: index-concepts.cpp:41:29: BinaryOperator=&& Extent=[41:29 - 41:62]
# | ^
# |
# | Input file: <stdin>
# | Check file: C:\ws\src\clang\test\Index\index-concepts.cpp
# |
# | -dump-input=help explains the following input dump.
# |
# | Input was:
# | <<<<<<
# | .
# | .
# | .
# | 489: // CHECK: index-concepts.cpp:38:15: FunctionDecl=sizeFunc:38:15 (Definition) Extent=[38:1 - 38:39]
# | 490: // CHECK: index-concepts.cpp:38:26: CompoundStmt= Extent=[38:26 - 38:39]
# | 491: // CHECK: index-concepts.cpp:38:28: ReturnStmt= Extent=[38:28 - 38:36]
# | 492: // CHECK: index-concepts.cpp:38:35: IntegerLiteral= Extent=[38:35 - 38:36]
# | 493: // CHECK: index-concepts.cpp:41:9: ConceptDecl=ConWithLogicalAnd:41:9 (Definition) Extent=[40:1 - 41:62]
# | 494: // CHECK: index-concepts.cpp:40:17: TemplateTypeParameter=T:40:17 (Definition) Extent=[40:11 - 40:18] [access=public]
# | check:44'0 X error: no match found
# | check:44'1 with "@LINE-3" equal to "41"
# | check:44'2 with "@LINE-3" equal to "41"
# | check:44'3 with "@LINE-3" equal to "41"
# | 495: // CHECK: index-concepts.cpp:41:29: BinaryOperator=&& Extent=[41:29 - 41:62]
# | check:44'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | check:44'4 ? possible intended match
# | 496: // CHECK: index-concepts.cpp:41:29: ConceptSpecializationExpr= Extent=[41:29 - 41:36]
# | check:44'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | 497: // CHECK: index-concepts.cpp:41:29: TemplateRef=Con1:31:9 Extent=[41:29 - 41:33]
# | check:44'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | 498: // CHECK: index-concepts.cpp:41:34: TypeRef=T:40:17 Extent=[41:34 - 41:35]
# | check:44'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | 499: // CHECK: index-concepts.cpp:41:40: BinaryOperator=> Extent=[41:40 - 41:62]
# | check:44'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | 500: // CHECK: index-concepts.cpp:41:40: UnaryExpr= Extent=[41:40 - 41:49]
# | check:44'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | .
# | .
# | .
# | >>>>>>
# `-----------------------------
# error: command failed with exit status: 1
--
********************
```
https://github.com/llvm/llvm-project/pull/98489
More information about the cfe-commits
mailing list