aboutsummaryrefslogtreecommitdiff
path: root/lib/AST/ASTContext.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-06-29 20:59:39 +0000
committerDouglas Gregor <dgregor@apple.com>2009-06-29 20:59:39 +0000
commit127102b5196ffe04bdb70fd553fe62c265ab10a9 (patch)
tree04e917cd6dba09eebeafa02b274519f444ac5ab8 /lib/AST/ASTContext.cpp
parentf7b8eec37c8c8012fa525c71fb29a58c9f29beef (diff)
Keep track of function template specializations, to eliminate
redundant, implicit instantiations of function templates and provide a place where we can hang function template specializations. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74454 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/ASTContext.cpp')
-rw-r--r--lib/AST/ASTContext.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp
index 86b5817743..7683d5a160 100644
--- a/lib/AST/ASTContext.cpp
+++ b/lib/AST/ASTContext.cpp
@@ -1806,6 +1806,12 @@ Decl *ASTContext::getCanonicalDecl(Decl *D) {
return const_cast<FunctionDecl *>(Function);
}
+ if (FunctionTemplateDecl *FunTmpl = dyn_cast<FunctionTemplateDecl>(D)) {
+ while (FunTmpl->getPreviousDeclaration())
+ FunTmpl = FunTmpl->getPreviousDeclaration();
+ return FunTmpl;
+ }
+
if (const VarDecl *Var = dyn_cast<VarDecl>(D)) {
while (Var->getPreviousDeclaration())
Var = Var->getPreviousDeclaration();