diff options
author | Douglas Gregor <dgregor@apple.com> | 2009-12-11 19:06:04 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2009-12-11 19:06:04 +0000 |
commit | ef96eac2b83e2ed62144bb25b051d09a02296fe0 (patch) | |
tree | 3f4f3bcda0a70236d17a6d4cb31b59cb0a360541 /lib/Sema/SemaCodeComplete.cpp | |
parent | a61a87980d64d1d49872a9a7eeca7eaeb7f95d30 (diff) |
When code completion of an overload set fails, produce results for ordinary name lookup instead.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91141 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaCodeComplete.cpp')
-rw-r--r-- | lib/Sema/SemaCodeComplete.cpp | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/lib/Sema/SemaCodeComplete.cpp b/lib/Sema/SemaCodeComplete.cpp index 140cb5c8a7..654bf25944 100644 --- a/lib/Sema/SemaCodeComplete.cpp +++ b/lib/Sema/SemaCodeComplete.cpp @@ -1698,14 +1698,21 @@ void Sema::CodeCompleteCall(Scope *S, ExprTy *FnIn, ExprTy **ArgsIn, unsigned NumArgs) { if (!CodeCompleter) return; - + + // When we're code-completing for a call, we fall back to ordinary + // name code-completion whenever we can't produce specific + // results. We may want to revisit this strategy in the future, + // e.g., by merging the two kinds of results. + Expr *Fn = (Expr *)FnIn; Expr **Args = (Expr **)ArgsIn; - + // Ignore type-dependent call expressions entirely. if (Fn->isTypeDependent() || - Expr::hasAnyTypeDependentArguments(Args, NumArgs)) + Expr::hasAnyTypeDependentArguments(Args, NumArgs)) { + CodeCompleteOrdinaryName(S); return; + } llvm::SmallVector<NamedDecl*,8> Fns; DeclarationName UnqualifiedName; @@ -1748,8 +1755,12 @@ void Sema::CodeCompleteCall(Scope *S, ExprTy *FnIn, if (Cand->Viable) Results.push_back(ResultCandidate(Cand->Function)); } - CodeCompleter->ProcessOverloadCandidates(*this, NumArgs, Results.data(), - Results.size()); + + if (Results.empty()) + CodeCompleteOrdinaryName(S); + else + CodeCompleter->ProcessOverloadCandidates(*this, NumArgs, Results.data(), + Results.size()); } void Sema::CodeCompleteQualifiedId(Scope *S, const CXXScopeSpec &SS, |