diff options
author | Douglas Gregor <dgregor@apple.com> | 2009-09-01 17:53:10 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2009-09-01 17:53:10 +0000 |
commit | 44c73848d5d5bd34c05582dc8398a20bea7cd971 (patch) | |
tree | b74dd57ccca492e0bda0959547790e600e22cb22 /lib/Sema/SemaTemplateInstantiateDecl.cpp | |
parent | 61481dad22ebca3fba3fe4fb67a3b926d0895e9c (diff) |
Implement proper substitution for OverloadedFunctionDecls, but substituting each of the functions in the overload set
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80692 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaTemplateInstantiateDecl.cpp')
-rw-r--r-- | lib/Sema/SemaTemplateInstantiateDecl.cpp | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/lib/Sema/SemaTemplateInstantiateDecl.cpp b/lib/Sema/SemaTemplateInstantiateDecl.cpp index 99b237d04e..0179160835 100644 --- a/lib/Sema/SemaTemplateInstantiateDecl.cpp +++ b/lib/Sema/SemaTemplateInstantiateDecl.cpp @@ -1347,7 +1347,22 @@ DeclContext *Sema::FindInstantiatedContext(DeclContext* DC) { /// X<T>::<Kind>::KnownValue) to its instantiation /// (X<int>::<Kind>::KnownValue). InstantiateCurrentDeclRef() performs /// this mapping from within the instantiation of X<int>. -NamedDecl * Sema::FindInstantiatedDecl(NamedDecl *D) { +NamedDecl *Sema::FindInstantiatedDecl(NamedDecl *D) { + if (OverloadedFunctionDecl *Ovl = dyn_cast<OverloadedFunctionDecl>(D)) { + // Transform all of the elements of the overloaded function set. + OverloadedFunctionDecl *Result + = OverloadedFunctionDecl::Create(Context, CurContext, Ovl->getDeclName()); + + for (OverloadedFunctionDecl::function_iterator F = Ovl->function_begin(), + FEnd = Ovl->function_end(); + F != FEnd; ++F) { + Result->addOverload( + AnyFunctionDecl::getFromNamedDecl(FindInstantiatedDecl(*F))); + } + + return Result; + } + DeclContext *ParentDC = D->getDeclContext(); if (isa<ParmVarDecl>(D) || ParentDC->isFunctionOrMethod()) { // D is a local of some kind. Look into the map of local @@ -1378,8 +1393,9 @@ NamedDecl * Sema::FindInstantiatedDecl(NamedDecl *D) { } ParentDC = FindInstantiatedContext(ParentDC); - if (!ParentDC) return 0; - + if (!ParentDC) + return 0; + if (ParentDC != D->getDeclContext()) { // We performed some kind of instantiation in the parent context, // so now we need to look into the instantiated parent context to |