[clang] [alpha.webkit.UncountedCallArgsChecker] Allow trivial operator++ (PR #91102)

Ryosuke Niwa via cfe-commits cfe-commits at lists.llvm.org
Tue May 7 18:52:58 PDT 2024


================
@@ -316,10 +316,15 @@ class TrivialFunctionAnalysisVisitor
 
     if (UO->isIncrementOp() || UO->isDecrementOp()) {
       // Allow increment or decrement of a POD type.
-      if (auto *RefExpr = dyn_cast<DeclRefExpr>(UO->getSubExpr())) {
+      auto *SubExpr = UO->getSubExpr();
+      if (auto *RefExpr = dyn_cast<DeclRefExpr>(SubExpr)) {
----------------
rniwa wrote:

oh, that's a good point. I guess we can rely on `Visit` call on `SubExpr` instead of checking that it's a POD type. Actually, we can just allow any unary operator so long as its subexpression is trivial just as we do for binary operators.

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


More information about the cfe-commits mailing list