@@ -230,8 +230,8 @@ namespace {
230230
231231// Diagnoses unused expressions that call functions marked [[nodiscard]],
232232// [[gnu::warn_unused_result]] and similar.
233- // Additionally, a DiagID can be provided to emit a warning in additional contexts
234- // (such as for an unused LHS of a comma expression)
233+ // Additionally, a DiagID can be provided to emit a warning in additional
234+ // contexts (such as for an unused LHS of a comma expression)
235235void DiagnoseUnused (Sema &S, const Expr *E, std::optional<unsigned > DiagID) {
236236 bool NoDiscardOnly = !DiagID.has_value ();
237237
@@ -332,8 +332,8 @@ void DiagnoseUnused(Sema &S, const Expr *E, std::optional<unsigned> DiagID) {
332332 } else if (const auto *ILE = dyn_cast<InitListExpr>(E)) {
333333 if (const TagDecl *TD = ILE->getType ()->getAsTagDecl ()) {
334334
335- if (DiagnoseNoDiscard (S, TD, TD->getAttr <WarnUnusedResultAttr>(), Loc,
336- R1, R2, /* isCtor=*/ false ))
335+ if (DiagnoseNoDiscard (S, TD, TD->getAttr <WarnUnusedResultAttr>(), Loc, R1,
336+ R2, /* isCtor=*/ false ))
337337 return ;
338338 }
339339 } else if (ShouldSuppress)
@@ -347,7 +347,8 @@ void DiagnoseUnused(Sema &S, const Expr *E, std::optional<unsigned> DiagID) {
347347 }
348348 const ObjCMethodDecl *MD = ME->getMethodDecl ();
349349 if (MD) {
350- if (DiagnoseNoDiscard (S, nullptr , MD->getAttr <WarnUnusedResultAttr>(), Loc, R1, R2,
350+ if (DiagnoseNoDiscard (S, nullptr , MD->getAttr <WarnUnusedResultAttr>(),
351+ Loc, R1, R2,
351352 /* isCtor=*/ false ))
352353 return ;
353354 }
@@ -401,11 +402,6 @@ void DiagnoseUnused(Sema &S, const Expr *E, std::optional<unsigned> DiagID) {
401402 return ;
402403 }
403404
404- // Don't diagnose discarded left of dot in static class member access
405- // because its type is "used" to determine the class to access
406- // if (DiagID == diag::warn_discarded_class_member_access)
407- // return;
408-
409405 // Do not diagnose use of a comma operator in a SFINAE context because the
410406 // type of the left operand could be used for SFINAE, so technically it is
411407 // *used*.
0 commit comments