Skip to content

Commit ab2b46e

Browse files
committed
Apply Erich's feedback
1 parent 85634bc commit ab2b46e

File tree

3 files changed

+13
-12
lines changed

3 files changed

+13
-12
lines changed

clang/docs/ReleaseNotes.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -665,7 +665,7 @@ Improvements to Clang's diagnostics
665665

666666
- Clang now diagnoses dangling references for C++20's parenthesized aggregate initialization (#101957).
667667

668-
- Fixed a bug where Clang would not emit ``-Wunused-private-field`` warnings when an unrelated class
668+
- Fixed a bug where Clang would not emit ``-Wunused-private-field`` warnings when an unrelated class
669669
defined a defaulted comparison operator (#GH116270).
670670

671671
.. code-block:: c++
@@ -828,7 +828,7 @@ Bug Fixes to C++ Support
828828
- Fixed a bug where bounds of partially expanded pack indexing expressions were checked too early. (#GH116105)
829829
- Fixed an assertion failure caused by using ``consteval`` in condition in consumed analyses. (#GH117385)
830830
- Fix a crash caused by incorrect argument position in merging deduced template arguments. (#GH113659)
831-
- Fixed a parser crash when using pack indexing as a nested name specifier. (#GH119072)
831+
- Fixed a parser crash when using pack indexing as a nested name specifier. (#GH119072)
832832
- Fixed a null pointer dereference issue when heuristically computing ``sizeof...(pack)`` expressions. (#GH81436)
833833
- Fixed an assertion failure caused by mangled names with invalid identifiers. (#GH112205)
834834
- Fixed an incorrect lambda scope of generic lambdas that caused Clang to crash when computing potential lambda

clang/include/clang/Sema/Sema.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10661,7 +10661,7 @@ class Sema final : public SemaBase {
1066110661

1066210662
/// DiagnoseDiscardedExprMarkedNodiscard - Given an expression that is
1066310663
/// semantically a discarded-value expression, diagnose if any [[nodiscard]]
10664-
/// value has been discarded
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/SemaExprMember.cpp

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1124,7 +1124,7 @@ Sema::BuildMemberReferenceExpr(Expr *BaseExpr, QualType BaseExprType,
11241124
// an enumerator, the first expression is a discarded-value expression; if
11251125
// the id-expression names a non-static data member, the first expression
11261126
// shall be a glvalue.
1127-
auto MakeDiscardedValue = [&] {
1127+
auto ConvertBaseExprToDiscardedValue = [&] {
11281128
assert(getLangOpts().CPlusPlus &&
11291129
"Static member / member enumerator outside of C++");
11301130
if (IsArrow)
@@ -1136,7 +1136,7 @@ Sema::BuildMemberReferenceExpr(Expr *BaseExpr, QualType BaseExprType,
11361136
DiagnoseDiscardedExprMarkedNodiscard(BaseExpr);
11371137
return false;
11381138
};
1139-
auto MakeGLValue = [&] {
1139+
auto ConvertBaseExprToGLValue = [&] {
11401140
if (IsArrow || !BaseExpr->isPRValue())
11411141
return false;
11421142
ExprResult Converted = TemporaryMaterializationConversion(BaseExpr);
@@ -1151,7 +1151,7 @@ Sema::BuildMemberReferenceExpr(Expr *BaseExpr, QualType BaseExprType,
11511151
return ExprError();
11521152

11531153
if (FieldDecl *FD = dyn_cast<FieldDecl>(MemberDecl)) {
1154-
if (MakeGLValue())
1154+
if (ConvertBaseExprToGLValue())
11551155
return ExprError();
11561156
return BuildFieldReferenceExpr(BaseExpr, IsArrow, OpLoc, SS, FD, FoundDecl,
11571157
MemberNameInfo);
@@ -1168,7 +1168,7 @@ Sema::BuildMemberReferenceExpr(Expr *BaseExpr, QualType BaseExprType,
11681168
}
11691169

11701170
if (IndirectFieldDecl *FD = dyn_cast<IndirectFieldDecl>(MemberDecl)) {
1171-
if (MakeGLValue())
1171+
if (ConvertBaseExprToGLValue())
11721172
return ExprError();
11731173
// We may have found a field within an anonymous union or struct
11741174
// (C++ [class.union]).
@@ -1179,7 +1179,7 @@ Sema::BuildMemberReferenceExpr(Expr *BaseExpr, QualType BaseExprType,
11791179

11801180
// Static data member
11811181
if (VarDecl *Var = dyn_cast<VarDecl>(MemberDecl)) {
1182-
if (MakeDiscardedValue())
1182+
if (ConvertBaseExprToDiscardedValue())
11831183
return ExprError();
11841184
return BuildMemberExpr(BaseExpr, IsArrow, OpLoc,
11851185
SS.getWithLocInContext(Context), TemplateKWLoc, Var,
@@ -1194,11 +1194,12 @@ Sema::BuildMemberReferenceExpr(Expr *BaseExpr, QualType BaseExprType,
11941194
if (MemberFn->isInstance()) {
11951195
valueKind = VK_PRValue;
11961196
type = Context.BoundMemberTy;
1197-
if (MemberFn->isImplicitObjectMemberFunction() && MakeGLValue())
1197+
if (MemberFn->isImplicitObjectMemberFunction() &&
1198+
ConvertBaseExprToGLValue())
11981199
return ExprError();
11991200
} else {
12001201
// Static member function
1201-
if (MakeDiscardedValue())
1202+
if (ConvertBaseExprToDiscardedValue())
12021203
return ExprError();
12031204
valueKind = VK_LValue;
12041205
type = MemberFn->getType();
@@ -1212,7 +1213,7 @@ Sema::BuildMemberReferenceExpr(Expr *BaseExpr, QualType BaseExprType,
12121213
assert(!isa<FunctionDecl>(MemberDecl) && "member function not C++ method?");
12131214

12141215
if (EnumConstantDecl *Enum = dyn_cast<EnumConstantDecl>(MemberDecl)) {
1215-
if (MakeDiscardedValue())
1216+
if (ConvertBaseExprToDiscardedValue())
12161217
return ExprError();
12171218
return BuildMemberExpr(
12181219
BaseExpr, IsArrow, OpLoc, SS.getWithLocInContext(Context),
@@ -1221,7 +1222,7 @@ Sema::BuildMemberReferenceExpr(Expr *BaseExpr, QualType BaseExprType,
12211222
}
12221223

12231224
if (VarTemplateDecl *VarTempl = dyn_cast<VarTemplateDecl>(MemberDecl)) {
1224-
if (MakeDiscardedValue())
1225+
if (ConvertBaseExprToDiscardedValue())
12251226
return ExprError();
12261227
if (!TemplateArgs) {
12271228
diagnoseMissingTemplateArguments(

0 commit comments

Comments
 (0)