diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-09-02 00:07:54 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-09-02 00:07:54 +0000 |
commit | e0329acf5c9437e2086a2fb2bf7a95ae2ac96505 (patch) | |
tree | 20eca64e62fe41b8664256fa556925769fc86c51 /include/clang-c | |
parent | fcf431609769a9600c24618d1a33135caec4fef2 (diff) |
Introduce a new libclang function,
clang_getSpecializedCursorTemplate(), which determines the template
(or member thereof) that the given cursor specializes or from which it
was instantiated. This routine can be used to establish a link between
templates and their instantiations/specializations.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112780 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang-c')
-rw-r--r-- | include/clang-c/Index.h | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/include/clang-c/Index.h b/include/clang-c/Index.h index d5e3373b91..4631c65bf0 100644 --- a/include/clang-c/Index.h +++ b/include/clang-c/Index.h @@ -1751,6 +1751,36 @@ CINDEX_LINKAGE unsigned clang_CXXMethod_isStatic(CXCursor C); CINDEX_LINKAGE enum CXCursorKind clang_getTemplateCursorKind(CXCursor C); /** + * \brief Given a cursor that may represent a specialization or instantiation + * of a template, retrieve the cursor that represents the template that it + * specializes or from which it was instantiated. + * + * This routine determines the template involved both for explicit + * specializations of templates and for implicit instantiations of the template, + * both of which are referred to as "specializations". For a class template + * specialization (e.g., \c std::vector<bool>), this routine will return + * either the primary template (\c std::vector) or, if the specialization was + * instantiated from a class template partial specialization, the class template + * partial specialization. For a class template partial specialization and a + * function template specialization (including instantiations), this + * this routine will return the specialized template. + * + * For members of a class template (e.g., member functions, member classes, or + * static data members), returns the specialized or instantiated member. + * Although not strictly "templates" in the C++ language, members of class + * templates have the same notions of specializations and instantiations that + * templates do, so this routine treats them similarly. + * + * \param C A cursor that may be a specialization of a template or a member + * of a template. + * + * \returns If the given cursor is a specialization or instantiation of a + * template or a member thereof, the template or member that it specializes or + * from which it was instantiated. Otherwise, returns a NULL cursor. + */ +CINDEX_LINKAGE CXCursor clang_getSpecializedCursorTemplate(CXCursor C); + +/** * @} */ |