diff options
author | Douglas Gregor <dgregor@apple.com> | 2009-03-09 23:48:35 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2009-03-09 23:48:35 +0000 |
commit | c40290e452d44e4814f870152d36649347df7b3c (patch) | |
tree | e72e4f1c1ddb3599377cb9e12b0593d492d83747 /clang/lib/AST/DeclTemplate.cpp | |
parent | d5b35ee21574b31c9a9555a1c99eb83742544769 (diff) | |
download | bcm5719-llvm-c40290e452d44e4814f870152d36649347df7b3c.tar.gz bcm5719-llvm-c40290e452d44e4814f870152d36649347df7b3c.zip |
Implement template instantiation for ClassTemplateSpecializationTypes,
such as replacing 'T' in vector<T>. There are a few aspects to this:
- Extend TemplateArgument to allow arbitrary expressions (an
Expr*), and switch ClassTemplateSpecializationType to store
TemplateArguments rather than it's own type-or-expression
representation.
- ClassTemplateSpecializationType can now store dependent types. In
that case, the canonical type is another
ClassTemplateSpecializationType (with default template arguments
expanded) rather than a declaration (we don't build Decls for
dependent types).
- Split ActOnClassTemplateId into ActOnClassTemplateId (called from
the parser) and CheckClassTemplateId (called from
ActOnClassTemplateId and InstantiateType). They're smart enough to
handle dependent types, now.
llvm-svn: 66509
Diffstat (limited to 'clang/lib/AST/DeclTemplate.cpp')
-rw-r--r-- | clang/lib/AST/DeclTemplate.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/clang/lib/AST/DeclTemplate.cpp b/clang/lib/AST/DeclTemplate.cpp index ed4fd44e707..ac76c258a71 100644 --- a/clang/lib/AST/DeclTemplate.cpp +++ b/clang/lib/AST/DeclTemplate.cpp @@ -145,6 +145,15 @@ SourceLocation TemplateTemplateParmDecl::getDefaultArgumentLoc() const { } //===----------------------------------------------------------------------===// +// TemplateArgument Implementation +//===----------------------------------------------------------------------===// + +TemplateArgument::TemplateArgument(Expr *E) : Kind(Expression) { + TypeOrValue = reinterpret_cast<uintptr_t>(E); + StartLoc = E->getSourceRange().getBegin(); +} + +//===----------------------------------------------------------------------===// // ClassTemplateSpecializationDecl Implementation //===----------------------------------------------------------------------===// ClassTemplateSpecializationDecl:: |