aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2012-03-15 19:32:20 +0000
committerDouglas Gregor <dgregor@apple.com>2012-03-15 19:32:20 +0000
commit0f5897bf5f919df28c76013d1efa17441f7241ff (patch)
treebc468cbf782e514a9bbb3cc7e1d2b11f4ed06085
parent62d7fea624f466d11001b2dc733bee12a3b90c3a (diff)
Document RedeclarableTemplateDecl::getInstantiatedFromMemberTemplate().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152826 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/clang/AST/DeclTemplate.h38
1 files changed, 36 insertions, 2 deletions
diff --git a/include/clang/AST/DeclTemplate.h b/include/clang/AST/DeclTemplate.h
index 14a6ca685a..36549eab38 100644
--- a/include/clang/AST/DeclTemplate.h
+++ b/include/clang/AST/DeclTemplate.h
@@ -618,8 +618,42 @@ public:
getCommonPtr()->InstantiatedFromMember.setInt(true);
}
- /// \brief Retrieve the previous declaration of this template, or
- /// NULL if no such declaration exists.
+ /// \brief Retrieve the member template from which this template was
+ /// instantiated, or NULL if this template was not instantiated from a
+ /// member template.
+ ///
+ /// A template is instantiated from a member template when the member
+ /// template itself is part of a class template (or member thereof). For
+ /// example, given
+ ///
+ /// \code
+ /// template<typename T>
+ /// struct X {
+ /// template<typename U> void f(T, U);
+ /// };
+ ///
+ /// void test(X<int> x) {
+ /// x.f(1, 'a');
+ /// };
+ /// \endcode
+ ///
+ /// \c X<int>::f is a FunctionTemplateDecl that describes the function
+ /// template
+ ///
+ /// \code
+ /// template<typename U> void X<int>::f(int, U);
+ /// \endcode
+ ///
+ /// which was itself created during the instantiation of \c X<int>. Calling
+ /// getInstantiatedFromMemberTemplate() on this FunctionTemplateDecl will
+ /// retrieve the FunctionTemplateDecl for the original template "f" within
+ /// the class template \c X<T>, i.e.,
+ ///
+ /// \code
+ /// template<typename T>
+ /// template<typename U>
+ /// void X<T>::f(T, U);
+ /// \endcode
RedeclarableTemplateDecl *getInstantiatedFromMemberTemplate() {
return getCommonPtr()->InstantiatedFromMember.getPointer();
}