[clang] [clang-tools-extra] [clang][AST] Add public wrapper getOpcodeStr to UnaryOperator (PR #230692)

via cfe-commits cfe-commits at lists.llvm.org
Sat Oct 10 03:25:54 PDT 2026


================
@@ -2399,6 +2399,8 @@ class UnaryOperator final
   /// corresponds to, e.g. "sizeof" or "[pre]++"
   static StringRef getOpcodeStr(Opcode Op);
 
+  StringRef getOpcodeStr() const { return getOpcodeStr(getOpcode()); }
----------------
LocalPiper wrote:

Changed member calls in `clangd/DumpAST.cpp`, `include/clang/ASTMatchers/ASTMatchersInternal.h`, `lib/Analysis/UnsafeBufferUsage.cpp` and `unittests/Tooling/RecursiveASTVisitorTestPostOrderVisitor.cpp`

There are many more places in clang where static `getOpcodeStr` is called, but I changed only those where `BinaryOperator` and `UnaryOperator` calls appear side-by-side (i.e. `BinaryOperator` uses the member function and `UnaryOperator` does not).

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


More information about the cfe-commits mailing list