[clang] [clang-tools-extra] [clang][AST] Add public wrapper getOpcodeStr to UnaryOperator (PR #230692)
Chen Miao via cfe-commits
cfe-commits at lists.llvm.org
Sat Oct 10 11:00:56 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()); }
----------------
ChenMiaoi wrote:
> 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).
I think you should update all the usage sites. Even with the criteria you described, there are still some sites that haven’t been updated.
Example:
https://github.com/llvm/llvm-project/blob/f582a0f919b90264806a3a0386419a51bc668179/clang/lib/Tooling/ASTDiff/ASTDiff.cpp#L450
https://github.com/llvm/llvm-project/pull/230692
More information about the cfe-commits
mailing list