https://github.com/MitalAshok updated
https://github.com/llvm/llvm-project/pull/95112
>From e53dfbc9b2c6b7f30c1378731d7de284fa99d568 Mon Sep 17 00:00:00 2001
From: Mital Ashok
Date: Tue, 11 Jun 2024 14:26:38 +0100
Subject: [PATCH 1/6] [Clang] Implement CWG2813
---
clang/docs/ReleaseNotes.rst
https://github.com/MitalAshok updated
https://github.com/llvm/llvm-project/pull/95112
>From e53dfbc9b2c6b7f30c1378731d7de284fa99d568 Mon Sep 17 00:00:00 2001
From: Mital Ashok
Date: Tue, 11 Jun 2024 14:26:38 +0100
Subject: [PATCH 1/5] [Clang] Implement CWG2813
---
clang/docs/ReleaseNotes.rst
https://github.com/MitalAshok updated
https://github.com/llvm/llvm-project/pull/95112
>From e53dfbc9b2c6b7f30c1378731d7de284fa99d568 Mon Sep 17 00:00:00 2001
From: Mital Ashok
Date: Tue, 11 Jun 2024 14:26:38 +0100
Subject: [PATCH 1/5] [Clang] Implement CWG2813
---
clang/docs/ReleaseNotes.rst
github-actions[bot] wrote:
:warning: C/C++ code formatter, clang-format found issues in your code.
:warning:
You can test this locally with the following command:
``bash
git-clang-format --diff c22d3917b93a6d54613d2e5b2ea4c97546144c46
37f24484fcb0a71cef93928ab2f8e6c689c34868 --
https://github.com/MitalAshok updated
https://github.com/llvm/llvm-project/pull/95112
>From e53dfbc9b2c6b7f30c1378731d7de284fa99d568 Mon Sep 17 00:00:00 2001
From: Mital Ashok
Date: Tue, 11 Jun 2024 14:26:38 +0100
Subject: [PATCH 1/6] [Clang] Implement CWG2813
---
clang/docs/ReleaseNotes.rst
https://github.com/Sirraide approved this pull request.
A few more minor things, but LGTM otherwise.
https://github.com/llvm/llvm-project/pull/95112
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
@@ -171,21 +187,3 @@ void f() {
#endif
}
} // namespace discarded_member_access
-
-
-// cxx11-warning@5 {{use of the 'nodiscard' attribute is a C++17 extension}}
-// cxx11-warning@9 {{use of the 'nodiscard' attribute is a C++17 extension}}
-// cxx11-warning@12 {{use of the
@@ -222,18 +222,13 @@ static bool DiagnoseNoDiscard(Sema , 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 =
https://github.com/Sirraide edited
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
@@ -222,18 +222,13 @@ static bool DiagnoseNoDiscard(Sema , 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 =
https://github.com/MitalAshok updated
https://github.com/llvm/llvm-project/pull/95112
>From e53dfbc9b2c6b7f30c1378731d7de284fa99d568 Mon Sep 17 00:00:00 2001
From: Mital Ashok
Date: Tue, 11 Jun 2024 14:26:38 +0100
Subject: [PATCH 1/4] [Clang] Implement CWG2813
---
clang/docs/ReleaseNotes.rst
@@ -1140,26 +1131,68 @@ Sema::BuildMemberReferenceExpr(Expr *BaseExpr, QualType
BaseExprType,
BaseExpr = BuildCXXThisExpr(Loc, BaseExprType, /*IsImplicit=*/true);
}
+ // C++17 [expr.ref]p2, per CWG2813:
+ // For the first option (dot), if the id-expression names a
@@ -387,9 +388,16 @@ void Sema::DiagnoseUnusedExprResult(const Stmt *S,
unsigned DiagID) {
// Do not diagnose use of a comma operator in a SFINAE context because the
// type of the left operand could be used for SFINAE, so technically it is
// *used*.
- if (DiagID !=
@@ -1174,6 +1207,9 @@ Sema::BuildMemberReferenceExpr(Expr *BaseExpr, QualType
BaseExprType,
valueKind = VK_PRValue;
type = Context.BoundMemberTy;
Sirraide wrote:
Oh yeah, duh, makes sense.
https://github.com/llvm/llvm-project/pull/95112
@@ -387,9 +388,16 @@ void Sema::DiagnoseUnusedExprResult(const Stmt *S,
unsigned DiagID) {
// Do not diagnose use of a comma operator in a SFINAE context because the
// type of the left operand could be used for SFINAE, so technically it is
// *used*.
- if (DiagID !=
@@ -1174,6 +1207,9 @@ Sema::BuildMemberReferenceExpr(Expr *BaseExpr, QualType
BaseExprType,
valueKind = VK_PRValue;
type = Context.BoundMemberTy;
MitalAshok wrote:
For non-static member function, we don't require a glvalue anymore (to allow
@@ -1140,26 +1131,68 @@ Sema::BuildMemberReferenceExpr(Expr *BaseExpr, QualType
BaseExprType,
BaseExpr = BuildCXXThisExpr(Loc, BaseExprType, /*IsImplicit=*/true);
}
+ // C++17 [expr.ref]p2, per CWG2813:
+ // For the first option (dot), if the id-expression names a
@@ -124,21 +125,67 @@ void usage() {
}
}; // namespace p1771
-#ifdef EXT
-// expected-warning@5 {{use of the 'nodiscard' attribute is a C++17 extension}}
-// expected-warning@9 {{use of the 'nodiscard' attribute is a C++17 extension}}
-// expected-warning@12 {{use of the
@@ -9182,6 +9182,9 @@ def warn_unused_constructor : Warning<
def warn_unused_constructor_msg : Warning<
"ignoring temporary created by a constructor declared with %0 attribute:
%1">,
InGroup;
+def warn_discarded_class_member_access : Warning<
+ "left operand of dot in
@@ -1174,6 +1207,9 @@ Sema::BuildMemberReferenceExpr(Expr *BaseExpr, QualType
BaseExprType,
valueKind = VK_PRValue;
type = Context.BoundMemberTy;
Sirraide wrote:
Don’t we need a call to `MakeGLValue()` somewhere in here?
@@ -1140,26 +1131,68 @@ Sema::BuildMemberReferenceExpr(Expr *BaseExpr, QualType
BaseExprType,
BaseExpr = BuildCXXThisExpr(Loc, BaseExprType, /*IsImplicit=*/true);
}
+ // C++17 [expr.ref]p2, per CWG2813:
+ // For the first option (dot), if the id-expression names a
@@ -1140,26 +1131,68 @@ Sema::BuildMemberReferenceExpr(Expr *BaseExpr, QualType
BaseExprType,
BaseExpr = BuildCXXThisExpr(Loc, BaseExprType, /*IsImplicit=*/true);
}
+ // C++17 [expr.ref]p2, per CWG2813:
+ // For the first option (dot), if the id-expression names a
@@ -1140,26 +1131,68 @@ Sema::BuildMemberReferenceExpr(Expr *BaseExpr, QualType
BaseExprType,
BaseExpr = BuildCXXThisExpr(Loc, BaseExprType, /*IsImplicit=*/true);
}
+ // C++17 [expr.ref]p2, per CWG2813:
+ // For the first option (dot), if the id-expression names a
@@ -387,9 +388,16 @@ void Sema::DiagnoseUnusedExprResult(const Stmt *S,
unsigned DiagID) {
// Do not diagnose use of a comma operator in a SFINAE context because the
// type of the left operand could be used for SFINAE, so technically it is
// *used*.
- if (DiagID !=
@@ -9182,6 +9182,9 @@ def warn_unused_constructor : Warning<
def warn_unused_constructor_msg : Warning<
"ignoring temporary created by a constructor declared with %0 attribute:
%1">,
InGroup;
+def warn_discarded_class_member_access : Warning<
+ "left operand of dot in
https://github.com/MitalAshok updated
https://github.com/llvm/llvm-project/pull/95112
>From e53dfbc9b2c6b7f30c1378731d7de284fa99d568 Mon Sep 17 00:00:00 2001
From: Mital Ashok
Date: Tue, 11 Jun 2024 14:26:38 +0100
Subject: [PATCH 1/3] [Clang] Implement CWG2813
---
clang/docs/ReleaseNotes.rst
https://github.com/MitalAshok updated
https://github.com/llvm/llvm-project/pull/95112
>From e53dfbc9b2c6b7f30c1378731d7de284fa99d568 Mon Sep 17 00:00:00 2001
From: Mital Ashok
Date: Tue, 11 Jun 2024 14:26:38 +0100
Subject: [PATCH 1/2] [Clang] Implement CWG2813
---
clang/docs/ReleaseNotes.rst
27 matches
Mail list logo