aboutsummaryrefslogtreecommitdiff
path: root/lib/AST/DeclTemplate.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2011-02-19 18:51:44 +0000
committerDouglas Gregor <dgregor@apple.com>2011-02-19 18:51:44 +0000
commitda2142f2e2b3a02ee6eb5de9f9e6ed6f7eb5a0c0 (patch)
treebdb4fdd5649f271c47b55ed687dc2b1f9feb3170 /lib/AST/DeclTemplate.cpp
parentf91ae524c01488ef2e525e5d73fa61424948e6c6 (diff)
Revert all of my commits that devirtualized the Decl hierarchy, which
lead to a serious slowdown (4%) on parsing of Cocoa.h. This memory optimization should be revisited later, when we have time to look at the generated code. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126033 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/DeclTemplate.cpp')
-rw-r--r--lib/AST/DeclTemplate.cpp28
1 files changed, 20 insertions, 8 deletions
diff --git a/lib/AST/DeclTemplate.cpp b/lib/AST/DeclTemplate.cpp
index 980a373778..a73deeab3a 100644
--- a/lib/AST/DeclTemplate.cpp
+++ b/lib/AST/DeclTemplate.cpp
@@ -112,14 +112,6 @@ RedeclarableTemplateDecl::CommonBase *RedeclarableTemplateDecl::getCommonPtr() {
}
-RedeclarableTemplateDecl::CommonBase *
-RedeclarableTemplateDecl::newCommon(ASTContext &C) {
- if (FunctionTemplateDecl *FunTmpl = dyn_cast<FunctionTemplateDecl>(this))
- return FunTmpl->newCommon(C);
-
- return cast<ClassTemplateDecl>(this)->newCommon(C);
-}
-
RedeclarableTemplateDecl *RedeclarableTemplateDecl::getCanonicalDeclImpl() {
RedeclarableTemplateDecl *Tmpl = this;
while (Tmpl->getPreviousDeclaration())
@@ -455,6 +447,13 @@ NonTypeTemplateParmDecl::Create(const ASTContext &C, DeclContext *DC,
ExpandedTInfos);
}
+SourceLocation NonTypeTemplateParmDecl::getInnerLocStart() const {
+ SourceLocation Start = getTypeSpecStartLoc();
+ if (Start.isInvalid())
+ Start = getLocation();
+ return Start;
+}
+
SourceRange NonTypeTemplateParmDecl::getSourceRange() const {
return SourceRange(getOuterLocStart(), getLocation());
}
@@ -544,6 +543,19 @@ ClassTemplateSpecializationDecl::Create(ASTContext &Context, EmptyShell Empty) {
new (Context)ClassTemplateSpecializationDecl(ClassTemplateSpecialization);
}
+void
+ClassTemplateSpecializationDecl::getNameForDiagnostic(std::string &S,
+ const PrintingPolicy &Policy,
+ bool Qualified) const {
+ NamedDecl::getNameForDiagnostic(S, Policy, Qualified);
+
+ const TemplateArgumentList &TemplateArgs = getTemplateArgs();
+ S += TemplateSpecializationType::PrintTemplateArgumentList(
+ TemplateArgs.data(),
+ TemplateArgs.size(),
+ Policy);
+}
+
ClassTemplateDecl *
ClassTemplateSpecializationDecl::getSpecializedTemplate() const {
if (SpecializedPartialSpecialization *PartialSpec