aboutsummaryrefslogtreecommitdiff
path: root/clang/unittests
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/unittests
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/unittests')
-rw-r--r--clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp b/clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp
index 8b3881a..e5a9447 100644
--- a/clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp
+++ b/clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp
@@ -4675,6 +4675,9 @@ TEST(UsingDeclaration, ThroughUsingDeclaration) {
EXPECT_TRUE(notMatches(
"namespace a { void f(); } using a::f; void g() { a::f(); }",
declRefExpr(throughUsingDecl(anything()))));
+ EXPECT_TRUE(matches("struct S {}; namespace a { int operator+(S s1, S s2); } "
+ "using a::operator+; int g() { return S() + S(); }",
+ declRefExpr(throughUsingDecl(anything()))));
}
TEST(SingleDecl, IsSingleDecl) {