diff options
author | Francois Pichet <pichet2000@gmail.com> | 2011-09-07 00:14:57 +0000 |
---|---|---|
committer | Francois Pichet <pichet2000@gmail.com> | 2011-09-07 00:14:57 +0000 |
commit | bcf6471010a1c3376cfc938f6ccc1e364fc07d1d (patch) | |
tree | f39856ffbdec6842d38b5f89c3c7282b4b61b103 /clang/lib/Sema/SemaOverload.cpp | |
parent | 9d814e0dd255d567d9d8349122bab25e1153cde4 (diff) | |
download | bcm5719-llvm-bcf6471010a1c3376cfc938f6ccc1e364fc07d1d.tar.gz bcm5719-llvm-bcf6471010a1c3376cfc938f6ccc1e364fc07d1d.zip |
In Microsoft mode, if we are inside a template class member function and we can't resolve a function call then create a type-dependent CallExpr even if the function has no type dependent arguments. The goal is to postpone name lookup to instantiation time to be able to search into type dependent base classes.
With this patch in, clang will generate only 37 errors (down from 212) when parsing a typical MFC source file.
llvm-svn: 139210
Diffstat (limited to 'clang/lib/Sema/SemaOverload.cpp')
-rw-r--r-- | clang/lib/Sema/SemaOverload.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaOverload.cpp b/clang/lib/Sema/SemaOverload.cpp index 6f3b1aa7bf5..4f36189ce56 100644 --- a/clang/lib/Sema/SemaOverload.cpp +++ b/clang/lib/Sema/SemaOverload.cpp @@ -8289,9 +8289,22 @@ Sema::BuildOverloadedCallExpr(Scope *S, Expr *Fn, UnresolvedLookupExpr *ULE, // If we found nothing, try to recover. // BuildRecoveryCallExpr diagnoses the error itself, so we just bail // out if it fails. - if (CandidateSet.empty()) + if (CandidateSet.empty()) { + // In Microsoft mode, if we are inside a template class member function then
+ // create a type dependent CallExpr. The goal is to postpone name lookup
+ // to instantiation time to be able to search into type dependent base + // classes.
+ if (getLangOptions().Microsoft && CurContext->isDependentContext() &&
+ isa<CXXMethodDecl>(CurContext)) {
+ CallExpr *CE = new (Context) CallExpr(Context, Fn, Args, NumArgs,
+ Context.DependentTy, VK_RValue,
+ RParenLoc);
+ CE->setTypeDependent(true);
+ return Owned(CE);
+ }
return BuildRecoveryCallExpr(*this, S, Fn, ULE, LParenLoc, Args, NumArgs, RParenLoc, /*EmptyLookup=*/true); + } OverloadCandidateSet::iterator Best; switch (CandidateSet.BestViableFunction(*this, Fn->getLocStart(), Best)) { |