================
@@ -204,23 +205,29 @@ static bool DiagnoseUnusedComparison(Sema &S, const Expr
*E) {
return true;
}
-static bool DiagnoseNoDiscard(Sema &S, const WarnUnusedResultAttr *A,
- SourceLocation Loc, SourceRange R1,
- SourceRange R2, bool IsCtor) {
+static bool DiagnoseNoDiscard(Sema &S, const NamedDecl *OffendingDecl,
+ const WarnUnusedResultAttr *A, SourceLocation
Loc,
+ SourceRange R1, SourceRange R2, bool IsCtor) {
if (!A)
return false;
StringRef Msg = A->getMessage();
+ bool result;
if (Msg.empty()) {
if (IsCtor)
- return S.Diag(Loc, diag::warn_unused_constructor) << A << R1 << R2;
- return S.Diag(Loc, diag::warn_unused_result) << A << R1 << R2;
- }
+ result = S.Diag(Loc, diag::warn_unused_constructor) << A << R1 << R2;
----------------
Mick235711 wrote:
> Also, 'result' is always going to be true. Diag always returns true, it is
> just a shortcut to return early with a common pattern we have.
Oh, if that is the case, indeed there I got it wrong. I assumed the return
value is meaningful. Probably just remove all the return then.
https://github.com/llvm/llvm-project/pull/112289
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits