diff options
author | Nick Lewycky <nicholas@mxc.ca> | 2010-11-25 00:35:20 +0000 |
---|---|---|
committer | Nick Lewycky <nicholas@mxc.ca> | 2010-11-25 00:35:20 +0000 |
commit | 2a5f99eb4e2af771faacfceb9f78e230129c5e5a (patch) | |
tree | 8634c7998e24299a51169097cfec604e58d46208 /lib/Sema/SemaTemplateInstantiateDecl.cpp | |
parent | 0b9fb2f6b4845bfe5e25b576ae8f2ffa284f9cb1 (diff) |
Tie DefineVTablesUsed() in with recursive function instantiation so that we emit
a useful template instantiation stack. Fixes PR8640.
This also causes a slight change to where the "instantianted from" note shows up
in truly esoteric cases (see the change to test/SemaCXX/destructor.cpp), but
that isn't directly the fault of this patch.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120135 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaTemplateInstantiateDecl.cpp')
-rw-r--r-- | lib/Sema/SemaTemplateInstantiateDecl.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/Sema/SemaTemplateInstantiateDecl.cpp b/lib/Sema/SemaTemplateInstantiateDecl.cpp index fc298c10e4..9899a852d0 100644 --- a/lib/Sema/SemaTemplateInstantiateDecl.cpp +++ b/lib/Sema/SemaTemplateInstantiateDecl.cpp @@ -2108,9 +2108,12 @@ void Sema::InstantiateFunctionDefinition(SourceLocation PointOfInstantiation, // If we're performing recursive template instantiation, create our own // queue of pending implicit instantiations that we will instantiate later, // while we're still within our own instantiation context. + llvm::SmallVector<VTableUse, 16> SavedVTableUses; std::deque<PendingImplicitInstantiation> SavedPendingInstantiations; - if (Recursive) + if (Recursive) { + VTableUses.swap(SavedVTableUses); PendingInstantiations.swap(SavedPendingInstantiations); + } EnterExpressionEvaluationContext EvalContext(*this, Sema::PotentiallyEvaluated); @@ -2173,10 +2176,16 @@ void Sema::InstantiateFunctionDefinition(SourceLocation PointOfInstantiation, Scope.Exit(); if (Recursive) { + // Define any pending vtables. + DefineUsedVTables(); + // Instantiate any pending implicit instantiations found during the // instantiation of this template. PerformPendingInstantiations(); + // Restore the set of pending vtables. + VTableUses.swap(SavedVTableUses); + // Restore the set of pending implicit instantiations. PendingInstantiations.swap(SavedPendingInstantiations); } |