[clang] [clang] Generate note on declaration for nodiscard-related attributes (PR #112289)

Yihe Li via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 15 08:37:59 PDT 2024


================
@@ -290,9 +297,12 @@ 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 NamedDecl *OffendingDecl;
+    const Attr *A;
+    std::tie(OffendingDecl, A) = CE->getUnusedResultAttr(Context);
----------------
Mick235711 wrote:

Oh I don't see structured binding used in this file, so I just copied the existing usage of `tie`. Will be fixed in the next push.

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


More information about the cfe-commits mailing list