aaron.ballman added a comment.
Thank you for the additions! This should have some amount of test coverage
added to clang/unittests/libclang/LibclangTest.cpp and a release note.
================
Comment at: clang/tools/libclang/CIndex.cpp:9606
+
+CXString clang_getBinaryOperatorKindSpelling(enum CXBinaryOperatorKind kind) {
+ switch (kind) {
----------------
Instead of implementing this manually, I think this should do:
```
return cxstring::createRef(BinaryOperator::getOpcodeStr(kind - 1));
```
(Similar for unary operators, may need casts to compile properly).
================
Comment at: clang/tools/libclang/CIndex.cpp:9683
+ if (clang_isExpression(cursor.kind)) {
+ auto expr = getCursorExpr(cursor);
+
----------------
Please spell out the type.
================
Comment at: clang/tools/libclang/CIndex.cpp:9685-9689
+ if (auto op = dyn_cast<BinaryOperator>(expr))
+ return static_cast<CXBinaryOperatorKind>(op->getOpcode() + 1);
+
+ if (auto op = dyn_cast<CXXRewrittenBinaryOperator>(expr))
+ return static_cast<CXBinaryOperatorKind>(op->getOpcode() + 1);
----------------
Similar for unary operators.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D150910/new/
https://reviews.llvm.org/D150910
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits