r373710 - [CodeComplete] Ensure object is the same in compareOverloads()
Ilya Biryukov via cfe-commits
cfe-commits at lists.llvm.org
Fri Oct 4 01:10:27 PDT 2019
Author: ibiryukov
Date: Fri Oct 4 01:10:27 2019
New Revision: 373710
URL: http://llvm.org/viewvc/llvm-project?rev=373710&view=rev
Log:
[CodeComplete] Ensure object is the same in compareOverloads()
Summary:
This fixes a regression that led to size() not being available in clangd
when completing 'deque().^' and using libc++.
Reviewers: sammccall
Reviewed By: sammccall
Subscribers: jkorous, arphaman, kadircet, usaxena95, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D68335
Added:
cfe/trunk/test/CodeCompletion/member-access-qualifiers.cpp
Modified:
cfe/trunk/lib/Sema/SemaCodeComplete.cpp
Modified: cfe/trunk/lib/Sema/SemaCodeComplete.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaCodeComplete.cpp?rev=373710&r1=373709&r2=373710&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaCodeComplete.cpp (original)
+++ cfe/trunk/lib/Sema/SemaCodeComplete.cpp Fri Oct 4 01:10:27 2019
@@ -1185,6 +1185,9 @@ static OverloadCompare compareOverloads(
const CXXMethodDecl &Incumbent,
const Qualifiers &ObjectQuals,
ExprValueKind ObjectKind) {
+ // Base/derived shadowing is handled elsewhere.
+ if (Candidate.getDeclContext() != Incumbent.getDeclContext())
+ return OverloadCompare::BothViable;
if (Candidate.isVariadic() != Incumbent.isVariadic() ||
Candidate.getNumParams() != Incumbent.getNumParams() ||
Candidate.getMinRequiredArguments() !=
Added: cfe/trunk/test/CodeCompletion/member-access-qualifiers.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeCompletion/member-access-qualifiers.cpp?rev=373710&view=auto
==============================================================================
--- cfe/trunk/test/CodeCompletion/member-access-qualifiers.cpp (added)
+++ cfe/trunk/test/CodeCompletion/member-access-qualifiers.cpp Fri Oct 4 01:10:27 2019
@@ -0,0 +1,13 @@
+struct deque_base {
+ int &size();
+ const int &size() const;
+};
+
+struct deque : private deque_base {
+ int size() const;
+};
+
+auto x = deque().
+// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:10:18 %s -o - | FileCheck %s
+// CHECK: COMPLETION: size : [#int#]size()[# const#]
+// CHECK: COMPLETION: size (Hidden,InBase,Inaccessible) : [#int &#]deque_base::size()
More information about the cfe-commits
mailing list