Skip to content

Commit dafbff1

Browse files
committed
format
1 parent fb9570c commit dafbff1

File tree

2 files changed

+9
-13
lines changed

2 files changed

+9
-13
lines changed

clang/include/clang/Sema/Sema.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10659,9 +10659,9 @@ class Sema final : public SemaBase {
1065910659
SourceLocation EndLoc);
1066010660
void ActOnForEachDeclStmt(DeclGroupPtrTy Decl);
1066110661

10662-
/// DiagnoseDiscardedExprMarkedNodiscard - Given an expression that is semantically
10663-
/// a discarded-value expression, diagnose if any [[nodiscard]] value
10664-
/// has been discarded
10662+
/// DiagnoseDiscardedExprMarkedNodiscard - Given an expression that is
10663+
/// semantically a discarded-value expression, diagnose if any [[nodiscard]]
10664+
/// value has been discarded
1066510665
void DiagnoseDiscardedExprMarkedNodiscard(const Expr *E);
1066610666

1066710667
/// DiagnoseUnusedExprResult - If the statement passed in is an expression

clang/lib/Sema/SemaStmt.cpp

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -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)
235235
void 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

Comments
 (0)