[clang] Retrieve BinaryOperator::getOpcode and BinaryOperator::getOpcodeStr via libclang and its python interface (PR #98489)

Thomas Wucher via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 12 04:46:07 PDT 2024


================
@@ -1820,6 +1820,18 @@ def availability(self):
 
         return AvailabilityKind.from_id(self._availability)
 
+    @property
+    def binary_operator(self):
+        """
+        Retrieves the opcode if this cursor points to a binary operator
+        :return:
+        """
+
+        if not hasattr(self, "_binopcode"):
+            self._binopcode = conf.lib.clang_Cursor_getBinaryOpcode(self)
----------------
thomaswucher wrote:

Good point, you are probably right, thank you! There is also an `__all__` list at the bottom of `cindex.py` listing, among others, all enumeration classes defined in `cindex.py`. Probably the new `BinaryOperator` class should be added there as well? I'm currently running the tests locally.

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


More information about the cfe-commits mailing list