================ @@ -309,21 +309,8 @@ class TrivialFunctionAnalysisVisitor bool VisitDefaultStmt(const DefaultStmt *DS) { return VisitChildren(DS); } bool VisitUnaryOperator(const UnaryOperator *UO) { - // Operator '*' and '!' are allowed as long as the operand is trivial. - auto op = UO->getOpcode(); - if (op == UO_Deref || op == UO_AddrOf || op == UO_LNot || op == UO_Not) - return Visit(UO->getSubExpr()); - - if (UO->isIncrementOp() || UO->isDecrementOp()) { - // Allow increment or decrement of a POD type. - if (auto *RefExpr = dyn_cast<DeclRefExpr>(UO->getSubExpr())) { - if (auto *Decl = dyn_cast<VarDecl>(RefExpr->getDecl())) - return Decl->isLocalVarDeclOrParm() && - Decl->getType().isPODType(Decl->getASTContext()); - } - } - // Other operators are non-trivial. - return false; + // Unary operators are trivial if its operand is trivial. + return Visit(UO->getSubExpr()); ---------------- haoNoQ wrote:
When blanket-approving all operators, it's probably a good idea to go through the current list to see if any exceptions need to be made. Eg. for unary operators it's https://github.com/llvm/llvm-project/blob/llvmorg-18-init/clang/include/clang/AST/OperationKinds.def#L417 and binary operators are just above that. But I don't immediately see anything problematic in that list. (Is `co_await` blessed?) https://github.com/llvm/llvm-project/pull/91102 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits