Mercurial > hg > CbC > CbC_gcc
comparison gcc/cp/parser.h @ 145:1830386684a0
gcc-9.2.0
author | anatofuz |
---|---|
date | Thu, 13 Feb 2020 11:34:05 +0900 |
parents | 84e7813d76e9 |
children |
comparison
equal
deleted
inserted
replaced
131:84e7813d76e9 | 145:1830386684a0 |
---|---|
1 /* Data structures and function exported by the C++ Parser. | 1 /* Data structures and function exported by the C++ Parser. |
2 Copyright (C) 2010-2018 Free Software Foundation, Inc. | 2 Copyright (C) 2010-2020 Free Software Foundation, Inc. |
3 | 3 |
4 This file is part of GCC. | 4 This file is part of GCC. |
5 | 5 |
6 GCC is free software; you can redistribute it and/or modify it | 6 GCC is free software; you can redistribute it and/or modify it |
7 under the terms of the GNU General Public License as published by | 7 under the terms of the GNU General Public License as published by |
39 | 39 |
40 /* A C++ token. */ | 40 /* A C++ token. */ |
41 | 41 |
42 struct GTY (()) cp_token { | 42 struct GTY (()) cp_token { |
43 /* The kind of token. */ | 43 /* The kind of token. */ |
44 ENUM_BITFIELD (cpp_ttype) type : 8; | 44 enum cpp_ttype type : 8; |
45 /* If this token is a keyword, this value indicates which keyword. | 45 /* If this token is a keyword, this value indicates which keyword. |
46 Otherwise, this value is RID_MAX. */ | 46 Otherwise, this value is RID_MAX. */ |
47 ENUM_BITFIELD (rid) keyword : 8; | 47 enum rid keyword : 8; |
48 /* Token flags. */ | 48 /* Token flags. */ |
49 unsigned char flags; | 49 unsigned char flags; |
50 /* True if this token is from a context where it is implicitly extern "C" */ | 50 /* True if this token is from a context where it is implicitly extern "C" */ |
51 BOOL_BITFIELD implicit_extern_c : 1; | 51 bool implicit_extern_c : 1; |
52 /* True if an error has already been reported for this token, such as a | 52 /* True if an error has already been reported for this token, such as a |
53 CPP_NAME token that is not a keyword (i.e., for which KEYWORD is | 53 CPP_NAME token that is not a keyword (i.e., for which KEYWORD is |
54 RID_MAX) iff this name was looked up and found to be ambiguous. */ | 54 RID_MAX) iff this name was looked up and found to be ambiguous. */ |
55 BOOL_BITFIELD error_reported : 1; | 55 bool error_reported : 1; |
56 /* True for a token that has been purged. If a token is purged, | 56 /* True for a token that has been purged. If a token is purged, |
57 it is no longer a valid token and it should be considered | 57 it is no longer a valid token and it should be considered |
58 deleted. */ | 58 deleted. */ |
59 BOOL_BITFIELD purged_p : 1; | 59 bool purged_p : 1; |
60 /* 5 unused bits. */ | 60 bool tree_check_p : 1; |
61 /* 4 unused bits. */ | |
62 | |
61 /* The location at which this token was found. */ | 63 /* The location at which this token was found. */ |
62 location_t location; | 64 location_t location; |
63 /* The value associated with this token, if any. */ | 65 /* The value associated with this token, if any. */ |
64 union cp_token_value { | 66 union cp_token_value { |
65 /* Used for compound tokens such as CPP_NESTED_NAME_SPECIFIER. */ | 67 /* Used for compound tokens such as CPP_NESTED_NAME_SPECIFIER. */ |
66 struct tree_check* GTY((tag ("1"))) tree_check_value; | 68 struct tree_check* GTY((tag ("true"))) tree_check_value; |
67 /* Use for all other tokens. */ | 69 /* Use for all other tokens. */ |
68 tree GTY((tag ("0"))) value; | 70 tree GTY((tag ("false"))) value; |
69 } GTY((desc ("(%1.type == CPP_TEMPLATE_ID)" | 71 } GTY((desc ("%1.tree_check_p"))) u; |
70 "|| (%1.type == CPP_NESTED_NAME_SPECIFIER)" | |
71 "|| (%1.type == CPP_DECLTYPE)"))) u; | |
72 }; | 72 }; |
73 | 73 |
74 | 74 |
75 /* We use a stack of token pointer for saving token sets. */ | 75 /* We use a stack of token pointer for saving token sets. */ |
76 typedef struct cp_token *cp_token_position; | 76 typedef struct cp_token *cp_token_position; |
96 /* A stack indicating positions at which cp_lexer_save_tokens was | 96 /* A stack indicating positions at which cp_lexer_save_tokens was |
97 called. The top entry is the most recent position at which we | 97 called. The top entry is the most recent position at which we |
98 began saving tokens. If the stack is non-empty, we are saving | 98 began saving tokens. If the stack is non-empty, we are saving |
99 tokens. */ | 99 tokens. */ |
100 vec<cp_token_position> GTY ((skip)) saved_tokens; | 100 vec<cp_token_position> GTY ((skip)) saved_tokens; |
101 | |
102 /* Saved pieces of end token we replaced with the eof token. */ | |
103 enum cpp_ttype saved_type : 8; | |
104 enum rid saved_keyword : 8; | |
101 | 105 |
102 /* The next lexer in a linked list of lexers. */ | 106 /* The next lexer in a linked list of lexers. */ |
103 struct cp_lexer *next; | 107 struct cp_lexer *next; |
104 | 108 |
105 /* True if we should output debugging information. */ | 109 /* True if we should output debugging information. */ |
161 | 165 |
162 /* Non-static data members with initializers that require post-processing. | 166 /* Non-static data members with initializers that require post-processing. |
163 FIELD_DECLs appear in this list in declaration order. */ | 167 FIELD_DECLs appear in this list in declaration order. */ |
164 vec<tree, va_gc> *nsdmis; | 168 vec<tree, va_gc> *nsdmis; |
165 | 169 |
166 /* Nested classes go in this vector, so that we can do some final | 170 /* Functions with noexcept-specifiers that require post-processing. */ |
167 processing after parsing any NSDMIs. */ | 171 vec<tree, va_gc> *noexcepts; |
168 vec<tree, va_gc> *classes; | |
169 }; | 172 }; |
170 | 173 |
171 | 174 |
172 /* The status of a tentative parse. */ | 175 /* The status of a tentative parse. */ |
173 | 176 |
197 /* The next parsing context in the stack. */ | 200 /* The next parsing context in the stack. */ |
198 struct cp_parser_context *next; | 201 struct cp_parser_context *next; |
199 }; | 202 }; |
200 | 203 |
201 | 204 |
202 /* Helper data structure for parsing #pragma omp declare simd. */ | 205 /* Helper data structure for parsing #pragma omp declare {simd,variant}. */ |
203 struct cp_omp_declare_simd_data { | 206 struct cp_omp_declare_simd_data { |
204 bool error_seen; /* Set if error has been reported. */ | 207 bool error_seen; /* Set if error has been reported. */ |
205 bool fndecl_seen; /* Set if one fn decl/definition has been seen already. */ | 208 bool fndecl_seen; /* Set if one fn decl/definition has been seen already. */ |
209 bool variant_p; /* Set for #pragma omp declare variant. */ | |
206 vec<cp_token_cache_ptr> tokens; | 210 vec<cp_token_cache_ptr> tokens; |
207 tree clauses; | 211 tree clauses; |
208 }; | 212 }; |
209 | 213 |
210 /* Helper data structure for parsing #pragma acc routine. */ | 214 /* Helper data structure for parsing #pragma acc routine. */ |
280 | 284 |
281 /* TRUE if ALLOW_NON_CONSTANT_EXPRESSION_P is TRUE and something has | 285 /* TRUE if ALLOW_NON_CONSTANT_EXPRESSION_P is TRUE and something has |
282 been seen that makes the expression non-constant. */ | 286 been seen that makes the expression non-constant. */ |
283 bool non_integral_constant_expression_p; | 287 bool non_integral_constant_expression_p; |
284 | 288 |
285 /* TRUE if local variable names and `this' are forbidden in the | 289 /* Used to track if local variable names and/or `this' are forbidden |
286 current context. */ | 290 in the current context. */ |
287 bool local_variables_forbidden_p; | 291 #define LOCAL_VARS_FORBIDDEN (1 << 0) |
292 #define THIS_FORBIDDEN (1 << 1) | |
293 #define LOCAL_VARS_AND_THIS_FORBIDDEN (LOCAL_VARS_FORBIDDEN | THIS_FORBIDDEN) | |
294 unsigned char local_variables_forbidden_p; | |
288 | 295 |
289 /* TRUE if the declaration we are parsing is part of a | 296 /* TRUE if the declaration we are parsing is part of a |
290 linkage-specification of the form `extern string-literal | 297 linkage-specification of the form `extern string-literal |
291 declaration'. */ | 298 declaration'. */ |
292 bool in_unbraced_linkage_specification_p; | 299 bool in_unbraced_linkage_specification_p; |
345 /* If non-NULL, then we are parsing a construct where new type | 352 /* If non-NULL, then we are parsing a construct where new type |
346 definitions are not permitted. The string stored here will be | 353 definitions are not permitted. The string stored here will be |
347 issued as an error message if a type is defined. */ | 354 issued as an error message if a type is defined. */ |
348 const char *type_definition_forbidden_message; | 355 const char *type_definition_forbidden_message; |
349 | 356 |
357 /* Argument for type_definition_forbidden_message if needed. */ | |
358 const char *type_definition_forbidden_message_arg; | |
359 | |
350 /* A stack used for member functions of local classes. The lists | 360 /* A stack used for member functions of local classes. The lists |
351 contained in an individual entry can only be processed once the | 361 contained in an individual entry can only be processed once the |
352 outermost class being defined is complete. */ | 362 outermost class being defined is complete. */ |
353 vec<cp_unparsed_functions_entry, va_gc> *unparsed_queues; | 363 vec<cp_unparsed_functions_entry, va_gc> *unparsed_queues; |
354 | 364 |