From 631d0d36105c07f3e8c4127d252f83dbabbd40a3 Mon Sep 17 00:00:00 2001 From: Matthew Gingell Date: Sun, 5 Oct 2008 12:35:36 +0000 Subject: cpplib.h (cpp_comments, [...]): New structs. 2008-10-05 Matthew Gingell Arnaud Charlet * include/cpplib.h (cpp_comments, cpp_comment_table): New structs. (cpp_get_comments): New function. * internal.h (struct cpp_reader): Add comments field. * init.c (cpp_destroy): Free comments. * lex.c (store_comment, cpp_get_comments): New functions. (comments): New struct. (save_comment): Store comments in comments struct. Co-Authored-By: Arnaud Charlet From-SVN: r140883 --- libcpp/include/cpplib.h | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'libcpp/include') diff --git a/libcpp/include/cpplib.h b/libcpp/include/cpplib.h index 4f073f99433..5720c6fc8ea 100644 --- a/libcpp/include/cpplib.h +++ b/libcpp/include/cpplib.h @@ -870,6 +870,36 @@ extern const char *cpp_type2name (enum cpp_ttype); extern cppchar_t cpp_parse_escape (cpp_reader *, const unsigned char ** pstr, const unsigned char *limit, int wide); +/* Structure used to hold a comment block at a given location in the + source code. */ + +typedef struct +{ + /* Text of the comment including the terminators. */ + char *comment; + + /* source location for the given comment. */ + source_location sloc; +} cpp_comment; + +/* Structure holding all comments for a given cpp_reader. */ + +typedef struct +{ + /* table of comment entries. */ + cpp_comment *entries; + + /* number of actual entries entered in the table. */ + int count; + + /* number of entries allocated currently. */ + int allocated; +} cpp_comment_table; + +/* Returns the table of comments encountered by the preprocessor. This + table is only populated when pfile->state.save_comments is true. */ +extern cpp_comment_table *cpp_get_comments (cpp_reader *); + /* In hash.c */ /* Lookup an identifier in the hashtable. Puts the identifier in the -- cgit v1.2.1