@@ -48,7 +48,7 @@ static bool functionHasPassObjectSizeParams(const FunctionDecl *FD) {
48
48
/// A convenience routine for creating a decayed reference to a function.
49
49
static ExprResult
50
50
CreateFunctionRefExpr(Sema &S, FunctionDecl *Fn, NamedDecl *FoundDecl,
51
- bool HadMultipleCandidates,
51
+ const Expr *Base, bool HadMultipleCandidates,
52
52
SourceLocation Loc = SourceLocation(),
53
53
const DeclarationNameLoc &LocInfo = DeclarationNameLoc()){
54
54
if (S.DiagnoseUseOfDecl(FoundDecl, Loc))
@@ -68,7 +68,7 @@ CreateFunctionRefExpr(Sema &S, FunctionDecl *Fn, NamedDecl *FoundDecl,
68
68
if (HadMultipleCandidates)
69
69
DRE->setHadMultipleCandidates(true);
70
70
71
- S.MarkDeclRefReferenced(DRE);
71
+ S.MarkDeclRefReferenced(DRE, Base );
72
72
return S.ImpCastExprToType(DRE, S.Context.getPointerType(DRE->getType()),
73
73
CK_FunctionToPointerDecay);
74
74
}
@@ -11946,6 +11946,7 @@ Sema::CreateOverloadedUnaryOp(SourceLocation OpLoc, UnaryOperatorKind Opc,
11946
11946
FunctionDecl *FnDecl = Best->Function;
11947
11947
11948
11948
if (FnDecl) {
11949
+ Expr *Base = nullptr;
11949
11950
// We matched an overloaded operator. Build a call to that
11950
11951
// operator.
11951
11952
@@ -11958,7 +11959,7 @@ Sema::CreateOverloadedUnaryOp(SourceLocation OpLoc, UnaryOperatorKind Opc,
11958
11959
Best->FoundDecl, Method);
11959
11960
if (InputRes.isInvalid())
11960
11961
return ExprError();
11961
- Input = InputRes.get();
11962
+ Base = Input = InputRes.get();
11962
11963
} else {
11963
11964
// Convert the arguments.
11964
11965
ExprResult InputInit
@@ -11974,7 +11975,8 @@ Sema::CreateOverloadedUnaryOp(SourceLocation OpLoc, UnaryOperatorKind Opc,
11974
11975
11975
11976
// Build the actual expression node.
11976
11977
ExprResult FnExpr = CreateFunctionRefExpr(*this, FnDecl, Best->FoundDecl,
11977
- HadMultipleCandidates, OpLoc);
11978
+ Base, HadMultipleCandidates,
11979
+ OpLoc);
11978
11980
if (FnExpr.isInvalid())
11979
11981
return ExprError();
11980
11982
@@ -12159,6 +12161,7 @@ Sema::CreateOverloadedBinOp(SourceLocation OpLoc,
12159
12161
FunctionDecl *FnDecl = Best->Function;
12160
12162
12161
12163
if (FnDecl) {
12164
+ Expr *Base = nullptr;
12162
12165
// We matched an overloaded operator. Build a call to that
12163
12166
// operator.
12164
12167
@@ -12180,7 +12183,7 @@ Sema::CreateOverloadedBinOp(SourceLocation OpLoc,
12180
12183
Best->FoundDecl, Method);
12181
12184
if (Arg0.isInvalid())
12182
12185
return ExprError();
12183
- Args[0] = Arg0.getAs<Expr>();
12186
+ Base = Args[0] = Arg0.getAs<Expr>();
12184
12187
Args[1] = RHS = Arg1.getAs<Expr>();
12185
12188
} else {
12186
12189
// Convert the arguments.
@@ -12204,7 +12207,7 @@ Sema::CreateOverloadedBinOp(SourceLocation OpLoc,
12204
12207
12205
12208
// Build the actual expression node.
12206
12209
ExprResult FnExpr = CreateFunctionRefExpr(*this, FnDecl,
12207
- Best->FoundDecl,
12210
+ Best->FoundDecl, Base,
12208
12211
HadMultipleCandidates, OpLoc);
12209
12212
if (FnExpr.isInvalid())
12210
12213
return ExprError();
@@ -12426,6 +12429,7 @@ Sema::CreateOverloadedArraySubscriptExpr(SourceLocation LLoc,
12426
12429
OpLocInfo.setCXXOperatorNameRange(SourceRange(LLoc, RLoc));
12427
12430
ExprResult FnExpr = CreateFunctionRefExpr(*this, FnDecl,
12428
12431
Best->FoundDecl,
12432
+ Base,
12429
12433
HadMultipleCandidates,
12430
12434
OpLocInfo.getLoc(),
12431
12435
OpLocInfo.getInfo());
@@ -12984,7 +12988,7 @@ Sema::BuildCallToObjectOfClassType(Scope *S, Expr *Obj,
12984
12988
Context.DeclarationNames.getCXXOperatorName(OO_Call), LParenLoc);
12985
12989
OpLocInfo.setCXXOperatorNameRange(SourceRange(LParenLoc, RParenLoc));
12986
12990
ExprResult NewFn = CreateFunctionRefExpr(*this, Method, Best->FoundDecl,
12987
- HadMultipleCandidates,
12991
+ Obj, HadMultipleCandidates,
12988
12992
OpLocInfo.getLoc(),
12989
12993
OpLocInfo.getInfo());
12990
12994
if (NewFn.isInvalid())
@@ -13175,7 +13179,7 @@ Sema::BuildOverloadedArrowExpr(Scope *S, Expr *Base, SourceLocation OpLoc,
13175
13179
13176
13180
// Build the operator call.
13177
13181
ExprResult FnExpr = CreateFunctionRefExpr(*this, Method, Best->FoundDecl,
13178
- HadMultipleCandidates, OpLoc);
13182
+ Base, HadMultipleCandidates, OpLoc);
13179
13183
if (FnExpr.isInvalid())
13180
13184
return ExprError();
13181
13185
@@ -13234,7 +13238,7 @@ ExprResult Sema::BuildLiteralOperatorCall(LookupResult &R,
13234
13238
13235
13239
FunctionDecl *FD = Best->Function;
13236
13240
ExprResult Fn = CreateFunctionRefExpr(*this, FD, Best->FoundDecl,
13237
- HadMultipleCandidates,
13241
+ nullptr, HadMultipleCandidates,
13238
13242
SuffixInfo.getLoc(),
13239
13243
SuffixInfo.getInfo());
13240
13244
if (Fn.isInvalid())
0 commit comments