summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST
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
commit6bc50585e34010f34c04b968133e01830eb7cb4d (patch)
tree0e8324d03267bf7299c4be8638fda13e1ef01959 /clang/lib/AST
parent143bae5dcd3c54182728ed5c26f02ce653bef77d (diff)
downloadbcm5719-llvm-6bc50585e34010f34c04b968133e01830eb7cb4d.tar.gz
bcm5719-llvm-6bc50585e34010f34c04b968133e01830eb7cb4d.zip
Start canonicalizing template names. This is not yet complete, but it
improves type identity with dependent types. llvm-svn: 71152
Diffstat (limited to 'clang/lib/AST')
-rw-r--r--clang/lib/AST/ASTContext.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
index c1a232c88e9..3b1a11cb795 100644
--- a/clang/lib/AST/ASTContext.cpp
+++ b/clang/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)
OpenPOWER on IntegriCloud