]> granicus.if.org Git - clang/commitdiff
Document RedeclarableTemplateDecl::getInstantiatedFromMemberTemplate().
authorDouglas Gregor <dgregor@apple.com>
Thu, 15 Mar 2012 19:32:20 +0000 (19:32 +0000)
committerDouglas Gregor <dgregor@apple.com>
Thu, 15 Mar 2012 19:32:20 +0000 (19:32 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152826 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/AST/DeclTemplate.h

index 14a6ca685acf9d942aaac4207c7c02b6012f2a11..36549eab38d9584868402d6b9461b02b0d0644b3 100644 (file)
@@ -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();
   }