[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:16 PDT 2024
================
@@ -8955,6 +8960,36 @@ unsigned clang_Cursor_isExternalSymbol(CXCursor C, CXString *language,
return 0;
}
+enum CX_BinaryOperatorKind clang_Cursor_getBinaryOpcode(CXCursor C) {
+ if (C.kind != CXCursor_BinaryOperator &&
+ C.kind != CXCursor_CompoundAssignOperator) {
+ return CX_BO_Invalid;
+ }
+
+ const Expr *D = getCursorExpr(C);
+ if (const BinaryOperator *BinOp = dyn_cast<BinaryOperator>(D)) {
----------------
AaronBallman wrote:
```suggestion
if (const auto *BinOp = dyn_cast<BinaryOperator>(D)) {
```
https://github.com/llvm/llvm-project/pull/98489
More information about the cfe-commits
mailing list