aboutsummaryrefslogtreecommitdiff
path: root/lib/AST/ASTContext.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-05-07 06:41:52 +0000
committerDouglas Gregor <dgregor@apple.com>2009-05-07 06:41:52 +0000
commit25a3ef7cc5fd55dc8cc67c6e6770c8595657e082 (patch)
tree9d0b8da3f04c8523d04d964c5fad080a3889cc5a /lib/AST/ASTContext.cpp
parent4d3cbf0335dc43a281377052afa180af28f39e7f (diff)
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
Diffstat (limited to 'lib/AST/ASTContext.cpp')
-rw-r--r--lib/AST/ASTContext.cpp11
1 files changed, 11 insertions, 0 deletions
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)