aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaCodeComplete.cpp
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2009-12-16 12:17:52 +0000
committerJohn McCall <rjmccall@apple.com>2009-12-16 12:17:52 +0000
commit3b4294e5c1e904a2e0f74449dbc3f52f69cc8e9f (patch)
tree8dd6c9741fc7f0e77d7b47efd1c0de70295a77ca /lib/Sema/SemaCodeComplete.cpp
parent3055be7e5a706c669dc97f94abe42f68ce8e81e5 (diff)
Shift things around so that it's easier to recover from a missing
function in a C++ call using an arbitrary call-expression type. Actually exploit this to fix the recovery implemented earlier. The diagnostic is still iffy, though. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91538 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaCodeComplete.cpp')
-rw-r--r--lib/Sema/SemaCodeComplete.cpp35
1 files changed, 13 insertions, 22 deletions
diff --git a/lib/Sema/SemaCodeComplete.cpp b/lib/Sema/SemaCodeComplete.cpp
index 4ce9330fc1..6b485ba7a9 100644
--- a/lib/Sema/SemaCodeComplete.cpp
+++ b/lib/Sema/SemaCodeComplete.cpp
@@ -1706,33 +1706,24 @@ void Sema::CodeCompleteCall(Scope *S, ExprTy *FnIn,
CodeCompleteOrdinaryName(S);
return;
}
-
- llvm::SmallVector<NamedDecl*,8> Fns;
- DeclarationName UnqualifiedName;
- NestedNameSpecifier *Qualifier;
- SourceRange QualifierRange;
- bool ArgumentDependentLookup;
- bool Overloaded;
- bool HasExplicitTemplateArgs;
- TemplateArgumentListInfo ExplicitTemplateArgs;
-
- DeconstructCallFunction(Fn, Fns, UnqualifiedName, Qualifier, QualifierRange,
- ArgumentDependentLookup, Overloaded,
- HasExplicitTemplateArgs, ExplicitTemplateArgs);
-
+ // Build an overload candidate set based on the functions we find.
+ OverloadCandidateSet CandidateSet;
+
// FIXME: What if we're calling something that isn't a function declaration?
// FIXME: What if we're calling a pseudo-destructor?
// FIXME: What if we're calling a member function?
- // Build an overload candidate set based on the functions we find.
- OverloadCandidateSet CandidateSet;
- AddOverloadedCallCandidates(Fns, UnqualifiedName,
- ArgumentDependentLookup,
- (HasExplicitTemplateArgs ? &ExplicitTemplateArgs : 0),
- Args, NumArgs,
- CandidateSet,
- /*PartialOverloading=*/true);
+ Expr *NakedFn = Fn->IgnoreParenCasts();
+ if (UnresolvedLookupExpr *ULE = dyn_cast<UnresolvedLookupExpr>(NakedFn))
+ AddOverloadedCallCandidates(ULE, Args, NumArgs, CandidateSet,
+ /*PartialOverloading=*/ true);
+ else if (DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(NakedFn)) {
+ FunctionDecl *FDecl = dyn_cast<FunctionDecl>(DRE->getDecl());
+ if (FDecl)
+ AddOverloadCandidate(FDecl, Args, NumArgs, CandidateSet,
+ false, false, /*PartialOverloading*/ true);
+ }
// Sort the overload candidate set by placing the best overloads first.
std::stable_sort(CandidateSet.begin(), CandidateSet.end(),