summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/DeclTemplate.cpp
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2009-07-18 00:34:07 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2009-07-18 00:34:07 +0000
commit5614aef776d36e2eac36b8fef9c0ab356bb901d2 (patch)
tree5ad25e7032de61012e2e4dfaf5375e86b36913c6 /clang/lib/AST/DeclTemplate.cpp
parente842bd16cef2546439042cd66411c5636b1e25fb (diff)
downloadbcm5719-llvm-5614aef776d36e2eac36b8fef9c0ab356bb901d2.tar.gz
bcm5719-llvm-5614aef776d36e2eac36b8fef9c0ab356bb901d2.zip
Move the functionality of ASTContext::getCanonicalDecl(), into a virtual method Decl::getCanonicalDecl().
llvm-svn: 76273
Diffstat (limited to 'clang/lib/AST/DeclTemplate.cpp')
-rw-r--r--clang/lib/AST/DeclTemplate.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/clang/lib/AST/DeclTemplate.cpp b/clang/lib/AST/DeclTemplate.cpp
index f1bd1b67d21..e096e41aed2 100644
--- a/clang/lib/AST/DeclTemplate.cpp
+++ b/clang/lib/AST/DeclTemplate.cpp
@@ -98,6 +98,13 @@ void FunctionTemplateDecl::Destroy(ASTContext &C) {
Decl::Destroy(C);
}
+FunctionTemplateDecl *FunctionTemplateDecl::getCanonicalDecl() {
+ FunctionTemplateDecl *FunTmpl = this;
+ while (FunTmpl->getPreviousDeclaration())
+ FunTmpl = FunTmpl->getPreviousDeclaration();
+ return FunTmpl;
+}
+
FunctionTemplateDecl::Common *FunctionTemplateDecl::getCommonPtr() {
// Find the first declaration of this function template.
FunctionTemplateDecl *First = this;
@@ -115,6 +122,13 @@ FunctionTemplateDecl::Common *FunctionTemplateDecl::getCommonPtr() {
// ClassTemplateDecl Implementation
//===----------------------------------------------------------------------===//
+ClassTemplateDecl *ClassTemplateDecl::getCanonicalDecl() {
+ ClassTemplateDecl *Template = this;
+ while (Template->getPreviousDeclaration())
+ Template = Template->getPreviousDeclaration();
+ return Template;
+}
+
ClassTemplateDecl *ClassTemplateDecl::Create(ASTContext &C,
DeclContext *DC,
SourceLocation L,
OpenPOWER on IntegriCloud