================
@@ -222,18 +222,13 @@ static bool DiagnoseNoDiscard(Sema &S, const 
WarnUnusedResultAttr *A,
   return S.Diag(Loc, diag::warn_unused_result_msg) << A << Msg << R1 << R2;
 }
 
-void Sema::DiagnoseUnusedExprResult(const Stmt *S, unsigned DiagID) {
-  const unsigned OrigDiagID = DiagID;
-  if (const LabelStmt *Label = dyn_cast_or_null<LabelStmt>(S))
-    return DiagnoseUnusedExprResult(Label->getSubStmt(), DiagID);
-
-  const Expr *E = dyn_cast_or_null<Expr>(S);
-  if (!E)
-    return;
+namespace {
+void DiagnoseUnused(Sema &S, const Expr *E, std::optional<unsigned> DiagID) {
+  bool NoDiscardOnly = !DiagID.has_value();
----------------
Sirraide wrote:

A comment explaining the relationship between the `DiagID` parameter and 
`NoDiscardOnly` here would be nice so anyone looking at calls to this knows 
what’s going on w/o having to go through the entire function.

https://github.com/llvm/llvm-project/pull/95112
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to