* Makefile.def (target_modules): Remove libcilkrts. * Makefile.in: Ditto. * configure: Ditto. * configure.ac: Ditto. contrib/ * contrib/gcc_update: Ditto. gcc/ * Makefile.in (cilkplus.def, cilk-builtins.def, c-family/cilk.o, c-family/c-cilkplus.o, c-family/array-notation-common.o, cilk-common.o, cilk.h, cilk-common.c): Remove. * builtin-types.def (BT_FN_INT_PTR_PTR_PTR_FTYPE_BT_INT_BT_PTR_BT_PTR_BT_PTR): Remove. * builtins.c (is_builtin_name): Remove cilkplus condition. (BUILT_IN_CILK_DETACH, BUILT_IN_CILK_POP_FRAME): Remove. * builtins.def (DEF_CILK_BUILTIN_STUB, DEF_CILKPLUS_BUILTIN, cilk-builtins.def, cilkplus.def): Remove. * cif-code.def (CILK_SPAWN): Remove. * cilk-builtins.def: Delete. * cilk-common.c: Ditto. * cilk.h: Ditto. * cilkplus.def: Ditto. * config/darwin.h (fcilkplus): Delete. * cppbuiltin.c: Ditto. * doc/extend.texi: Remove cilkplus doc. * doc/generic.texi: Ditto. * doc/invoke.texi: Ditto. * doc/passes.texi: Ditto. * gcc.c (fcilkplus): Remove. * gengtype.c (cilk.h): Remove. * gimple-pretty-print.c (dump_gimple_omp_for): Remove cilkplus support. * gimple.h (GF_OMP_FOR_KIND_CILKFOR, GF_OMP_FOR_KIND_CILKSIMD): Remove. * gimplify.c (gimplify_return_expr, maybe_fold_stmt, gimplify_call_expr, is_gimple_stmt, gimplify_modify_expr, gimplify_scan_omp_clauses, gimplify_adjust_omp_clauses, gimplify_omp_for, gimplify_expr): Remove cilkplus conditions. * ipa-fnsummary.c (ipa_dump_fn_summary, compute_fn_summary, inline_read_section): Ditto. * ipa-inline-analysis.c (cilk.h): Remove. * ira.c (ira_setup_eliminable_regset): Remove cilkplus support. * lto-wrapper.c (merge_and_complain, append_compiler_options, append_linker_options): Remove condition for fcilkplus. * lto/lto-lang.c (cilk.h): Remove. (lto_init): Remove condition for fcilkplus. * omp-expand.c (expand_cilk_for_call): Delete. (expand_omp_taskreg, expand_omp_for_static_chunk, expand_omp_for): Remove cilkplus conditions. (expand_cilk_for): Delete. * omp-general.c (omp_extract_for_data): Remove cilkplus support. * omp-low.c (scan_sharing_clauses, create_omp_child_function, execute_lower_omp, diagnose_sb_0): Ditto. * omp-simd-clone.c (simd_clone_clauses_extract): Ditto. * tree-core.h (OMP_CLAUSE__CILK_FOR_COUNT_): Delete. * tree-nested.c: Ditto. * tree-pretty-print.c (dump_omp_clause): Remove cilkplus support. (dump_generic_node): Ditto. * tree.c (OMP_CLAUSE__CILK_FOR_COUNT_): Delete. * tree.def (cilk_simd, cilk_for, cilk_spawn_stmt, cilk_sync_stmt): Delete. * tree.h (CILK_SPAWN_FN, EXPR_CILK_SPAWN): Delete. gcc/c-family/ * array-notation-common.c: Delete. * c-cilkplus.c: Ditto. * c-common.c (_Cilk_spawn, _Cilk_sync, _Cilk_for): Remove. * c-common.def (ARRAY_NOTATION_REF): Remove. * c-common.h (RID_CILK_SPAWN, build_array_notation_expr, build_array_notation_ref, C_ORT_CILK, c_check_cilk_loop, c_validate_cilk_plus_loop, cilkplus_an_parts, cilk_ignorable_spawn_rhs_op, cilk_recognize_spawn): Remove. * c-gimplify.c (CILK_SPAWN_STMT): Remove. * c-omp.c: Remove CILK_SIMD check. * c-pragma.c: Ditto. * c-pragma.h: Remove CILK related pragmas. * c-pretty-print.c (c_pretty_printer::postfix_expression): Remove ARRAY_NOTATION_REF condition. (c_pretty_printer::expression): Ditto. * c.opt (fcilkplus): Remove. * cilk.c: Delete. gcc/c/ * Make-lang.in (c/c-array-notation.o): Remove. * c-array-notation.c: Delete. * c-decl.c: Remove cilkplus condition. * c-parser.c (c_parser_cilk_simd, c_parser_cilk_for, c_parser_cilk_verify_simd, c_parser_array_notation, c_parser_cilk_clause_vectorlength, c_parser_cilk_grainsize, c_parser_cilk_simd_fn_vector_attrs, c_finish_cilk_simd_fn_tokens): Delete. (c_parser_declaration_or_fndef): Remove cilkplus condition. (c_parser_direct_declarator_inner): Ditto. (CILK_SIMD_FN_CLAUSE_MASK): Delete. (c_parser_attributes, c_parser_compound_statement, c_parser_statement_after_labels, c_parser_if_statement, c_parser_switch_statement, c_parser_while_statement, c_parser_do_statement, c_parser_for_statement, c_parser_unary_expression, c_parser_postfix_expression, c_parser_postfix_expression_after_primary, c_parser_pragma, c_parser_omp_clause_name, c_parser_omp_all_clauses, c_parser_omp_for_loop, c_finish_omp_declare_simd): Remove cilkplus support. * c-typeck.c (build_array_ref, build_function_call_vec, convert_arguments, lvalue_p, build_compound_expr, c_finish_return, c_finish_if_stmt, c_finish_loop, build_binary_op): Remove cilkplus support. gcc/cp/ * Make-lang.in (cp/cp-array-notation.o, cp/cp-cilkplus.o): Delete. * call.c (convert_for_arg_passing, build_cxx_call): Remove cilkplus. * constexpr.c (potential_constant_expression_1): Ditto. * cp-array-notation.c: Delete. * cp-cilkplus.c: Ditto. * cp-cilkplus.h: Ditto. * cp-gimplify.c (cp_gimplify_expr, cp_fold_r, cp_genericize): Remove cilkplus condition. * cp-objcp-common.c (ARRAY_NOTATION_REF): Delete. * cp-tree.h (cilkplus_an_triplet_types_ok_p): Delete. * decl.c (grokfndecl, finish_function): Remove cilkplus condition. * error.c (dump_decl, dump_expr): Remove ARRAY_NOTATION_REF condition. * lambda.c (cp-cilkplus.h): Remove. * parser.c (cp_parser_cilk_simd, cp_parser_cilk_for, cp_parser_cilk_simd_vectorlength): Delete. (cp_debug_parser, cp_parser_ctor_initializer_opt_and_function_body, cp_parser_postfix_expression, cp_parser_postfix_open_square_expression, cp_parser_statement, cp_parser_jump_statement, cp_parser_direct_declarator, cp_parser_late_return_type_opt, cp_parser_gnu_attribute_list, cp_parser_omp_clause_name, cp_parser_omp_clause_aligned, cp_parser_omp_clause_linear, cp_parser_omp_all_clauses, cp_parser_omp_flush, cp_parser_omp_for_cond, cp_parser_omp_for_incr, cp_parser_omp_for_loop_init, cp_parser_omp_for_loop, cp_parser_omp_declare_simd): Remove cilkplus support. (CILK_SIMD_FN_CLAUSE_MASK, cp_parser_late_parsing_cilk_simd_fn_info, cp_parser_cilk_grainsize): Remove. (cp_parser_pragma, c_parse_file): Remove cilkplus support. (cp_parser_cilk_simd_vectorlength, cp_parser_cilk_simd_linear, cp_parser_cilk_simd_clause_name, cp_parser_cilk_simd_all_clauses, cp_parser_cilk_simd, cp_parser_cilk_for): Remove. * parser.h (IN_CILK_SIMD_FOR, IN_CILK_SPAWN): Remove. * pt.c (tsubst_attribute, tsubst_expr, tsubst_copy_and_build): Remove cilkplus support. * semantics.c (finish_goto_stmt, begin_while_stmt, finish_do_body, finish_init_stmt, finish_switch_cond, simplify_aggr_init_expr, finish_omp_clauses, finish_omp_clauses, finish_omp_for): Remove cilkplus support. * tree.c (lvalue_kind): Remove ARRAY_NOTATION_REF conditon. * typeck.c (cp_build_array_ref, cp_build_compound_expr, check_return_expr): Remove cilkplus support. gcc/testsuite/ * c-c++-common/attr-simd-3.c: Delete. * c-c++-common/cilk-plus/AN/an-if.c: Delete. * c-c++-common/cilk-plus/AN/array_test1.c: Delete. * c-c++-common/cilk-plus/AN/array_test2.c: Delete. * c-c++-common/cilk-plus/AN/array_test_ND.c: Delete. * c-c++-common/cilk-plus/AN/builtin_fn_custom.c: Delete. * c-c++-common/cilk-plus/AN/builtin_fn_mutating.c: Delete. * c-c++-common/cilk-plus/AN/builtin_func_double.c: Delete. * c-c++-common/cilk-plus/AN/builtin_func_double2.c: Delete. * c-c++-common/cilk-plus/AN/comma_exp.c: Delete. * c-c++-common/cilk-plus/AN/conditional.c: Delete. * c-c++-common/cilk-plus/AN/decl-ptr-colon.c: Delete. * c-c++-common/cilk-plus/AN/dimensionless-arrays.c: Delete. * c-c++-common/cilk-plus/AN/exec-once.c: Delete. * c-c++-common/cilk-plus/AN/exec-once2.c: Delete. * c-c++-common/cilk-plus/AN/fn_ptr-2.c: Delete. * c-c++-common/cilk-plus/AN/fn_ptr.c: Delete. * c-c++-common/cilk-plus/AN/fp_triplet_values.c: Delete. * c-c++-common/cilk-plus/AN/gather-scatter-errors.c: Delete. * c-c++-common/cilk-plus/AN/gather_scatter.c: Delete. * c-c++-common/cilk-plus/AN/if_test.c: Delete. * c-c++-common/cilk-plus/AN/if_test_errors.c: Delete. * c-c++-common/cilk-plus/AN/misc.c: Delete. * c-c++-common/cilk-plus/AN/n-ptr-test.c: Delete. * c-c++-common/cilk-plus/AN/parser_errors.c: Delete. * c-c++-common/cilk-plus/AN/parser_errors2.c: Delete. * c-c++-common/cilk-plus/AN/parser_errors3.c: Delete. * c-c++-common/cilk-plus/AN/parser_errors4.c: Delete. * c-c++-common/cilk-plus/AN/pr57457-2.c: Delete. * c-c++-common/cilk-plus/AN/pr57457.c: Delete. * c-c++-common/cilk-plus/AN/pr57490.c: Delete. * c-c++-common/cilk-plus/AN/pr57541-2.c: Delete. * c-c++-common/cilk-plus/AN/pr57541.c: Delete. * c-c++-common/cilk-plus/AN/pr57577.c: Delete. * c-c++-common/cilk-plus/AN/pr58942.c: Delete. * c-c++-common/cilk-plus/AN/pr61191.c: Delete. * c-c++-common/cilk-plus/AN/pr61455-2.c: Delete. * c-c++-common/cilk-plus/AN/pr61455.c: Delete. * c-c++-common/cilk-plus/AN/pr61962.c: Delete. * c-c++-common/cilk-plus/AN/pr61963.c: Delete. * c-c++-common/cilk-plus/AN/pr62008.c: Delete. * c-c++-common/cilk-plus/AN/pr63884.c: Delete. * c-c++-common/cilk-plus/AN/rank_mismatch.c: Delete. * c-c++-common/cilk-plus/AN/rank_mismatch2.c: Delete. * c-c++-common/cilk-plus/AN/rank_mismatch3.c: Delete. * c-c++-common/cilk-plus/AN/sec_implicit.c: Delete. * c-c++-common/cilk-plus/AN/sec_implicit2.c: Delete. * c-c++-common/cilk-plus/AN/sec_implicit_ex.c: Delete. * c-c++-common/cilk-plus/AN/sec_reduce_ind_same_value.c: Delete. * c-c++-common/cilk-plus/AN/sec_reduce_max_min_ind.c: Delete. * c-c++-common/cilk-plus/AN/sec_reduce_return.c: Delete. * c-c++-common/cilk-plus/AN/side-effects-1.c: Delete. * c-c++-common/cilk-plus/AN/test_builtin_return.c: Delete. * c-c++-common/cilk-plus/AN/test_sec_limits.c: Delete. * c-c++-common/cilk-plus/AN/tst_lngth.c: Delete. * c-c++-common/cilk-plus/AN/vla.c: Delete. * c-c++-common/cilk-plus/CK/Wparentheses-1.c: Delete. * c-c++-common/cilk-plus/CK/cilk-for-2.c: Delete. * c-c++-common/cilk-plus/CK/cilk-for-3.c: Delete. * c-c++-common/cilk-plus/CK/cilk-fors.c: Delete. * c-c++-common/cilk-plus/CK/cilk_for_errors.c: Delete. * c-c++-common/cilk-plus/CK/cilk_for_grain.c: Delete. * c-c++-common/cilk-plus/CK/cilk_for_grain_errors.c: Delete. * c-c++-common/cilk-plus/CK/cilk_for_ptr_iter.c: Delete. * c-c++-common/cilk-plus/CK/compound_cilk_spawn.c: Delete. * c-c++-common/cilk-plus/CK/concec_cilk_spawn.c: Delete. * c-c++-common/cilk-plus/CK/errors.c: Delete. * c-c++-common/cilk-plus/CK/fib.c: Delete. * c-c++-common/cilk-plus/CK/fib_init_expr_xy.c: Delete. * c-c++-common/cilk-plus/CK/fib_no_return.c: Delete. * c-c++-common/cilk-plus/CK/fib_no_sync.c: Delete. * c-c++-common/cilk-plus/CK/invalid_spawns.c: Delete. * c-c++-common/cilk-plus/CK/invalid_sync.c: Delete.c * c-c++-common/cilk-plus/CK/nested_cilk_for.c: Delete. * c-c++-common/cilk-plus/CK/no_args_error.c: Delete. * c-c++-common/cilk-plus/CK/pr59631.c: Delete. * c-c++-common/cilk-plus/CK/pr60197-2.c: Delete. * c-c++-common/cilk-plus/CK/pr60197.c: Delete. * c-c++-common/cilk-plus/CK/pr60469.c: Delete. * c-c++-common/cilk-plus/CK/pr60586.c: Delete. * c-c++-common/cilk-plus/CK/pr63307.c: Delete. * c-c++-common/cilk-plus/CK/pr69826-1.c: Delete. * c-c++-common/cilk-plus/CK/pr69826-2.c: Delete. * c-c++-common/cilk-plus/CK/pr79428-4.c: Delete. * c-c++-common/cilk-plus/CK/pr79428-7.c: Delete. * c-c++-common/cilk-plus/CK/spawn_in_return.c: Delete. * c-c++-common/cilk-plus/CK/spawnee_inline.c: Delete. * c-c++-common/cilk-plus/CK/spawner_inline.c: Delete. * c-c++-common/cilk-plus/CK/spawning_arg.c: Delete. * c-c++-common/cilk-plus/CK/steal_check.c: Delete. * c-c++-common/cilk-plus/CK/sync_wo_spawn.c: Delete. * c-c++-common/cilk-plus/CK/test__cilk.c: Delete. * c-c++-common/cilk-plus/CK/varargs_test.c: Delete. * c-c++-common/cilk-plus/PS/Wparentheses-1.c: Delete. * c-c++-common/cilk-plus/PS/body.c: Delete. * c-c++-common/cilk-plus/PS/clauses1.c: Delete. * c-c++-common/cilk-plus/PS/clauses2.c: Delete. * c-c++-common/cilk-plus/PS/clauses3.c: Delete. * c-c++-common/cilk-plus/PS/clauses4.c: Delete. * c-c++-common/cilk-plus/PS/for1.c: Delete. * c-c++-common/cilk-plus/PS/for2.c: Delete. * c-c++-common/cilk-plus/PS/for3.c: Delete. * c-c++-common/cilk-plus/PS/pr69363.c: Delete. * c-c++-common/cilk-plus/PS/reduction-1.c: Delete. * c-c++-common/cilk-plus/PS/reduction-2.c: Delete. * c-c++-common/cilk-plus/PS/reduction-3.c: Delete. * c-c++-common/cilk-plus/PS/run-1.c: Delete. * c-c++-common/cilk-plus/PS/safelen.c: Delete. * c-c++-common/cilk-plus/PS/vectorlength-2.c: Delete. * c-c++-common/cilk-plus/PS/vectorlength-3.c: Delete. * c-c++-common/cilk-plus/PS/vectorlength.c: Delete. * c-c++-common/cilk-plus/SE/ef_error.c: Delete. * c-c++-common/cilk-plus/SE/ef_error2.c: Delete. * c-c++-common/cilk-plus/SE/ef_error3.c: Delete. * c-c++-common/cilk-plus/SE/ef_test.c: Delete. * c-c++-common/cilk-plus/SE/ef_test2.c: Delete. * c-c++-common/cilk-plus/SE/vlength_errors.c: Delete. * g++.dg/cilk-plus/AN/array_function.c: Delete. * g++.dg/cilk-plus/AN/array_test1_tplt.c: Delete. * g++.dg/cilk-plus/AN/array_test2_tplt.c: Delete. * g++.dg/cilk-plus/AN/array_test_ND_tplt.c: Delete. * g++.dg/cilk-plus/AN/braced_list.c: Delete. * g++.dg/cilk-plus/AN/builtin_fn_custom_tplt.c: Delete. * g++.dg/cilk-plus/AN/builtin_fn_mutating_tplt.c: Delete. * g++.dg/cilk-plus/AN/fp_triplet_values_tplt.c: Delete. * g++.dg/cilk-plus/AN/postincr_test.c: Delete. * g++.dg/cilk-plus/AN/preincr_test.c: Delete. * g++.dg/cilk-plus/CK/catch_exc.c: Delete. * g++.dg/cilk-plus/CK/cf3.c: Delete. * g++.dg/cilk-plus/CK/cilk-for-tplt.c: Delete. * g++.dg/cilk-plus/CK/const_spawn.c: Delete. * g++.dg/cilk-plus/CK/fib-opr-overload.c: Delete. * g++.dg/cilk-plus/CK/fib-tplt.c: Delete. * g++.dg/cilk-plus/CK/for1.c: Delete. * g++.dg/cilk-plus/CK/lambda_spawns.c: Delete. * g++.dg/cilk-plus/CK/lambda_spawns_tplt.c: Delete. * g++.dg/cilk-plus/CK/pr60586.c: Delete. * g++.dg/cilk-plus/CK/pr66326.c: Delete. * g++.dg/cilk-plus/CK/pr68001.c: Delete. * g++.dg/cilk-plus/CK/pr68997.c: Delete. * g++.dg/cilk-plus/CK/pr69024.c: Delete. * g++.dg/cilk-plus/CK/pr69048.c: Delete. * g++.dg/cilk-plus/CK/pr69267.c: Delete. * g++.dg/cilk-plus/CK/pr80038.c: Delete. * g++.dg/cilk-plus/CK/stl_iter.c: Delete. * g++.dg/cilk-plus/CK/stl_rev_iter.c: Delete. * g++.dg/cilk-plus/CK/stl_test.c: Delete. * g++.dg/cilk-plus/cilk-plus.exp * g++.dg/cilk-plus/ef_test.C: Delete. * g++.dg/cilk-plus/for.C: Delete. * g++.dg/cilk-plus/for2.C: Delete. * g++.dg/cilk-plus/for3.C: Delete. * g++.dg/cilk-plus/for4.C: Delete. * g++.dg/cilk-plus/pr60967.C: Delete. * g++.dg/cilk-plus/pr69028.C: Delete. * g++.dg/cilk-plus/pr70565.C: Delete. * g++.dg/pr57662.C: Delete. * gcc.dg/cilk-plus/cilk-plus.exp * gcc.dg/cilk-plus/for1.c: Delete. * gcc.dg/cilk-plus/for2.c: Delete. * gcc.dg/cilk-plus/jump-openmp.c: Delete. * gcc.dg/cilk-plus/jump.c: Delete. * gcc.dg/cilk-plus/pr69798-1.c: Delete. * gcc.dg/cilk-plus/pr69798-2.c: Delete. * gcc.dg/cilk-plus/pr78306.c: Delete. * gcc.dg/cilk-plus/pr79116.c: Delete. * gcc.dg/graphite/id-28.c: Delete. * lib/cilk-plus-dg.exp: Delete. * lib/target-supports.exp (cilkplus_runtime): Delete. Co-Authored-By: Sebastian Peryt <sebastian.peryt@intel.com> From-SVN: r255195
431 lines
16 KiB
C
431 lines
16 KiB
C
/* Data structures and function exported by the C++ Parser.
|
|
Copyright (C) 2010-2017 Free Software Foundation, Inc.
|
|
|
|
This file is part of GCC.
|
|
|
|
GCC is free software; you can redistribute it and/or modify it
|
|
under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation; either version 3, or (at your option)
|
|
any later version.
|
|
|
|
GCC is distributed in the hope that it will be useful, but
|
|
WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with GCC; see the file COPYING3. If not see
|
|
<http://www.gnu.org/licenses/>. */
|
|
|
|
#ifndef GCC_CP_PARSER_H
|
|
#define GCC_CP_PARSER_H
|
|
|
|
#include "tree.h"
|
|
#include "cp/cp-tree.h"
|
|
#include "c-family/c-pragma.h"
|
|
|
|
/* A token's value and its associated deferred access checks and
|
|
qualifying scope. */
|
|
|
|
struct GTY(()) tree_check {
|
|
/* The value associated with the token. */
|
|
tree value;
|
|
/* The checks that have been associated with value. */
|
|
vec<deferred_access_check, va_gc> *checks;
|
|
/* The token's qualifying scope (used when it is a
|
|
CPP_NESTED_NAME_SPECIFIER). */
|
|
tree qualifying_scope;
|
|
};
|
|
|
|
/* A C++ token. */
|
|
|
|
struct GTY (()) cp_token {
|
|
/* The kind of token. */
|
|
ENUM_BITFIELD (cpp_ttype) type : 8;
|
|
/* If this token is a keyword, this value indicates which keyword.
|
|
Otherwise, this value is RID_MAX. */
|
|
ENUM_BITFIELD (rid) keyword : 8;
|
|
/* Token flags. */
|
|
unsigned char flags;
|
|
/* True if this token is from a context where it is implicitly extern "C" */
|
|
BOOL_BITFIELD implicit_extern_c : 1;
|
|
/* True if an error has already been reported for this token, such as a
|
|
CPP_NAME token that is not a keyword (i.e., for which KEYWORD is
|
|
RID_MAX) iff this name was looked up and found to be ambiguous. */
|
|
BOOL_BITFIELD error_reported : 1;
|
|
/* True for a token that has been purged. If a token is purged,
|
|
it is no longer a valid token and it should be considered
|
|
deleted. */
|
|
BOOL_BITFIELD purged_p : 1;
|
|
/* 5 unused bits. */
|
|
/* The location at which this token was found. */
|
|
location_t location;
|
|
/* The value associated with this token, if any. */
|
|
union cp_token_value {
|
|
/* Used for compound tokens such as CPP_NESTED_NAME_SPECIFIER. */
|
|
struct tree_check* GTY((tag ("1"))) tree_check_value;
|
|
/* Use for all other tokens. */
|
|
tree GTY((tag ("0"))) value;
|
|
} GTY((desc ("(%1.type == CPP_TEMPLATE_ID)"
|
|
"|| (%1.type == CPP_NESTED_NAME_SPECIFIER)"
|
|
"|| (%1.type == CPP_DECLTYPE)"))) u;
|
|
};
|
|
|
|
|
|
/* We use a stack of token pointer for saving token sets. */
|
|
typedef struct cp_token *cp_token_position;
|
|
|
|
/* The cp_lexer structure represents the C++ lexer. It is responsible
|
|
for managing the token stream from the preprocessor and supplying
|
|
it to the parser. Tokens are never added to the cp_lexer after
|
|
it is created. */
|
|
|
|
struct GTY (()) cp_lexer {
|
|
/* The memory allocated for the buffer. NULL if this lexer does not
|
|
own the token buffer. */
|
|
vec<cp_token, va_gc> *buffer;
|
|
|
|
/* A pointer just past the last available token. The tokens
|
|
in this lexer are [buffer, last_token). */
|
|
cp_token_position GTY ((skip)) last_token;
|
|
|
|
/* The next available token. If NEXT_TOKEN is &eof_token, then there are
|
|
no more available tokens. */
|
|
cp_token_position GTY ((skip)) next_token;
|
|
|
|
/* A stack indicating positions at which cp_lexer_save_tokens was
|
|
called. The top entry is the most recent position at which we
|
|
began saving tokens. If the stack is non-empty, we are saving
|
|
tokens. */
|
|
vec<cp_token_position> GTY ((skip)) saved_tokens;
|
|
|
|
/* The next lexer in a linked list of lexers. */
|
|
struct cp_lexer *next;
|
|
|
|
/* True if we should output debugging information. */
|
|
bool debugging_p;
|
|
|
|
/* True if we're in the context of parsing a pragma, and should not
|
|
increment past the end-of-line marker. */
|
|
bool in_pragma;
|
|
};
|
|
|
|
|
|
/* cp_token_cache is a range of tokens. There is no need to represent
|
|
allocate heap memory for it, since tokens are never removed from the
|
|
lexer's array. There is also no need for the GC to walk through
|
|
a cp_token_cache, since everything in here is referenced through
|
|
a lexer. */
|
|
|
|
struct GTY(()) cp_token_cache {
|
|
/* The beginning of the token range. */
|
|
cp_token * GTY((skip)) first;
|
|
|
|
/* Points immediately after the last token in the range. */
|
|
cp_token * GTY ((skip)) last;
|
|
};
|
|
|
|
typedef cp_token_cache *cp_token_cache_ptr;
|
|
|
|
struct cp_token_ident
|
|
{
|
|
unsigned int ident_len;
|
|
const char *ident_str;
|
|
unsigned int before_len;
|
|
const char *before_str;
|
|
unsigned int after_len;
|
|
const char *after_str;
|
|
};
|
|
|
|
/* An entry in a queue of function arguments that require post-processing. */
|
|
|
|
struct GTY(()) cp_default_arg_entry {
|
|
/* The current_class_type when we parsed this arg. */
|
|
tree class_type;
|
|
|
|
/* The function decl itself. */
|
|
tree decl;
|
|
};
|
|
|
|
|
|
/* An entry in a stack for member functions defined within their classes. */
|
|
|
|
struct GTY(()) cp_unparsed_functions_entry {
|
|
/* Functions with default arguments that require post-processing.
|
|
Functions appear in this list in declaration order. */
|
|
vec<cp_default_arg_entry, va_gc> *funs_with_default_args;
|
|
|
|
/* Functions with defintions that require post-processing. Functions
|
|
appear in this list in declaration order. */
|
|
vec<tree, va_gc> *funs_with_definitions;
|
|
|
|
/* Non-static data members with initializers that require post-processing.
|
|
FIELD_DECLs appear in this list in declaration order. */
|
|
vec<tree, va_gc> *nsdmis;
|
|
|
|
/* Nested classes go in this vector, so that we can do some final
|
|
processing after parsing any NSDMIs. */
|
|
vec<tree, va_gc> *classes;
|
|
};
|
|
|
|
|
|
/* The status of a tentative parse. */
|
|
|
|
enum cp_parser_status_kind
|
|
{
|
|
/* No errors have occurred. */
|
|
CP_PARSER_STATUS_KIND_NO_ERROR,
|
|
/* An error has occurred. */
|
|
CP_PARSER_STATUS_KIND_ERROR,
|
|
/* We are committed to this tentative parse, whether or not an error
|
|
has occurred. */
|
|
CP_PARSER_STATUS_KIND_COMMITTED
|
|
};
|
|
|
|
|
|
/* Context that is saved and restored when parsing tentatively. */
|
|
struct GTY (()) cp_parser_context {
|
|
/* If this is a tentative parsing context, the status of the
|
|
tentative parse. */
|
|
enum cp_parser_status_kind status;
|
|
/* If non-NULL, we have just seen a `x->' or `x.' expression. Names
|
|
that are looked up in this context must be looked up both in the
|
|
scope given by OBJECT_TYPE (the type of `x' or `*x') and also in
|
|
the context of the containing expression. */
|
|
tree object_type;
|
|
|
|
/* The next parsing context in the stack. */
|
|
struct cp_parser_context *next;
|
|
};
|
|
|
|
|
|
/* Helper data structure for parsing #pragma omp declare simd, and Cilk Plus
|
|
SIMD-enabled functions' vector attribute. */
|
|
struct cp_omp_declare_simd_data {
|
|
bool error_seen; /* Set if error has been reported. */
|
|
bool fndecl_seen; /* Set if one fn decl/definition has been seen already. */
|
|
vec<cp_token_cache_ptr> tokens;
|
|
tree clauses;
|
|
};
|
|
|
|
/* Helper data structure for parsing #pragma acc routine. */
|
|
struct cp_oacc_routine_data : cp_omp_declare_simd_data {
|
|
location_t loc;
|
|
};
|
|
|
|
/* The cp_parser structure represents the C++ parser. */
|
|
|
|
struct GTY(()) cp_parser {
|
|
/* The lexer from which we are obtaining tokens. */
|
|
cp_lexer *lexer;
|
|
|
|
/* The scope in which names should be looked up. If NULL_TREE, then
|
|
we look up names in the scope that is currently open in the
|
|
source program. If non-NULL, this is either a TYPE or
|
|
NAMESPACE_DECL for the scope in which we should look. It can
|
|
also be ERROR_MARK, when we've parsed a bogus scope.
|
|
|
|
This value is not cleared automatically after a name is looked
|
|
up, so we must be careful to clear it before starting a new look
|
|
up sequence. (If it is not cleared, then `X::Y' followed by `Z'
|
|
will look up `Z' in the scope of `X', rather than the current
|
|
scope.) Unfortunately, it is difficult to tell when name lookup
|
|
is complete, because we sometimes peek at a token, look it up,
|
|
and then decide not to consume it. */
|
|
tree scope;
|
|
|
|
/* OBJECT_SCOPE and QUALIFYING_SCOPE give the scopes in which the
|
|
last lookup took place. OBJECT_SCOPE is used if an expression
|
|
like "x->y" or "x.y" was used; it gives the type of "*x" or "x",
|
|
respectively. QUALIFYING_SCOPE is used for an expression of the
|
|
form "X::Y"; it refers to X. */
|
|
tree object_scope;
|
|
tree qualifying_scope;
|
|
|
|
/* A stack of parsing contexts. All but the bottom entry on the
|
|
stack will be tentative contexts.
|
|
|
|
We parse tentatively in order to determine which construct is in
|
|
use in some situations. For example, in order to determine
|
|
whether a statement is an expression-statement or a
|
|
declaration-statement we parse it tentatively as a
|
|
declaration-statement. If that fails, we then reparse the same
|
|
token stream as an expression-statement. */
|
|
cp_parser_context *context;
|
|
|
|
/* True if we are parsing GNU C++. If this flag is not set, then
|
|
GNU extensions are not recognized. */
|
|
bool allow_gnu_extensions_p;
|
|
|
|
/* TRUE if the `>' token should be interpreted as the greater-than
|
|
operator. FALSE if it is the end of a template-id or
|
|
template-parameter-list. In C++0x mode, this flag also applies to
|
|
`>>' tokens, which are viewed as two consecutive `>' tokens when
|
|
this flag is FALSE. */
|
|
bool greater_than_is_operator_p;
|
|
|
|
/* TRUE if default arguments are allowed within a parameter list
|
|
that starts at this point. FALSE if only a gnu extension makes
|
|
them permissible. */
|
|
bool default_arg_ok_p;
|
|
|
|
/* TRUE if we are parsing an integral constant-expression. See
|
|
[expr.const] for a precise definition. */
|
|
bool integral_constant_expression_p;
|
|
|
|
/* TRUE if we are parsing an integral constant-expression -- but a
|
|
non-constant expression should be permitted as well. This flag
|
|
is used when parsing an array bound so that GNU variable-length
|
|
arrays are tolerated. */
|
|
bool allow_non_integral_constant_expression_p;
|
|
|
|
/* TRUE if ALLOW_NON_CONSTANT_EXPRESSION_P is TRUE and something has
|
|
been seen that makes the expression non-constant. */
|
|
bool non_integral_constant_expression_p;
|
|
|
|
/* TRUE if local variable names and `this' are forbidden in the
|
|
current context. */
|
|
bool local_variables_forbidden_p;
|
|
|
|
/* TRUE if the declaration we are parsing is part of a
|
|
linkage-specification of the form `extern string-literal
|
|
declaration'. */
|
|
bool in_unbraced_linkage_specification_p;
|
|
|
|
/* TRUE if we are presently parsing a declarator, after the
|
|
direct-declarator. */
|
|
bool in_declarator_p;
|
|
|
|
/* TRUE if we are presently parsing a template-argument-list. */
|
|
bool in_template_argument_list_p;
|
|
|
|
/* Set to IN_ITERATION_STMT if parsing an iteration-statement,
|
|
to IN_OMP_BLOCK if parsing OpenMP structured block and
|
|
IN_OMP_FOR if parsing OpenMP loop. If parsing a switch statement,
|
|
this is bitwise ORed with IN_SWITCH_STMT, unless parsing an
|
|
iteration-statement, OpenMP block or loop within that switch. */
|
|
#define IN_SWITCH_STMT 1
|
|
#define IN_ITERATION_STMT 2
|
|
#define IN_OMP_BLOCK 4
|
|
#define IN_OMP_FOR 8
|
|
#define IN_IF_STMT 16
|
|
unsigned char in_statement;
|
|
|
|
/* TRUE if we are presently parsing the body of a switch statement.
|
|
Note that this doesn't quite overlap with in_statement above.
|
|
The difference relates to giving the right sets of error messages:
|
|
"case not in switch" vs "break statement used with OpenMP...". */
|
|
bool in_switch_statement_p;
|
|
|
|
/* TRUE if we are parsing a type-id in an expression context. In
|
|
such a situation, both "type (expr)" and "type (type)" are valid
|
|
alternatives. */
|
|
bool in_type_id_in_expr_p;
|
|
|
|
/* TRUE if we are currently in a header file where declarations are
|
|
implicitly extern "C". */
|
|
bool implicit_extern_c;
|
|
|
|
/* TRUE if strings in expressions should be translated to the execution
|
|
character set. */
|
|
bool translate_strings_p;
|
|
|
|
/* TRUE if we are presently parsing the body of a function, but not
|
|
a local class. */
|
|
bool in_function_body;
|
|
|
|
/* Nonzero if we're processing a __transaction_atomic or
|
|
__transaction_relaxed statement. */
|
|
unsigned char in_transaction;
|
|
|
|
/* TRUE if we can auto-correct a colon to a scope operator. */
|
|
bool colon_corrects_to_scope_p;
|
|
|
|
/* TRUE if : doesn't start a class definition. Should be only used
|
|
together with type_definition_forbidden_message non-NULL, in
|
|
contexts where new types may not be defined, and the type list
|
|
is terminated by colon. */
|
|
bool colon_doesnt_start_class_def_p;
|
|
|
|
/* If non-NULL, then we are parsing a construct where new type
|
|
definitions are not permitted. The string stored here will be
|
|
issued as an error message if a type is defined. */
|
|
const char *type_definition_forbidden_message;
|
|
|
|
/* A stack used for member functions of local classes. The lists
|
|
contained in an individual entry can only be processed once the
|
|
outermost class being defined is complete. */
|
|
vec<cp_unparsed_functions_entry, va_gc> *unparsed_queues;
|
|
|
|
/* The number of classes whose definitions are currently in
|
|
progress. */
|
|
unsigned num_classes_being_defined;
|
|
|
|
/* The number of template parameter lists that apply directly to the
|
|
current declaration. */
|
|
unsigned num_template_parameter_lists;
|
|
|
|
/* When parsing #pragma omp declare simd, this is a pointer to a
|
|
helper data structure. */
|
|
cp_omp_declare_simd_data * GTY((skip)) omp_declare_simd;
|
|
|
|
/* When parsing Cilk Plus SIMD-enabled functions' vector attributes,
|
|
this is a pointer to a helper data structure. */
|
|
cp_omp_declare_simd_data * GTY((skip)) cilk_simd_fn_info;
|
|
|
|
/* When parsing #pragma acc routine, this is a pointer to a helper data
|
|
structure. */
|
|
cp_oacc_routine_data * GTY((skip)) oacc_routine;
|
|
|
|
/* Nonzero if parsing a parameter list where 'auto' should trigger an implicit
|
|
template parameter. */
|
|
bool auto_is_implicit_function_template_parm_p;
|
|
|
|
/* TRUE if the function being declared was made a template due to its
|
|
parameter list containing generic type specifiers (`auto' or concept
|
|
identifiers) rather than an explicit template parameter list. */
|
|
bool fully_implicit_function_template_p;
|
|
|
|
/* Tracks the function's template parameter list when declaring a function
|
|
using generic type parameters. This is either a new chain in the case of a
|
|
fully implicit function template or an extension of the function's existing
|
|
template parameter list. This is tracked to optimize calls subsequent
|
|
calls to synthesize_implicit_template_parm during
|
|
cp_parser_parameter_declaration. */
|
|
tree implicit_template_parms;
|
|
|
|
/* The scope into which an implicit template parameter list has been
|
|
introduced or an existing template parameter list is being extended with
|
|
implicit template parameters. In most cases this is the sk_function_parms
|
|
scope containing the use of a generic type. In the case of an out-of-line
|
|
member definition using a generic type, it is the sk_class scope. */
|
|
cp_binding_level* implicit_template_scope;
|
|
|
|
/* True if parsing a result type in a compound requirement. This permits
|
|
constrained-type-specifiers inside what would normally be a trailing
|
|
return type. */
|
|
bool in_result_type_constraint_p;
|
|
|
|
/* True if a constrained-type-specifier is not allowed in this
|
|
context e.g., because they could never be deduced. */
|
|
int prevent_constrained_type_specifiers;
|
|
|
|
/* Location of the string-literal token within the current linkage
|
|
specification, if any, or UNKNOWN_LOCATION otherwise. */
|
|
location_t innermost_linkage_specification_location;
|
|
|
|
};
|
|
|
|
/* In parser.c */
|
|
extern void debug (cp_token &ref);
|
|
extern void debug (cp_token *ptr);
|
|
extern void cp_lexer_debug_tokens (vec<cp_token, va_gc> *);
|
|
extern void debug (vec<cp_token, va_gc> &ref);
|
|
extern void debug (vec<cp_token, va_gc> *ptr);
|
|
extern void cp_debug_parser (FILE *, cp_parser *);
|
|
extern void debug (cp_parser &ref);
|
|
extern void debug (cp_parser *ptr);
|
|
extern bool cp_keyword_starts_decl_specifier_p (enum rid keyword);
|
|
|
|
#endif /* GCC_CP_PARSER_H */
|