[clang] [clang] Improve diagnostic on [[nodiscard]] attribute (PR #112521)
via cfe-commits
cfe-commits at lists.llvm.org
Wed Oct 16 11:33:23 PDT 2024
================
@@ -290,9 +296,10 @@ void Sema::DiagnoseUnusedExprResult(const Stmt *S, unsigned DiagID) {
if (E->getType()->isVoidType())
return;
- if (DiagnoseNoDiscard(*this, cast_or_null<WarnUnusedResultAttr>(
- CE->getUnusedResultAttr(Context)),
- Loc, R1, R2, /*isCtor=*/false))
+ const auto &[OffendingDecl, A] = CE->getUnusedResultAttr(Context);
----------------
Sirraide wrote:
```suggestion
auto [OffendingDecl, A] = CE->getUnusedResultAttr(Context);
```
https://github.com/llvm/llvm-project/pull/112521
More information about the cfe-commits
mailing list