From e6893e22ba6d33f170483979f13f606b7441ca81 Mon Sep 17 00:00:00 2001 From: Alexandre Oliva Date: Thu, 26 Nov 2015 18:57:41 -0200 Subject: extend API to support templates --- include/gcc-cp-fe.def | 221 ++++++++++++++++- include/gcc-cp-interface.h | 53 ++++- libcc1/libcp1plugin.cc | 582 ++++++++++++++++++++++++++++++++++++++++++--- libcc1/marshall-cp.hh | 72 ++++++ libcc1/rpc.hh | 39 ++- 5 files changed, 921 insertions(+), 46 deletions(-) diff --git a/include/gcc-cp-fe.def b/include/gcc-cp-fe.def index 777424886ef..dcbcd61cc5d 100644 --- a/include/gcc-cp-fe.def +++ b/include/gcc-cp-fe.def @@ -204,6 +204,203 @@ GCC_METHOD2 (gcc_type, build_pointer_to_member_type, gcc_type, /* Argument CLASS_TYPE. */ gcc_type) /* Argument MEMBER_TYPE. */ +/* Start a template parameter list, so that subsequent + build_template_typename_parm and build_template_value_parm calls + create template parameters in the list. The list is closed by a + new_decl call with GCC_CP_SYMBOL_FUNCTION or GCC_CP_SYMBOL_CLASS, + that, when the scope is a template parameter list, closes the + parameter list and declares a template function or a template class + with the parameter list. */ + +GCC_METHOD0 (int, start_new_template_decl) + +/* Return the declaration associated with the named type. It is the + declaration, rather than the type proper, that has to be passed as + a template parameter. */ + +GCC_METHOD1 (gcc_typedecl, type_decl, + gcc_type) /* Argument TYPE. */ + +/* Build a typename template-parameter (e.g., the T in template + ). Either PACK_P should be nonzero, to indicate an + argument pack (the last argument in a variadic template argument + list, as in template ), or DEFAULT_TYPE may be + non-NULL to set the default type argument (e.g. X) for the template + parameter. FILENAME and LINE_NUMBER may specify the source + location in which the template parameter was declared. */ + +GCC_METHOD5 (gcc_typedecl, new_template_typename_parm, + const char *, /* Argument ID. */ + int /* bool */, /* Argument PACK_P. */ + gcc_typedecl, /* Argument DEFAULT_TYPE. */ + const char *, /* Argument FILENAME. */ + unsigned int) /* Argument LINE_NUMBER. */ + +/* Build a template template-parameter (e.g., the T in template +