diff options
author | Douglas Gregor <dgregor@apple.com> | 2009-02-05 23:33:38 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2009-02-05 23:33:38 +0000 |
commit | fab9d67cebb87be968e7ae31a3b549a5279b5d51 (patch) | |
tree | e6e71ce878f610e0f9539097db19e55df64e566e /lib/AST/TypeSerialization.cpp | |
parent | 4a3aed942bd6e4e73679b1676bc1ac82248b592d (diff) |
Improve the representation of template type parameters. We now
canonicalize by template parameter depth, index, and name, and the
unnamed version of a template parameter serves as the canonical.
TemplateTypeParmDecl no longer needs to inherit from
TemplateParmPosition, since depth and index information is present
within the type.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63899 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/TypeSerialization.cpp')
-rw-r--r-- | lib/AST/TypeSerialization.cpp | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/lib/AST/TypeSerialization.cpp b/lib/AST/TypeSerialization.cpp index 12c3d03c12..57598d3afc 100644 --- a/lib/AST/TypeSerialization.cpp +++ b/lib/AST/TypeSerialization.cpp @@ -127,7 +127,7 @@ void Type::Create(ASTContext& Context, unsigned i, Deserializer& D) { break; case Type::TemplateTypeParm: - D.RegisterPtr(PtrID,TemplateTypeParmType::CreateImpl(Context, D)); + D.RegisterPtr(PtrID, TemplateTypeParmType::CreateImpl(Context, D)); break; case Type::VariableArray: @@ -364,20 +364,18 @@ Type* TypeOfType::CreateImpl(ASTContext& Context, Deserializer& D) { //===----------------------------------------------------------------------===// void TemplateTypeParmType::EmitImpl(Serializer& S) const { - S.EmitPtr(getDecl()); + S.EmitInt(Depth); + S.EmitInt(Index); + S.EmitPtr(Name); } Type* TemplateTypeParmType::CreateImpl(ASTContext& Context, Deserializer& D) { - std::vector<Type*>& Types = - const_cast<std::vector<Type*>&>(Context.getTypes()); - - TemplateTypeParmType* T = new TemplateTypeParmType(NULL); - Types.push_back(T); - - D.ReadPtr(T->Decl); // May be backpatched. - return T; + unsigned Depth = D.ReadInt(); + unsigned Index = D.ReadInt(); + IdentifierInfo *Name = D.ReadPtr<IdentifierInfo>(); + return Context.getTemplateTypeParmType(Depth, Index, Name).getTypePtr(); } - + //===----------------------------------------------------------------------===// // VariableArrayType //===----------------------------------------------------------------------===// |