From 25a3ef7cc5fd55dc8cc67c6e6770c8595657e082 Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Thu, 7 May 2009 06:41:52 +0000 Subject: Start canonicalizing template names. This is not yet complete, but it improves type identity with dependent types. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71152 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/AST/ASTContext.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'lib/AST/ASTContext.cpp') diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp index c1a232c88e..3b1a11cb79 100644 --- a/lib/AST/ASTContext.cpp +++ b/lib/AST/ASTContext.cpp @@ -1700,6 +1700,17 @@ QualType ASTContext::getCanonicalType(QualType T) { VAT->getIndexTypeQualifier()); } +TemplateName ASTContext::getCanonicalTemplateName(TemplateName Name) { + // If this template name refers to a template, the canonical + // template name merely stores the template itself. + if (TemplateDecl *Template = Name.getAsTemplateDecl()) + return TemplateName(Template); + + DependentTemplateName *DTN = Name.getAsDependentTemplateName(); + assert(DTN && "Non-dependent template names must refer to template decls."); + return DTN->CanonicalTemplateName; +} + NestedNameSpecifier * ASTContext::getCanonicalNestedNameSpecifier(NestedNameSpecifier *NNS) { if (!NNS) -- cgit v1.2.3-70-g09d2