[clang] [alpha.webkit.UncountedCallArgsChecker] Allow trivial operator++ (PR #91102)
Ryosuke Niwa via cfe-commits
cfe-commits at lists.llvm.org
Thu May 9 10:37:42 PDT 2024
================
@@ -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());
----------------
rniwa wrote:
Hm... we should probably exclude `co_await`. Let me do that.
https://github.com/llvm/llvm-project/pull/91102
More information about the cfe-commits
mailing list