[clang] Add retrieval of unary operator spelling and python bindings (PR #219983)

Jannick Kremer via cfe-commits cfe-commits at lists.llvm.org
Sun Sep 13 06:42:56 PDT 2026


================
@@ -2036,6 +2036,19 @@ def binary_operator(self) -> BinaryOperator:
 
         return BinaryOperator.from_id(self._binopcode)
 
+    @property
+    @cursor_null_guard
+    def unary_operator(self) -> UnaryOperator:
+        """
+        Retrieves the opcode if this cursor points to a unary operator
+        :return:
+        """
+
+        if not hasattr(self, "_binopcode"):
----------------
DeinAlptraum wrote:

It's not like these are expected to ever overlap, but this should be `_unopcode` or something similar

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


More information about the cfe-commits mailing list