aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaTemplateInstantiate.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-05-27 17:54:46 +0000
committerDouglas Gregor <dgregor@apple.com>2009-05-27 17:54:46 +0000
commited961e7fffc268eeace169869f5a059bcbd5fcbd (patch)
tree0b9d4239b1a100964d24d58e148dd514495ee279 /lib/Sema/SemaTemplateInstantiate.cpp
parentd0c873799614d32c9c11280878ac1a856f92f707 (diff)
Simplify, and improve the performance of, template instantiation for
declaration references. The key realization is that dependent Decls, which actually require instantiation, can only refer to the current instantiation or members thereof. And, since the current context during instantiation contains all of those members of the current instantiation, we can simply find the real instantiate that matches up with the "current instantiation" template. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72486 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaTemplateInstantiate.cpp')
-rw-r--r--lib/Sema/SemaTemplateInstantiate.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/lib/Sema/SemaTemplateInstantiate.cpp b/lib/Sema/SemaTemplateInstantiate.cpp
index 1cc999201b..1546e39ee2 100644
--- a/lib/Sema/SemaTemplateInstantiate.cpp
+++ b/lib/Sema/SemaTemplateInstantiate.cpp
@@ -407,8 +407,8 @@ QualType
TemplateTypeInstantiator::InstantiateTypedefType(const TypedefType *T,
unsigned Quals) const {
TypedefDecl *Typedef
- = cast_or_null<TypedefDecl>(SemaRef.InstantiateDeclRef(T->getDecl(),
- TemplateArgs));
+ = cast_or_null<TypedefDecl>(
+ SemaRef.InstantiateCurrentDeclRef(T->getDecl()));
if (!Typedef)
return QualType();
@@ -440,8 +440,7 @@ QualType
TemplateTypeInstantiator::InstantiateRecordType(const RecordType *T,
unsigned Quals) const {
RecordDecl *Record
- = cast_or_null<RecordDecl>(SemaRef.InstantiateDeclRef(T->getDecl(),
- TemplateArgs));
+ = cast_or_null<RecordDecl>(SemaRef.InstantiateCurrentDeclRef(T->getDecl()));
if (!Record)
return QualType();
@@ -452,8 +451,7 @@ QualType
TemplateTypeInstantiator::InstantiateEnumType(const EnumType *T,
unsigned Quals) const {
EnumDecl *Enum
- = cast_or_null<EnumDecl>(SemaRef.InstantiateDeclRef(T->getDecl(),
- TemplateArgs));
+ = cast_or_null<EnumDecl>(SemaRef.InstantiateCurrentDeclRef(T->getDecl()));
if (!Enum)
return QualType();