================
@@ -2794,6 +2794,16 @@ bool Expr::isUnusedResultAWarning(const Expr *&WarnE, 
SourceLocation &Loc,
         return true;
       }
     }
+    if (CE->hasUnusedResultAttr(Ctx)) {
----------------
Sirraide wrote:

I think we can simplify this by adjusting the `if` statement before this one 
instead of duplicating everything here. I.e. something like this:
```c++
const CallExpr *CE = cast<CallExpr>(this);
const Decl *FD = CE->getCalleeDecl();
bool PureOrConst = FD && (FD->hasAttr<PureAttr>() || FD->hasAttr<ConstAttr>());
if (CE->hasUnusedResultAttr(Ctx) || PureOrConst) {
    // ...
}
```
Then delete the inner `if` and just fold its body into the outer if.

https://github.com/llvm/llvm-project/pull/154250
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to