[cfe-commits] r152826 - /cfe/trunk/include/clang/AST/DeclTemplate.h
Douglas Gregor
dgregor at apple.com
Thu Mar 15 12:32:20 PDT 2012
Author: dgregor
Date: Thu Mar 15 14:32:20 2012
New Revision: 152826
URL: http://llvm.org/viewvc/llvm-project?rev=152826&view=rev
Log:
Document RedeclarableTemplateDecl::getInstantiatedFromMemberTemplate().
Modified:
cfe/trunk/include/clang/AST/DeclTemplate.h
Modified: cfe/trunk/include/clang/AST/DeclTemplate.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclTemplate.h?rev=152826&r1=152825&r2=152826&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/DeclTemplate.h (original)
+++ cfe/trunk/include/clang/AST/DeclTemplate.h Thu Mar 15 14:32:20 2012
@@ -618,8 +618,42 @@
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();
}
More information about the cfe-commits
mailing list