aaron.ballman added inline comments.
================ Comment at: clang/lib/Sema/SemaStmt.cpp:296-301 + if (A) { + StringRef Msg = A->getMessage(); + if (!Msg.empty()) + Diag(Loc, diag::warn_unused_constructor_msg) << A << Msg << R1 << R2; + else + Diag(Loc, diag::warn_unused_constructor) << A << R1 << R2; ---------------- We use this pattern in a handful of places. I wonder if we want to add a private function to `Sema` to handle this: `void DiagnoseNodiscard(const WarnUnusedResultAttr *A, SourceLocation Loc, bool IsConstructor);` (maybe it could return a partial diagnostic so we can optionally apply the source ranges to it as well?) ================ Comment at: clang/test/CXX/dcl.dcl/dcl.attr/dcl.attr.nodiscard/p2.cpp:91 + operator ConvertTo(); + [[nodiscard]] operator int(); +}; ---------------- Can you add a test that adds a message to the `nodiscard` attribute written directly on a conversion operator? CHANGES SINCE LAST ACTION https://reviews.llvm.org/D64914/new/ https://reviews.llvm.org/D64914 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits