mirror of https://github.com/microsoft/clang.git
Don't show deleted function (constructor) candidates for code completion
In case of copy constructor is implicitly deleted it's still shown. PR34402 describes a way to reproduce that. Patch by Ivan Donchevskii! Differential Revision: https://reviews.llvm.org/D37435 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@312785 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
185b81b1f8
commit
0abc73f06c
|
@ -4286,9 +4286,12 @@ static void mergeCandidatesWithResults(Sema &SemaRef,
|
|||
});
|
||||
|
||||
// Add the remaining viable overload candidates as code-completion results.
|
||||
for (auto &Candidate : CandidateSet)
|
||||
for (auto &Candidate : CandidateSet) {
|
||||
if (Candidate.Function && Candidate.Function->isDeleted())
|
||||
continue;
|
||||
if (Candidate.Viable)
|
||||
Results.push_back(ResultCandidate(Candidate.Function));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -18,6 +18,20 @@ int main() {
|
|||
int(42);
|
||||
}
|
||||
|
||||
struct Foo {
|
||||
Foo() = default;
|
||||
Foo(const Foo&) = delete;
|
||||
};
|
||||
|
||||
struct Bar {
|
||||
Foo f;
|
||||
};
|
||||
|
||||
void function() {
|
||||
Bar b1;
|
||||
Bar b2(b1);
|
||||
}
|
||||
|
||||
// RUN: c-index-test -code-completion-at=%s:11:10 %s | FileCheck -check-prefix=CHECK-CC1 %s
|
||||
// CHECK-CC1: OverloadCandidate:{Text S}{LeftParen (}{CurrentParameter const S<int> &}{RightParen )} (1)
|
||||
// CHECK-CC1: OverloadCandidate:{Text S}{LeftParen (}{CurrentParameter int}{Comma , }{Placeholder U}{Comma , }{Placeholder U}{RightParen )} (1)
|
||||
|
@ -138,3 +152,6 @@ int main() {
|
|||
// CHECK-CC10-NEXT: Class name
|
||||
// CHECK-CC10-NEXT: Nested name specifier
|
||||
// CHECK-CC10-NEXT: Objective-C interface
|
||||
|
||||
// RUN: c-index-test -code-completion-at=%s:32:12 -std=c++11 %s | FileCheck -check-prefix=CHECK-CC11 %s
|
||||
// CHECK-CC11-NOT: OverloadCandidate:{Text Bar}{LeftParen (}{CurrentParameter const Bar &}{RightParen )} (1)
|
||||
|
|
Loading…
Reference in New Issue