aboutsummaryrefslogtreecommitdiff
path: root/clang/lib
diff options
context:
space:
mode:
authorDanny Mösch <danny.moesch@icloud.com>2022-07-17 21:28:36 +0200
committerDanny Mösch <danny.moesch@icloud.com>2022-07-26 21:22:18 +0200
commit4e94f6653150511de434fa7e29b684ae7f0e52b6 (patch)
tree96c1dedcf971416866a6b5d80de7881de157eb75 /clang/lib
parent0538e5431afdb1fa05bdcedf70ee502ccfcd112a (diff)
downloadllvm-4e94f6653150511de434fa7e29b684ae7f0e52b6.zip
llvm-4e94f6653150511de434fa7e29b684ae7f0e52b6.tar.gz
llvm-4e94f6653150511de434fa7e29b684ae7f0e52b6.tar.bz2
[clang] Pass FoundDecl to DeclRefExpr creator for operator overloads
Without the "found declaration" it is later not possible to know where the operator declaration was brought into the scope calling it. The initial motivation for this fix came from #55095. However, this also has an influence on `clang -ast-dump` which now prints a `UsingShadow` attribute for operators only visible through `using` statements. Also, clangd now correctly references the `using` statement instead of the operator directly. Reviewed By: shafik Differential Revision: https://reviews.llvm.org/D129973
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Sema/SemaOverload.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaOverload.cpp b/clang/lib/Sema/SemaOverload.cpp
index 5dc0aad..d72cc33 100644
--- a/clang/lib/Sema/SemaOverload.cpp
+++ b/clang/lib/Sema/SemaOverload.cpp
@@ -63,8 +63,9 @@ static ExprResult CreateFunctionRefExpr(
// being used.
if (FoundDecl != Fn && S.DiagnoseUseOfDecl(Fn, Loc))
return ExprError();
- DeclRefExpr *DRE = new (S.Context)
- DeclRefExpr(S.Context, Fn, false, Fn->getType(), VK_LValue, Loc, LocInfo);
+ DeclRefExpr *DRE =
+ DeclRefExpr::Create(S.Context, Fn->getQualifierLoc(), SourceLocation(),
+ Fn, false, Loc, Fn->getType(), VK_LValue, FoundDecl);
if (HadMultipleCandidates)
DRE->setHadMultipleCandidates(true);