[cfe-commits] r91141 - /cfe/trunk/lib/Sema/SemaCodeComplete.cpp
Douglas Gregor
dgregor at apple.com
Fri Dec 11 11:06:05 PST 2009
Author: dgregor
Date: Fri Dec 11 13:06:04 2009
New Revision: 91141
URL: http://llvm.org/viewvc/llvm-project?rev=91141&view=rev
Log:
When code completion of an overload set fails, produce results for ordinary name lookup instead.
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=91141&r1=91140&r2=91141&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaCodeComplete.cpp (original)
+++ cfe/trunk/lib/Sema/SemaCodeComplete.cpp Fri Dec 11 13:06:04 2009
@@ -1698,14 +1698,21 @@
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 @@
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,
More information about the cfe-commits
mailing list