This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [libcc1] add support for C++
Here are the incremental changes that, together, address all of your
feedback (thanks!), but separated in logically-related patches. In a
separate message, I'll post an updated, consolidated patch.
Rename ansi_*opname; export cp_literal_operator_id
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index 024519d..561b26b 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -4332,7 +4332,7 @@ build_op_call_1 (tree obj, vec<tree, va_gc> **args, tsubst_flags_t complain)
if (TYPE_BINFO (type))
{
- fns = lookup_fnfields (TYPE_BINFO (type), ansi_opname (CALL_EXPR), 1);
+ fns = lookup_fnfields (TYPE_BINFO (type), cp_operator_id (CALL_EXPR), 1);
if (fns == error_mark_node)
return error_mark_node;
}
@@ -5039,7 +5039,7 @@ build_conditional_expr_1 (location_t loc, tree arg1, tree arg2, tree arg3,
add_builtin_candidates (&candidates,
COND_EXPR,
NOP_EXPR,
- ansi_opname (COND_EXPR),
+ cp_operator_id (COND_EXPR),
args,
LOOKUP_NORMAL, complain);
@@ -5455,10 +5455,10 @@ build_new_op_1 (location_t loc, enum tree_code code, int flags, tree arg1,
{
code2 = TREE_CODE (arg3);
arg3 = NULL_TREE;
- fnname = ansi_assopname (code2);
+ fnname = cp_assignment_operator_id (code2);
}
else
- fnname = ansi_opname (code);
+ fnname = cp_operator_id (code);
arg1 = prep_operand (arg1);
@@ -6009,7 +6009,7 @@ build_op_delete_call (enum tree_code code, tree addr, tree size,
type = strip_array_types (TREE_TYPE (TREE_TYPE (addr)));
- fnname = ansi_opname (code);
+ fnname = cp_operator_id (code);
if (CLASS_TYPE_P (type)
&& COMPLETE_TYPE_P (complete_type (type))
@@ -8072,7 +8072,7 @@ build_special_member_call (tree instance, tree name, vec<tree, va_gc> **args,
|| name == complete_dtor_identifier
|| name == base_dtor_identifier
|| name == deleting_dtor_identifier
- || name == ansi_assopname (NOP_EXPR));
+ || name == cp_assignment_operator_id (NOP_EXPR));
if (TYPE_P (binfo))
{
/* Resolve the name. */
@@ -8100,7 +8100,7 @@ build_special_member_call (tree instance, tree name, vec<tree, va_gc> **args,
if (!same_type_ignoring_top_level_qualifiers_p
(TREE_TYPE (instance), BINFO_TYPE (binfo)))
{
- if (name != ansi_assopname (NOP_EXPR))
+ if (name != cp_assignment_operator_id (NOP_EXPR))
/* For constructors and destructors, either the base is
non-virtual, or it is virtual but we are doing the
conversion from a constructor or destructor for the
diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index a4f3c6b..7a9e5dd 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -3217,7 +3217,7 @@ static tree
dfs_declare_virt_assop_and_dtor (tree binfo, void *data)
{
tree bv, fn, t = (tree)data;
- tree opname = ansi_assopname (NOP_EXPR);
+ tree opname = cp_assignment_operator_id (NOP_EXPR);
gcc_assert (t && CLASS_TYPE_P (t));
gcc_assert (binfo && TREE_CODE (binfo) == TREE_BINFO);
@@ -5288,7 +5288,7 @@ vbase_has_user_provided_move_assign (tree type)
{
/* Does the type itself have a user-provided move assignment operator? */
for (tree fns
- = lookup_fnfields_slot_nolazy (type, ansi_assopname (NOP_EXPR));
+ = lookup_fnfields_slot_nolazy (type, cp_assignment_operator_id (NOP_EXPR));
fns; fns = OVL_NEXT (fns))
{
tree fn = OVL_CURRENT (fns);
@@ -5452,7 +5452,7 @@ type_has_move_assign (tree t)
lazily_declare_fn (sfk_move_assignment, t);
}
- for (fns = lookup_fnfields_slot_nolazy (t, ansi_assopname (NOP_EXPR));
+ for (fns = lookup_fnfields_slot_nolazy (t, cp_assignment_operator_id (NOP_EXPR));
fns; fns = OVL_NEXT (fns))
if (move_fn_p (OVL_CURRENT (fns)))
return true;
@@ -5497,7 +5497,7 @@ type_has_user_declared_move_assign (tree t)
if (CLASSTYPE_LAZY_MOVE_ASSIGN (t))
return false;
- for (fns = lookup_fnfields_slot_nolazy (t, ansi_assopname (NOP_EXPR));
+ for (fns = lookup_fnfields_slot_nolazy (t, cp_assignment_operator_id (NOP_EXPR));
fns; fns = OVL_NEXT (fns))
{
tree fn = OVL_CURRENT (fns);
@@ -5618,7 +5618,7 @@ type_requires_array_cookie (tree type)
the array to the deallocation function, so we will need to store
a cookie. */
fns = lookup_fnfields (TYPE_BINFO (type),
- ansi_opname (VEC_DELETE_EXPR),
+ cp_operator_id (VEC_DELETE_EXPR),
/*protect=*/0);
/* If there are no `operator []' members, or the lookup is
ambiguous, then we don't need a cookie. */
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index ff871b5..4f4d57f 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -1531,16 +1531,17 @@ struct GTY(()) language_function {
/* True if NAME is the IDENTIFIER_NODE for an overloaded "operator
new" or "operator delete". */
#define NEW_DELETE_OPNAME_P(NAME) \
- ((NAME) == ansi_opname (NEW_EXPR) \
- || (NAME) == ansi_opname (VEC_NEW_EXPR) \
- || (NAME) == ansi_opname (DELETE_EXPR) \
- || (NAME) == ansi_opname (VEC_DELETE_EXPR))
+ ((NAME) == cp_operator_id (NEW_EXPR) \
+ || (NAME) == cp_operator_id (VEC_NEW_EXPR) \
+ || (NAME) == cp_operator_id (DELETE_EXPR) \
+ || (NAME) == cp_operator_id (VEC_DELETE_EXPR))
-#define ansi_opname(CODE) \
+#define cp_operator_id(CODE) \
(operator_name_info[(int) (CODE)].identifier)
-#define ansi_assopname(CODE) \
+#define cp_assignment_operator_id(CODE) \
(assignment_operator_name_info[(int) (CODE)].identifier)
-extern tree ansi_litopname(const char *);
+/* In parser.c. */
+extern tree cp_literal_operator_id (const char *);
/* TRUE if a tree code represents a statement. */
extern bool statement_code_p[MAX_TREE_CODES];
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 43cf3df..9cae747 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -4476,7 +4476,7 @@ static tree
push_cp_library_fn (enum tree_code operator_code, tree type,
int ecf_flags)
{
- tree fn = build_cp_library_fn (ansi_opname (operator_code),
+ tree fn = build_cp_library_fn (cp_operator_id (operator_code),
operator_code,
type, ecf_flags);
pushdecl (fn);
@@ -12158,12 +12158,12 @@ grok_op_properties (tree decl, bool complain)
do
{
#define DEF_OPERATOR(NAME, CODE, MANGLING, ARITY, ASSN_P) \
- if (ansi_opname (CODE) == name) \
+ if (cp_operator_id (CODE) == name) \
{ \
operator_code = (CODE); \
break; \
} \
- else if (ansi_assopname (CODE) == name) \
+ else if (cp_assignment_operator_id (CODE) == name) \
{ \
operator_code = (CODE); \
DECL_ASSIGNMENT_OPERATOR_P (decl) = 1; \
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index 2ba5ffb..63383bd 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -4483,7 +4483,7 @@ maybe_warn_sized_delete (enum tree_code code)
tree sized = NULL_TREE;
tree unsized = NULL_TREE;
- for (tree ovl = IDENTIFIER_GLOBAL_VALUE (ansi_opname (code));
+ for (tree ovl = IDENTIFIER_GLOBAL_VALUE (cp_operator_id (code));
ovl; ovl = OVL_NEXT (ovl))
{
tree fn = OVL_CURRENT (ovl);
diff --git a/gcc/cp/init.c b/gcc/cp/init.c
index 1a5766a4..a5f317a 100644
--- a/gcc/cp/init.c
+++ b/gcc/cp/init.c
@@ -2906,7 +2906,7 @@ build_new_1 (vec<tree, va_gc> **placement, tree type, tree nelts,
tree fnname;
tree fns;
- fnname = ansi_opname (array_p ? VEC_NEW_EXPR : NEW_EXPR);
+ fnname = cp_operator_id (array_p ? VEC_NEW_EXPR : NEW_EXPR);
member_new_p = !globally_qualified_p
&& CLASS_TYPE_P (elt_type)
diff --git a/gcc/cp/lambda.c b/gcc/cp/lambda.c
index d511185..9058e81 100644
--- a/gcc/cp/lambda.c
+++ b/gcc/cp/lambda.c
@@ -202,7 +202,7 @@ lambda_function (tree lambda)
if (CLASSTYPE_TEMPLATE_INSTANTIATION (type)
&& !COMPLETE_OR_OPEN_TYPE_P (type))
return NULL_TREE;
- lambda = lookup_member (type, ansi_opname (CALL_EXPR),
+ lambda = lookup_member (type, cp_operator_id (CALL_EXPR),
/*protect=*/0, /*want_type=*/false,
tf_warning_or_error);
if (lambda)
diff --git a/gcc/cp/lex.c b/gcc/cp/lex.c
index 43827e5..696b434 100644
--- a/gcc/cp/lex.c
+++ b/gcc/cp/lex.c
@@ -450,7 +450,7 @@ unqualified_name_lookup_error (tree name, location_t loc)
if (IDENTIFIER_OPNAME_P (name))
{
- if (name != ansi_opname (ERROR_MARK))
+ if (name != cp_operator_id (ERROR_MARK))
error_at (loc, "%qD not defined", name);
}
else
diff --git a/gcc/cp/method.c b/gcc/cp/method.c
index 01aa249..bc9bebe 100644
--- a/gcc/cp/method.c
+++ b/gcc/cp/method.c
@@ -697,7 +697,7 @@ do_build_copy_assign (tree fndecl)
parmvec = make_tree_vector_single (converted_parm);
finish_expr_stmt
(build_special_member_call (current_class_ref,
- ansi_assopname (NOP_EXPR),
+ cp_assignment_operator_id (NOP_EXPR),
&parmvec,
base_binfo,
flags,
@@ -990,7 +990,7 @@ get_copy_assign (tree type)
int quals = (TYPE_HAS_CONST_COPY_ASSIGN (type)
? TYPE_QUAL_CONST : TYPE_UNQUALIFIED);
tree argtype = build_stub_type (type, quals, false);
- tree fn = locate_fn_flags (type, ansi_assopname (NOP_EXPR), argtype,
+ tree fn = locate_fn_flags (type, cp_assignment_operator_id (NOP_EXPR), argtype,
LOOKUP_NORMAL, tf_warning_or_error);
if (fn == error_mark_node)
return NULL_TREE;
@@ -1369,7 +1369,7 @@ synthesized_method_walk (tree ctype, special_function_kind sfk, bool const_p,
case sfk_move_assignment:
case sfk_copy_assignment:
assign_p = true;
- fnname = ansi_assopname (NOP_EXPR);
+ fnname = cp_assignment_operator_id (NOP_EXPR);
break;
case sfk_destructor:
@@ -1516,7 +1516,7 @@ synthesized_method_walk (tree ctype, special_function_kind sfk, bool const_p,
if (check_vdtor && type_has_virtual_destructor (basetype))
{
- rval = locate_fn_flags (ctype, ansi_opname (DELETE_EXPR),
+ rval = locate_fn_flags (ctype, cp_operator_id (DELETE_EXPR),
ptr_type_node, flags, complain);
/* Unlike for base ctor/op=/dtor, for operator delete it's fine
to have a null rval (no class-specific op delete). */
@@ -1802,7 +1802,7 @@ implicitly_declare_fn (special_function_kind kind, tree type,
|| kind == sfk_move_assignment)
{
return_type = build_reference_type (type);
- name = ansi_assopname (NOP_EXPR);
+ name = cp_assignment_operator_id (NOP_EXPR);
}
else
name = constructor_name (type);
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 6b37054..b4894ef 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -248,9 +248,6 @@ static cp_token_cache *cp_token_cache_new
static void cp_parser_initial_pragma
(cp_token *);
-static tree cp_literal_operator_id
- (const char *);
-
static void cp_parser_cilk_simd
(cp_parser *, cp_token *, bool *);
static tree cp_parser_cilk_for
@@ -10171,7 +10168,7 @@ cp_parser_lambda_declarator_opt (cp_parser* parser, tree lambda_expr)
p = obstack_alloc (&declarator_obstack, 0);
- declarator = make_id_declarator (NULL_TREE, ansi_opname (CALL_EXPR),
+ declarator = make_id_declarator (NULL_TREE, cp_operator_id (CALL_EXPR),
sfk_none);
quals = (LAMBDA_EXPR_MUTABLE_P (lambda_expr)
@@ -13857,7 +13854,7 @@ cp_parser_operator_function_id (cp_parser* parser)
/* Return an identifier node for a user-defined literal operator.
The suffix identifier is chained to the operator name identifier. */
-static tree
+tree
cp_literal_operator_id (const char* name)
{
tree identifier;
@@ -13869,14 +13866,6 @@ cp_literal_operator_id (const char* name)
return identifier;
}
-/* Exported wrapper for cp_literal_operator_id. */
-
-tree
-ansi_litopname (const char *name)
-{
- return cp_literal_operator_id (name);
-}
-
/* Parse an operator.
operator:
@@ -13934,12 +13923,12 @@ cp_parser_operator (cp_parser* parser)
if (cp_token *close_token
= cp_parser_require (parser, CPP_CLOSE_SQUARE, RT_CLOSE_SQUARE))
end_loc = close_token->location;
- id = ansi_opname (op == NEW_EXPR
+ id = cp_operator_id (op == NEW_EXPR
? VEC_NEW_EXPR : VEC_DELETE_EXPR);
}
/* Otherwise, we have the non-array variant. */
else
- id = ansi_opname (op);
+ id = cp_operator_id (op);
location_t loc = make_location (start_loc, start_loc, end_loc);
@@ -13947,147 +13936,147 @@ cp_parser_operator (cp_parser* parser)
}
case CPP_PLUS:
- id = ansi_opname (PLUS_EXPR);
+ id = cp_operator_id (PLUS_EXPR);
break;
case CPP_MINUS:
- id = ansi_opname (MINUS_EXPR);
+ id = cp_operator_id (MINUS_EXPR);
break;
case CPP_MULT:
- id = ansi_opname (MULT_EXPR);
+ id = cp_operator_id (MULT_EXPR);
break;
case CPP_DIV:
- id = ansi_opname (TRUNC_DIV_EXPR);
+ id = cp_operator_id (TRUNC_DIV_EXPR);
break;
case CPP_MOD:
- id = ansi_opname (TRUNC_MOD_EXPR);
+ id = cp_operator_id (TRUNC_MOD_EXPR);
break;
case CPP_XOR:
- id = ansi_opname (BIT_XOR_EXPR);
+ id = cp_operator_id (BIT_XOR_EXPR);
break;
case CPP_AND:
- id = ansi_opname (BIT_AND_EXPR);
+ id = cp_operator_id (BIT_AND_EXPR);
break;
case CPP_OR:
- id = ansi_opname (BIT_IOR_EXPR);
+ id = cp_operator_id (BIT_IOR_EXPR);
break;
case CPP_COMPL:
- id = ansi_opname (BIT_NOT_EXPR);
+ id = cp_operator_id (BIT_NOT_EXPR);
break;
case CPP_NOT:
- id = ansi_opname (TRUTH_NOT_EXPR);
+ id = cp_operator_id (TRUTH_NOT_EXPR);
break;
case CPP_EQ:
- id = ansi_assopname (NOP_EXPR);
+ id = cp_assignment_operator_id (NOP_EXPR);
break;
case CPP_LESS:
- id = ansi_opname (LT_EXPR);
+ id = cp_operator_id (LT_EXPR);
break;
case CPP_GREATER:
- id = ansi_opname (GT_EXPR);
+ id = cp_operator_id (GT_EXPR);
break;
case CPP_PLUS_EQ:
- id = ansi_assopname (PLUS_EXPR);
+ id = cp_assignment_operator_id (PLUS_EXPR);
break;
case CPP_MINUS_EQ:
- id = ansi_assopname (MINUS_EXPR);
+ id = cp_assignment_operator_id (MINUS_EXPR);
break;
case CPP_MULT_EQ:
- id = ansi_assopname (MULT_EXPR);
+ id = cp_assignment_operator_id (MULT_EXPR);
break;
case CPP_DIV_EQ:
- id = ansi_assopname (TRUNC_DIV_EXPR);
+ id = cp_assignment_operator_id (TRUNC_DIV_EXPR);
break;
case CPP_MOD_EQ:
- id = ansi_assopname (TRUNC_MOD_EXPR);
+ id = cp_assignment_operator_id (TRUNC_MOD_EXPR);
break;
case CPP_XOR_EQ:
- id = ansi_assopname (BIT_XOR_EXPR);
+ id = cp_assignment_operator_id (BIT_XOR_EXPR);
break;
case CPP_AND_EQ:
- id = ansi_assopname (BIT_AND_EXPR);
+ id = cp_assignment_operator_id (BIT_AND_EXPR);
break;
case CPP_OR_EQ:
- id = ansi_assopname (BIT_IOR_EXPR);
+ id = cp_assignment_operator_id (BIT_IOR_EXPR);
break;
case CPP_LSHIFT:
- id = ansi_opname (LSHIFT_EXPR);
+ id = cp_operator_id (LSHIFT_EXPR);
break;
case CPP_RSHIFT:
- id = ansi_opname (RSHIFT_EXPR);
+ id = cp_operator_id (RSHIFT_EXPR);
break;
case CPP_LSHIFT_EQ:
- id = ansi_assopname (LSHIFT_EXPR);
+ id = cp_assignment_operator_id (LSHIFT_EXPR);
break;
case CPP_RSHIFT_EQ:
- id = ansi_assopname (RSHIFT_EXPR);
+ id = cp_assignment_operator_id (RSHIFT_EXPR);
break;
case CPP_EQ_EQ:
- id = ansi_opname (EQ_EXPR);
+ id = cp_operator_id (EQ_EXPR);
break;
case CPP_NOT_EQ:
- id = ansi_opname (NE_EXPR);
+ id = cp_operator_id (NE_EXPR);
break;
case CPP_LESS_EQ:
- id = ansi_opname (LE_EXPR);
+ id = cp_operator_id (LE_EXPR);
break;
case CPP_GREATER_EQ:
- id = ansi_opname (GE_EXPR);
+ id = cp_operator_id (GE_EXPR);
break;
case CPP_AND_AND:
- id = ansi_opname (TRUTH_ANDIF_EXPR);
+ id = cp_operator_id (TRUTH_ANDIF_EXPR);
break;
case CPP_OR_OR:
- id = ansi_opname (TRUTH_ORIF_EXPR);
+ id = cp_operator_id (TRUTH_ORIF_EXPR);
break;
case CPP_PLUS_PLUS:
- id = ansi_opname (POSTINCREMENT_EXPR);
+ id = cp_operator_id (POSTINCREMENT_EXPR);
break;
case CPP_MINUS_MINUS:
- id = ansi_opname (PREDECREMENT_EXPR);
+ id = cp_operator_id (PREDECREMENT_EXPR);
break;
case CPP_COMMA:
- id = ansi_opname (COMPOUND_EXPR);
+ id = cp_operator_id (COMPOUND_EXPR);
break;
case CPP_DEREF_STAR:
- id = ansi_opname (MEMBER_REF);
+ id = cp_operator_id (MEMBER_REF);
break;
case CPP_DEREF:
- id = ansi_opname (COMPONENT_REF);
+ id = cp_operator_id (COMPONENT_REF);
break;
case CPP_OPEN_PAREN:
@@ -14095,14 +14084,14 @@ cp_parser_operator (cp_parser* parser)
cp_lexer_consume_token (parser->lexer);
/* Look for the matching `)'. */
cp_parser_require (parser, CPP_CLOSE_PAREN, RT_CLOSE_PAREN);
- return ansi_opname (CALL_EXPR);
+ return cp_operator_id (CALL_EXPR);
case CPP_OPEN_SQUARE:
/* Consume the `['. */
cp_lexer_consume_token (parser->lexer);
/* Look for the matching `]'. */
cp_parser_require (parser, CPP_CLOSE_SQUARE, RT_CLOSE_SQUARE);
- return ansi_opname (ARRAY_REF);
+ return cp_operator_id (ARRAY_REF);
case CPP_UTF8STRING:
case CPP_UTF8STRING_USERDEF:
@@ -31327,21 +31316,21 @@ cp_parser_omp_clause_reduction (cp_parser *parser, tree list)
code = MIN_EXPR;
else if (strcmp (p, "max") == 0)
code = MAX_EXPR;
- else if (id == ansi_opname (PLUS_EXPR))
+ else if (id == cp_operator_id (PLUS_EXPR))
code = PLUS_EXPR;
- else if (id == ansi_opname (MULT_EXPR))
+ else if (id == cp_operator_id (MULT_EXPR))
code = MULT_EXPR;
- else if (id == ansi_opname (MINUS_EXPR))
+ else if (id == cp_operator_id (MINUS_EXPR))
code = MINUS_EXPR;
- else if (id == ansi_opname (BIT_AND_EXPR))
+ else if (id == cp_operator_id (BIT_AND_EXPR))
code = BIT_AND_EXPR;
- else if (id == ansi_opname (BIT_IOR_EXPR))
+ else if (id == cp_operator_id (BIT_IOR_EXPR))
code = BIT_IOR_EXPR;
- else if (id == ansi_opname (BIT_XOR_EXPR))
+ else if (id == cp_operator_id (BIT_XOR_EXPR))
code = BIT_XOR_EXPR;
- else if (id == ansi_opname (TRUTH_ANDIF_EXPR))
+ else if (id == cp_operator_id (TRUTH_ANDIF_EXPR))
code = TRUTH_ANDIF_EXPR;
- else if (id == ansi_opname (TRUTH_ORIF_EXPR))
+ else if (id == cp_operator_id (TRUTH_ORIF_EXPR))
code = TRUTH_ORIF_EXPR;
id = omp_reduction_id (code, id, NULL_TREE);
tree scope = parser->scope;
diff --git a/gcc/cp/search.c b/gcc/cp/search.c
index 2b26df4..877015e 100644
--- a/gcc/cp/search.c
+++ b/gcc/cp/search.c
@@ -1667,7 +1667,7 @@ lookup_fnfields_1 (tree type, tree name)
if (CLASSTYPE_LAZY_MOVE_CTOR (type))
lazily_declare_fn (sfk_move_constructor, type);
}
- else if (name == ansi_assopname (NOP_EXPR))
+ else if (name == cp_assignment_operator_id (NOP_EXPR))
{
if (CLASSTYPE_LAZY_COPY_ASSIGN (type))
lazily_declare_fn (sfk_copy_assignment, type);
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index 66c4187..3ea7a568 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -5095,7 +5095,7 @@ omp_reduction_id (enum tree_code reduction_code, tree reduction_id, tree type)
case BIT_IOR_EXPR:
case TRUTH_ANDIF_EXPR:
case TRUTH_ORIF_EXPR:
- reduction_id = ansi_opname (reduction_code);
+ reduction_id = cp_operator_id (reduction_code);
break;
case MIN_EXPR:
p = "min";
@@ -8984,7 +8984,7 @@ classtype_has_nothrow_assign_or_copy_p (tree type, bool assign_p)
if (assign_p)
{
int ix;
- ix = lookup_fnfields_1 (type, ansi_assopname (NOP_EXPR));
+ ix = lookup_fnfields_1 (type, cp_assignment_operator_id (NOP_EXPR));
if (ix < 0)
return false;
fns = (*CLASSTYPE_METHOD_VEC (type))[ix];
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index a591d29..7524989 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -8784,7 +8784,7 @@ check_return_expr (tree retval, bool *no_warning)
/* Effective C++ rule 15. See also start_function. */
if (warn_ecpp
- && DECL_NAME (current_function_decl) == ansi_assopname(NOP_EXPR))
+ && DECL_NAME (current_function_decl) == cp_assignment_operator_id (NOP_EXPR))
{
bool warn = true;
diff --git a/libcc1/libcp1plugin.cc b/libcc1/libcp1plugin.cc
index 0be8190..5059e1c 100644
--- a/libcc1/libcp1plugin.cc
+++ b/libcc1/libcp1plugin.cc
@@ -1,5 +1,5 @@
/* Library interface to C++ front end.
- Copyright (C) 2014-2016 Free Software Foundation, Inc.
+ Copyright (C) 2014-2017 Free Software Foundation, Inc.
This file is part of GCC. As it interacts with GDB through libcc1,
they all become a single program as regards the GNU GPL's requirements.
@@ -1355,7 +1355,7 @@ plugin_new_decl (cc1_plugin::connection *self,
id = xstrndup (id, len);
freeid = true;
}
- identifier = ansi_litopname (id);
+ identifier = cp_literal_operator_id (id);
if (freeid)
free (id);
}
@@ -1368,9 +1368,9 @@ plugin_new_decl (cc1_plugin::connection *self,
if (opcode != ERROR_MARK)
{
if (assop)
- identifier = ansi_assopname (opcode);
+ identifier = cp_assignment_operator_id (opcode);
else
- identifier = ansi_opname (opcode);
+ identifier = cp_operator_id (opcode);
}
}
decl = build_lang_decl_loc (loc, code, identifier, sym_type);
@@ -2645,7 +2645,7 @@ plugin_new_dependent_value_expr (cc1_plugin::connection *self,
id = xstrndup (id, len);
freeid = true;
}
- identifier = ansi_litopname (id);
+ identifier = cp_literal_operator_id (id);
if (freeid)
free (id);
}
@@ -2660,9 +2660,9 @@ plugin_new_dependent_value_expr (cc1_plugin::connection *self,
if (opcode != ERROR_MARK)
{
if (assop)
- identifier = ansi_assopname (opcode);
+ identifier = cp_assignment_operator_id (opcode);
else
- identifier = ansi_opname (opcode);
+ identifier = cp_operator_id (opcode);
}
gcc_assert (identifier);
Revamp global friend implementation
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index ff871b5..0415f30 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -5953,8 +5953,8 @@ extern int is_friend (tree, tree);
extern void make_friend_class (tree, tree, bool);
extern void add_friend (tree, tree, bool);
extern tree do_friend (tree, tree, tree, tree, enum overload_flags, bool);
-extern void add_to_global_friend_list (tree);
-extern void remove_from_global_friend_list (tree);
+
+extern void set_global_friend (tree);
extern bool is_global_friend (tree);
/* in init.c */
diff --git a/gcc/cp/friend.c b/gcc/cp/friend.c
index 365b1ca..3ce6fab 100644
--- a/gcc/cp/friend.c
+++ b/gcc/cp/friend.c
@@ -25,63 +25,43 @@ along with GCC; see the file COPYING3. If not see
/* Friend data structures are described in cp-tree.h. */
-/* Scopes (functions, classes, or templates) in the TREE_VALUE of
- GLOBAL_FRIEND_LIST are regarded as friends of every class. This is
- mainly used by libcc1, to enable GDB's code snippets to access
- private members without disabling access control in general, which
- could cause different template overload resolution results when
- accessibility matters (e.g. tests for an accessible member). */
+/* The GLOBAL_FRIEND scope (functions, classes, or templates) is
+ regarded as a friend of every class. This is only used by libcc1,
+ to enable GDB's code snippets to access private members without
+ disabling access control in general, which could cause different
+ template overload resolution results when accessibility matters
+ (e.g. tests for an accessible member). */
-static tree global_friend_list;
+static tree global_friend;
-/* Add SCOPE to GLOBAL_FRIEND_LIST. The same scope may be added
- multiple times, so that matching removals cancel out. */
+/* Set the GLOBAL_FRIEND for this compilation session. It might be
+ set multiple times, but always to the same scope. */
void
-add_to_global_friend_list (tree scope)
+set_global_friend (tree scope)
{
- global_friend_list = tree_cons (NULL_TREE, scope, global_friend_list);
+ gcc_checking_assert (scope != NULL_TREE);
+ gcc_assert (!global_friend || global_friend == scope);
+ global_friend = scope;
}
-/* Search for SCOPE in the global friend list, and return a pointer to
- the first tree cons that matches. The pointer can be used to
- modify the list.
+/* Return TRUE if SCOPE is the global friend. */
- A match means the TREE_VALUE is SCOPE or, if an EXACT match is not
- required, a template that has SCOPE as a specialization. */
-
-static inline tree *
-find_in_global_friend_list (tree scope, bool exact)
-{
- for (tree *p = &global_friend_list;
- *p; p = &TREE_CHAIN (*p))
- if (TREE_VALUE (*p) == scope
- || (!exact
- && is_specialization_of_friend (TREE_VALUE (*p), scope)))
- return p;
-
- return NULL;
-}
-
-/* Remove one occurrence of SCOPE from the global friend list.
- There must be at least one such occurrence. */
-
-void
-remove_from_global_friend_list (tree scope)
+bool
+is_global_friend (tree scope)
{
- tree *p = find_in_global_friend_list (scope, true);
+ gcc_checking_assert (scope != NULL_TREE);
- gcc_assert (p);
+ if (global_friend == scope)
+ return true;
- *p = TREE_CHAIN (*p);
-}
+ if (!global_friend)
+ return false;
-/* Return TRUE if SCOPE is in the global friend list. */
+ if (is_specialization_of_friend (global_friend, scope))
+ return true;
-bool
-is_global_friend (tree scope)
-{
- return !!find_in_global_friend_list (scope, false);
+ return false;
}
/* Returns nonzero if SUPPLICANT is a friend of TYPE. */
diff --git a/libcc1/libcp1plugin.cc b/libcc1/libcp1plugin.cc
index 0be8190..e7d397f 100644
--- a/libcc1/libcp1plugin.cc
+++ b/libcc1/libcp1plugin.cc
@@ -567,7 +567,7 @@ plugin_pragma_push_user_expression (cpp_reader *)
/* Make the function containing the user expression a global
friend, so as to bypass access controls in it. */
if (at_function_scope_p ())
- add_to_global_friend_list (current_function_decl);
+ set_global_friend (current_function_decl);
gcc_assert (at_function_scope_p ());
function *save_cfun = cfun;
Revamp the API:
Rename most entry points into a self-consistent scheme.
Unify oracle lookup kinds. (bonus feature! :-)
Drop INLINE_P from using_namespace, introduce make_namespace_inline.
Drop support for function default args (#if0ed).
Drop dead code in plugin_add_using_decl.
Drop label handling in build_decl.
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index ff871b5..35f74ef 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -6857,9 +6857,7 @@ extern tree strip_using_decl (tree);
enum cp_oracle_request
{
- CP_ORACLE_SYMBOL,
- CP_ORACLE_TAG,
- CP_ORACLE_LABEL
+ CP_ORACLE_IDENTIFIER
};
/* If this is non-NULL, then it is a "binding oracle" which can lazily
diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c
index 600540c..1f1c9e7 100644
--- a/gcc/cp/name-lookup.c
+++ b/gcc/cp/name-lookup.c
@@ -98,15 +98,16 @@ cp_binding_oracle_function *cp_binding_oracle;
static inline void
query_oracle (tree name)
{
- // FIXME: we need a more space-efficient representation for
- // oracle_looked_up.
- if (cp_binding_oracle && !LANG_IDENTIFIER_CAST (name)->oracle_looked_up)
- {
- LANG_IDENTIFIER_CAST (name)->oracle_looked_up = true;
- // FIXME: unify CP_ORACLE_SYMBOL and CP_ORACLE_TAG for C++.
- cp_binding_oracle (CP_ORACLE_SYMBOL, name);
- cp_binding_oracle (CP_ORACLE_TAG, name);
- }
+ if (!cp_binding_oracle)
+ return;
+
+ /* LOOKED_UP holds the set of identifiers that we have already
+ looked up with the oracle. */
+ static hash_set<tree> looked_up;
+ if (looked_up.add (name))
+ return;
+
+ cp_binding_oracle (CP_ORACLE_IDENTIFIER, name);
}
/* Create a binding_entry object for (NAME, TYPE). */
diff --git a/include/gcc-cp-fe.def b/include/gcc-cp-fe.def
index 7fcd484..f6d0a41 100644
--- a/include/gcc-cp-fe.def
+++ b/include/gcc-cp-fe.def
@@ -1,6 +1,6 @@
/* Interface between GCC C++ FE and GDB -*- c -*-
- Copyright (C) 2014-2016 Free Software Foundation, Inc.
+ Copyright (C) 2014-2017 Free Software Foundation, Inc.
This file is part of GCC.
@@ -25,11 +25,8 @@
namespace. A namespace named NAME is created in the current scope,
if needed.
- If the newly-created namespace is to be an inline namespace, after
- push_namespace, get the nested namespace decl with
- get_current_binding_level, pop back to the enclosing namespace,
- call using_namespace with INLINE_P, and then push to the inline
- namespace again. */
+ If the newly-created namespace is to be an inline namespace, see
+ make_namespace_inline. */
GCC_METHOD1 (int /* bool */, push_namespace,
const char *) /* Argument NAME. */
@@ -151,8 +148,8 @@ GCC_METHOD1 (int /* bool */, push_function,
scope will have to be reentered in order to define the class.
. If the code snippet is at point 2, we don't need to (re)activate
- anything declaration: nothing from any local scope is visible.
- Just entering the scope of the class containing member function f
+ any declaration: nothing from any local scope is visible. Just
+ entering the scope of the class containing member function f
reactivates the names of its members, including the class name
itself. */
@@ -165,22 +162,26 @@ GCC_METHOD2 (int /* bool */, reactivate_decl,
push_function, restoring the binding level in effect before the
matching push_* call. */
-GCC_METHOD0 (int /* bool */, pop_namespace)
+GCC_METHOD0 (int /* bool */, pop_binding_level)
/* Return the NAMESPACE_DECL, TYPE_DECL or FUNCTION_DECL of the
- binding level that would be popped by pop_namespace. */
+ binding level that would be popped by pop_scope. */
-GCC_METHOD0 (gcc_decl, get_current_binding_level)
+GCC_METHOD0 (gcc_decl, get_current_binding_level_decl)
+
+/* Make the current binding level an inline namespace. It must be a
+ namespace to begin with. It is safe to call this more than once
+ for the same namespace, but after the first call, subsequent ones
+ will not return a success status. */
+
+GCC_METHOD0 (int /* bool */, make_namespace_inline)
/* Add USED_NS to the namespaces used by the current binding level.
- Use get_current_binding_level to obtain USED_NS's gcc_decl.
- INLINE_P indicates USED_NS was declared as an inline namespace, or
- the presence of attribute strong in the using directive, which
- is an older but equivalent GCC extension. */
+ Use get_current_binding_level_decl to obtain USED_NS's
+ gcc_decl. */
-GCC_METHOD2 (int /* bool */, using_namespace,
- gcc_decl, /* Argument USED_NS. */
- int /* bool */) /* Argument INLINE_P. */
+GCC_METHOD1 (int /* bool */, add_using_namespace,
+ gcc_decl) /* Argument USED_NS. */
/* Introduce a namespace alias declaration, as in:
@@ -188,9 +189,9 @@ GCC_METHOD2 (int /* bool */, using_namespace,
After this call, namespace TARGET will be visible as ALIAS within
the current namespace. Get the declaration for TARGET by calling
- get_current_binding_level after pushing into it. */
+ get_current_binding_level_decl after pushing into it. */
-GCC_METHOD2 (int /* bool */, new_namespace_alias,
+GCC_METHOD2 (int /* bool */, add_namespace_alias,
const char *, /* Argument ALIAS. */
gcc_decl) /* Argument TARGET. */
@@ -209,9 +210,9 @@ GCC_METHOD2 (int /* bool */, new_namespace_alias,
Even when TARGET is template dependent, we don't need to specify
whether or not it is a typename: the supplied declaration (that
could be a template-dependent type converted to declaration by
- type_decl) indicates so. */
+ get_type_decl) indicates so. */
-GCC_METHOD2 (int /* bool */, new_using_decl,
+GCC_METHOD2 (int /* bool */, add_using_decl,
enum gcc_cp_symbol_kind, /* Argument FLAGS. */
gcc_decl) /* Argument TARGET. */
@@ -232,6 +233,9 @@ GCC_METHOD2 (int /* bool */, new_using_decl,
Use this function to register typedefs, functions and variables to
namespace and local binding levels, and typedefs, member functions
(static or not), and static data members to class binding levels.
+ Class members must have their access controls specified with
+ GCC_CP_ACCESS_* flags in SYM_KIND.
+
Note that, since access controls are disabled, we have no means to
express private, protected and public.
@@ -264,18 +268,18 @@ GCC_METHOD2 (int /* bool */, new_using_decl,
Constructors and destructors need special care, because for each
constructor and destructor there may be multiple clones defined
- internally by the compiler. With new_decl, you can introduce the
+ internally by the compiler. With build_decl, you can introduce the
base declaration of a constructor or a destructor, setting
GCC_CP_FLAG_SPECIAL_FUNCTION the flag and using names starting with
capital "C" or "D", respectively, followed by a digit (see below),
a blank, or NUL ('\0'). DO NOT supply an ADDRESS or a
- SUBSTITUTION_NAME to new_decl, it would be meaningless (and
+ SUBSTITUTION_NAME to build_decl, it would be meaningless (and
rejected) for the base declaration; use define_cdtor_clone to
introduce the address of each clone. For constructor templates,
- declare the template with new_decl, and then, for each
- specialization, introduce it with specialize_function_template, and
- then define the addresses of each of its clones with
- define_cdtor_clone.
+ declare the template with build_decl, and then, for each
+ specialization, introduce it with
+ build_function_template_specialization, and then define the
+ addresses of each of its clones with define_cdtor_clone.
NAMEs for GCC_CP_FLAG_SPECIAL_FUNCTION:
@@ -334,7 +338,7 @@ GCC_METHOD2 (int /* bool */, new_using_decl,
FIXME: How about attributes? */
-GCC_METHOD7 (gcc_decl, new_decl,
+GCC_METHOD7 (gcc_decl, build_decl,
const char *, /* Argument NAME. */
enum gcc_cp_symbol_kind, /* Argument SYM_KIND. */
gcc_type, /* Argument SYM_TYPE. */
@@ -344,8 +348,8 @@ GCC_METHOD7 (gcc_decl, new_decl,
unsigned int) /* Argument LINE_NUMBER. */
/* Supply the ADDRESS of one of the multiple clones of constructor or
- destructor CDTOR. The clone is selected using the following
- name mangling conventions:
+ destructor CDTOR. The clone is specified by NAME, using the
+ following name mangling conventions:
C1 in-charge constructor
C2 not-in-charge constructor
@@ -372,8 +376,8 @@ GCC_METHOD7 (gcc_decl, new_decl,
The [CD]4 manglings (and symbol definitions) are non-standard, but
GCC uses them in some cases: rather than assuming they are
in-charge or not-in-charge, they test the implicit argument that
- the others ignore to tell how to behave. These are defined in very
- rare cases of virtual inheritance and cdtor prototypes. */
+ the others ignore to tell how to behave. These are used instead of
+ cloning when we just can't use aliases. */
GCC_METHOD3 (gcc_decl, define_cdtor_clone,
const char *, /* Argument NAME. */
@@ -383,18 +387,18 @@ GCC_METHOD3 (gcc_decl, define_cdtor_clone,
/* Return the type associated with the given declaration. This is
most useful to obtain the type associated with a forward-declared
class, because it is the gcc_type, rather than the gcc_decl, that
- has to be used to build other types, but new_decl returns a
+ has to be used to build other types, but build_decl returns a
gcc_decl rather than a gcc_type. This call can in theory be used
to obtain the type from any other declaration; it is supposed to
return the same type that was supplied when the declaration was
created. */
-GCC_METHOD1 (gcc_type, decl_type,
+GCC_METHOD1 (gcc_type, get_decl_type,
gcc_decl) /* Argument DECL. */
/* Return the declaration for a type. */
-GCC_METHOD1 (gcc_decl, type_decl,
+GCC_METHOD1 (gcc_decl, get_type_decl,
gcc_type) /* Argument TYPE. */
/* Declare DECL as a friend of the current class scope, if TYPE is
@@ -437,11 +441,11 @@ GCC_METHOD1 (gcc_decl, type_decl,
In order to simplify such friend declarations, and to enable
incremental friend declarations as template specializations are
- introduced, new_friend can be called after the befriended class is
+ introduced, new_friend can be called after the befriending class is
fully defined, passing it a non-NULL TYPE argument naming the
- befriended class type. */
+ befriending class type. */
-GCC_METHOD2 (int /* bool */, new_friend,
+GCC_METHOD2 (int /* bool */, add_friend,
gcc_decl, /* Argument DECL. */
gcc_type) /* Argument TYPE. */
@@ -467,14 +471,14 @@ GCC_METHOD2 (gcc_type, build_pointer_to_member_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. */
+ build_type_template_parameter and build_value_template_parameter
+ calls create template parameters in the list. The list is closed
+ by a build_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 /* bool */, start_new_template_decl)
+GCC_METHOD0 (int /* bool */, start_template_decl)
/* Build a typename template-parameter (e.g., the T in template
<typename T = X>). Either PACK_P should be nonzero, to indicate an
@@ -484,7 +488,7 @@ GCC_METHOD0 (int /* bool */, start_new_template_decl)
parameter. FILENAME and LINE_NUMBER may specify the source
location in which the template parameter was declared. */
-GCC_METHOD5 (gcc_type, new_template_typename_parm,
+GCC_METHOD5 (gcc_type, build_type_template_parameter,
const char *, /* Argument ID. */
int /* bool */, /* Argument PACK_P. */
gcc_type, /* Argument DEFAULT_TYPE. */
@@ -497,7 +501,7 @@ GCC_METHOD5 (gcc_type, new_template_typename_parm,
template parameter. FILENAME and LINE_NUMBER may specify the
source location in which the template parameter was declared. */
-GCC_METHOD5 (gcc_utempl, new_template_template_parm,
+GCC_METHOD5 (gcc_utempl, build_template_template_parameter,
const char *, /* Argument ID. */
int /* bool */, /* Argument PACK_P. */
gcc_utempl, /* Argument DEFAULT_TEMPL. */
@@ -510,7 +514,7 @@ GCC_METHOD5 (gcc_utempl, new_template_template_parm,
X). FILENAME and LINE_NUMBER may specify the source location in
which the template parameter was declared. */
-GCC_METHOD5 (gcc_decl, new_template_value_parm,
+GCC_METHOD5 (gcc_decl, build_value_template_parameter,
gcc_type, /* Argument TYPE. */
const char *, /* Argument ID. */
gcc_expr, /* Argument DEFAULT_VALUE. */
@@ -525,13 +529,13 @@ GCC_METHOD5 (gcc_decl, new_template_value_parm,
(e.g. <X>) iff ID is to name a class template.
In this and other calls, a template-dependent nested name specifier
- may be a template class parameter (new_template_typename_parm), a
- specialization (returned by new_dependent_typespec) of a template
- template parameter (returned by new_template_template_parm) or a
- member type thereof (returned by new_dependent_typename
- itself). */
+ may be a template class parameter (build_type_template_parameter),
+ a specialization (returned by build_dependent_type_template_id) of
+ a template template parameter (returned by
+ build_template_template_parameter) or a member type thereof
+ (returned by build_dependent_typename itself). */
-GCC_METHOD3 (gcc_type, new_dependent_typename,
+GCC_METHOD3 (gcc_type, build_dependent_typename,
gcc_type, /* Argument ENCLOSING_TYPE. */
const char *, /* Argument ID. */
const struct gcc_cp_template_args *) /* Argument TARGS. */
@@ -541,21 +545,21 @@ GCC_METHOD3 (gcc_type, new_dependent_typename,
specifier (e.g., T), ID should be the name of the class template
member of the ENCLOSING_TYPE (e.g., bart). */
-GCC_METHOD2 (gcc_utempl, new_dependent_class_template,
+GCC_METHOD2 (gcc_utempl, build_dependent_class_template,
gcc_type, /* Argument ENCLOSING_TYPE. */
const char *) /* Argument ID. */
-/* Build a template-dependent template type specialization (e.g.,
- T<A>). TEMPLATE_DECL should be a template template parameter
- (e.g., the T in template <template <[...]> class T = X>), and TARGS
- should specify the template arguments (e.g. <A>). */
+/* Build a template-dependent template type id (e.g., T<A>).
+ TEMPLATE_DECL should be a template template parameter (e.g., the T
+ in template <template <[...]> class T = X>), and TARGS should
+ specify the template arguments (e.g. <A>). */
-GCC_METHOD2 (gcc_type, new_dependent_typespec,
+GCC_METHOD2 (gcc_type, build_dependent_type_template_id,
gcc_utempl, /* Argument TEMPLATE_DECL. */
const struct gcc_cp_template_args *) /* Argument TARGS. */
-/* Build a template-dependent value expression (e.g., S::val or
- S::template mtf<X>, or unqualified f or template tf<X>).
+/* Build a template-dependent expression (e.g., S::val or S::template
+ mtf<X>, or unqualified f or template tf<X>).
ENCLOSING_SCOPE should be a template-dependent nested name
specifier (e.g., T), a resolved namespace or class decl, or NULL
@@ -578,7 +582,7 @@ GCC_METHOD2 (gcc_type, new_dependent_typespec,
If ID is the name of a special member function, FLAGS should be
GCC_CP_SYMBOL_FUNCTION|GCC_CP_FLAG_SPECIAL_FUNCTION, and ID should
be one of the encodings for special member functions documented in
- new_decl. Otherwise, FLAGS should be GCC_CP_SYMBOL_MASK, which
+ build_decl. Otherwise, FLAGS should be GCC_CP_SYMBOL_MASK, which
suggests the symbol kind is not known (though we know it is not a
type).
@@ -586,7 +590,7 @@ GCC_METHOD2 (gcc_type, new_dependent_typespec,
target type of the conversion. Otherwise, CONV_TYPE must be
NULL. */
-GCC_METHOD5 (gcc_expr, new_dependent_value_expr,
+GCC_METHOD5 (gcc_expr, build_dependent_expr,
gcc_decl, /* Argument ENCLOSING_SCOPE. */
enum gcc_cp_symbol_kind, /* Argument FLAGS. */
const char *, /* Argument NAME. */
@@ -595,7 +599,7 @@ GCC_METHOD5 (gcc_expr, new_dependent_value_expr,
/* Build a gcc_expr for the value VALUE in type TYPE. */
-GCC_METHOD2 (gcc_expr, literal_expr,
+GCC_METHOD2 (gcc_expr, build_literal_expr,
gcc_type, /* Argument TYPE. */
unsigned long) /* Argument VALUE. */
@@ -604,7 +608,7 @@ GCC_METHOD2 (gcc_expr, literal_expr,
function. Use QUALIFIED_P to build the operand of unary & so as to
compute a pointer-to-member, rather than a regular pointer. */
-GCC_METHOD2 (gcc_expr, decl_expr,
+GCC_METHOD2 (gcc_expr, build_decl_expr,
gcc_decl, /* Argument DECL. */
int /* bool */) /* Argument QUALIFIED_P. */
@@ -618,7 +622,7 @@ GCC_METHOD2 (gcc_expr, decl_expr,
delete[], "gsda" for ::delete[], "sp" for pack expansion, "sZ" for
sizeof...(function argument pack). */
-GCC_METHOD2 (gcc_expr, unary_value_expr,
+GCC_METHOD2 (gcc_expr, build_unary_expr,
const char *, /* Argument UNARY_OP. */
gcc_expr) /* Argument OPERAND. */
@@ -629,9 +633,9 @@ GCC_METHOD2 (gcc_expr, unary_value_expr,
operators that take a name as their second operand ("." and "->")
use decl_expr to convert the gcc_decl of the member name to a
gcc_expr, if the member name wasn't created with
- e.g. new_dependent_value_expr. */
+ e.g. build_dependent_expr. */
-GCC_METHOD3 (gcc_expr, binary_value_expr,
+GCC_METHOD3 (gcc_expr, build_binary_expr,
const char *, /* Argument BINARY_OP. */
gcc_expr, /* Argument OPERAND1. */
gcc_expr) /* Argument OPERAND2. */
@@ -640,7 +644,7 @@ GCC_METHOD3 (gcc_expr, binary_value_expr,
applied to gcc_exprs OPERAND1, OPERAND2 and OPERAND3. The only
supported TERNARY_OP is "qu", for the "?:" operator. */
-GCC_METHOD4 (gcc_expr, ternary_value_expr,
+GCC_METHOD4 (gcc_expr, build_ternary_expr,
const char *, /* Argument TERNARY_OP. */
gcc_expr, /* Argument OPERAND1. */
gcc_expr, /* Argument OPERAND2. */
@@ -651,7 +655,7 @@ GCC_METHOD4 (gcc_expr, ternary_value_expr,
are "ti" for typeid, "st" for sizeof, "at" for alignof, and "sZ"
for sizeof...(template argument pack). */
-GCC_METHOD2 (gcc_expr, unary_type_expr,
+GCC_METHOD2 (gcc_expr, build_unary_type_expr,
const char *, /* Argument UNARY_OP. */
gcc_type) /* Argument OPERAND. */
@@ -661,7 +665,7 @@ GCC_METHOD2 (gcc_expr, unary_type_expr,
for dynamic, static, const and reinterpret casts, respectively;
"cv" for functional or C-style casts). */
-GCC_METHOD3 (gcc_expr, type_value_expr,
+GCC_METHOD3 (gcc_expr, build_cast_expr,
const char *, /* Argument BINARY_OP. */
gcc_type, /* Argument OPERAND1. */
gcc_expr) /* Argument OPERAND2. */
@@ -672,7 +676,7 @@ GCC_METHOD3 (gcc_expr, type_value_expr,
braced initializer list; pass "il" for CONV_OP, and NULL for
TYPE). */
-GCC_METHOD3 (gcc_expr, values_expr,
+GCC_METHOD3 (gcc_expr, build_expression_list_expr,
const char *, /* Argument CONV_OP. */
gcc_type, /* Argument TYPE. */
const struct gcc_cp_function_args *) /* Argument VALUES. */
@@ -685,7 +689,7 @@ GCC_METHOD3 (gcc_expr, values_expr,
specified initializer, INITIALIZER must be NULL; a zero-length arg
list stands for a default initializer. */
-GCC_METHOD4 (gcc_expr, alloc_expr,
+GCC_METHOD4 (gcc_expr, build_new_expr,
const char *, /* Argument NEW_OP. */
const struct gcc_cp_function_args *, /* Argument PLACEMENT. */
gcc_type, /* Argument TYPE. */
@@ -693,13 +697,12 @@ GCC_METHOD4 (gcc_expr, alloc_expr,
/* Return a call expression that calls CALLABLE with arguments ARGS.
CALLABLE may be a function, a callable object, a pointer to
- function, an unresolved value expression, an unresolved overload
- set, an object expression combined with a member function overload
- set or a pointer-to-member. If QUALIFIED_P, CALLABLE will be
- interpreted as a qualified name, preventing virtual function
- dispatch. */
+ function, an unresolved expression, an unresolved overload set, an
+ object expression combined with a member function overload set or a
+ pointer-to-member. If QUALIFIED_P, CALLABLE will be interpreted as
+ a qualified name, preventing virtual function dispatch. */
-GCC_METHOD3 (gcc_expr, call_expr,
+GCC_METHOD3 (gcc_expr, build_call_expr,
gcc_expr, /* Argument CALLABLE. */
int /* bool */, /* Argument QUALIFIED_P. */
const struct gcc_cp_function_args *) /* Argument ARGS. */
@@ -712,7 +715,7 @@ GCC_METHOD3 (gcc_expr, call_expr,
because the type is only computed when template argument
substitution is performed. */
-GCC_METHOD1 (gcc_type, expr_type,
+GCC_METHOD1 (gcc_type, get_expr_type,
gcc_expr) /* Argument OPERAND. */
/* Introduce a specialization of a template function.
@@ -722,7 +725,7 @@ GCC_METHOD1 (gcc_type, expr_type,
specialization. FILENAME and LINE_NUMBER specify the source
location associated with the template function specialization. */
-GCC_METHOD5 (gcc_decl, specialize_function_template,
+GCC_METHOD5 (gcc_decl, build_function_template_specialization,
gcc_decl, /* Argument TEMPLATE_DECL. */
const struct gcc_cp_template_args *, /* Argument TARGS. */
gcc_address, /* Argument ADDRESS. */
@@ -730,14 +733,14 @@ GCC_METHOD5 (gcc_decl, specialize_function_template,
unsigned int) /* Argument LINE_NUMBER. */
/* Specialize a template class as an incomplete type. A definition
- can be supplied later, with start_class_definition.
+ can be supplied later, with start_class_type.
TEMPLATE_DECL is the template class, and TARGS are the arguments
for the specialization. FILENAME and LINE_NUMBER specify the
source location associated with the template class
specialization. */
-GCC_METHOD4 (gcc_decl, specialize_class_template,
+GCC_METHOD4 (gcc_decl, build_class_template_specialization,
gcc_decl, /* Argument TEMPLATE_DECL. */
const struct gcc_cp_template_args *, /* Argument TARGS. */
const char *, /* Argument FILENAME. */
@@ -747,12 +750,12 @@ GCC_METHOD4 (gcc_decl, specialize_class_template,
own binding level. Initially it has no fields.
TYPEDECL is the forward-declaration of the type, returned by
- new_decl. BASE_CLASSES indicate the base classes of class NAME.
+ build_decl. BASE_CLASSES indicate the base classes of class NAME.
FILENAME and LINE_NUMBER specify the source location associated
with the class definition, should they be different from those of
the forward declaration. */
-GCC_METHOD4 (gcc_type, start_class_definition,
+GCC_METHOD4 (gcc_type, start_class_type,
gcc_decl, /* Argument TYPEDECL. */
const struct gcc_vbase_array *,/* Argument BASE_CLASSES. */
const char *, /* Argument FILENAME. */
@@ -762,16 +765,15 @@ GCC_METHOD4 (gcc_type, start_class_definition,
DISCRIMINATOR-numbered closure type in the current scope (or
associated with EXTRA_SCOPE, if non-NULL), and enter the closure
type's own binding level. This primitive would sort of combine
- new_decl and start_class_definition, if they could be used to
- introduce a closure type. Initially it has no fields.
+ build_decl and start_class_type, if they could be used to introduce
+ a closure type. Initially it has no fields.
- NAME is the class name. FILENAME and LINE_NUMBER specify the
- source location associated with the class. EXTRA_SCOPE, if
- non-NULL, must be a PARM_DECL of the current function, or a
- FIELD_DECL of the current class. If it is NULL, the current scope
- needs not be a function. */
+ FILENAME and LINE_NUMBER specify the source location associated
+ with the class. EXTRA_SCOPE, if non-NULL, must be a PARM_DECL of
+ the current function, or a FIELD_DECL of the current class. If it
+ is NULL, the current scope must be a function. */
-GCC_METHOD5 (gcc_type, start_new_closure_type,
+GCC_METHOD5 (gcc_type, start_closure_class_type,
int, /* Argument DISCRIMINATOR. */
gcc_decl, /* Argument EXTRA_SCOPE. */
enum gcc_cp_symbol_kind, /* Argument FLAGS. */
@@ -783,7 +785,7 @@ GCC_METHOD5 (gcc_type, start_new_closure_type,
FIELD_TYPE is the type of the field. BITSIZE and BITPOS indicate
where in the struct the field occurs. */
-GCC_METHOD5 (gcc_decl, new_field,
+GCC_METHOD5 (gcc_decl, build_field,
const char *, /* Argument FIELD_NAME. */
gcc_type, /* Argument FIELD_TYPE. */
enum gcc_cp_symbol_kind, /* Argument FIELD_FLAGS. */
@@ -793,9 +795,10 @@ GCC_METHOD5 (gcc_decl, new_field,
/* After all the fields have been added to a struct, class or union,
the struct or union type must be "finished". This does some final
cleanups in GCC, and pops to the binding level that was in effect
- before the matching build_class_type or build_union_type. */
+ before the matching start_class_type or
+ start_closure_class_type. */
-GCC_METHOD1 (int /* bool */, finish_record_or_union,
+GCC_METHOD1 (int /* bool */, finish_class_type,
unsigned long) /* Argument SIZE_IN_BYTES. */
/* Create a new 'enum' type, and record it in the current binding
@@ -804,7 +807,7 @@ GCC_METHOD1 (int /* bool */, finish_record_or_union,
NAME is the enum name. FILENAME and LINE_NUMBER specify its source
location. */
-GCC_METHOD5 (gcc_type, start_new_enum_type,
+GCC_METHOD5 (gcc_type, start_enum_type,
const char *, /* Argument NAME. */
gcc_type, /* Argument UNDERLYING_INT_TYPE. */
enum gcc_cp_symbol_kind, /* Argument FLAGS. */
@@ -814,7 +817,7 @@ GCC_METHOD5 (gcc_type, start_new_enum_type,
/* Add a new constant to an enum type. NAME is the constant's name
and VALUE is its value. Returns a gcc_decl for the constant. */
-GCC_METHOD3 (gcc_decl, build_add_enum_constant,
+GCC_METHOD3 (gcc_decl, build_enum_constant,
gcc_type, /* Argument ENUM_TYPE. */
const char *, /* Argument NAME. */
unsigned long) /* Argument VALUE. */
@@ -835,24 +838,6 @@ GCC_METHOD3 (gcc_type, build_function_type,
const struct gcc_type_array *,/* Argument ARGUMENT_TYPES. */
int /* bool */) /* Argument IS_VARARGS. */
-/* Create a modified version of a function type that has default
- values for some of its arguments. The returned type should ONLY be
- used to define functions or methods, never to declare parameters,
- variables, types or the like.
-
- DEFAULTS must have at most as many N_ELEMENTS as there are
- arguments without default values in FUNCTION_TYPE. Say, if
- FUNCTION_TYPE has an argument list such as (T1, T2, T3, T4 = V0)
- and DEFAULTS has 2 elements (V1, V2), the returned type will have
- the following argument list: (T1, T2 = V1, T3 = V2, T4 = V0).
-
- Any NULL expressions in DEFAULTS will be marked as deferred, and
- they should be filled in with set_deferred_function_default_args. */
-
-GCC_METHOD2 (gcc_type, add_function_default_args,
- gcc_type, /* Argument FUNCTION_TYPE. */
- const struct gcc_cp_function_args *) /* Argument DEFAULTS. */
-
/* Create a variant of a function type with an exception
specification. FUNCTION_TYPE is a function or method type.
EXCEPT_TYPES is an array with the list of exception types. Zero as
@@ -879,16 +864,6 @@ GCC_METHOD4 (gcc_type, build_method_type,
enum gcc_cp_qualifiers, /* Argument QUALS. */
enum gcc_cp_ref_qualifiers) /* Argument RQUALS. */
-/* Fill in the first deferred default args in FUNCTION_DECL with the
- expressions given in DEFAULTS. This can be used when the
- declaration of a parameter is needed to create a default
- expression, such as taking the size of an earlier parameter, or
- building a lambda expression in the parameter's context. */
-
-GCC_METHOD2 (int /* bool */, set_deferred_function_default_args,
- gcc_decl, /* Argument FUNCTION_DECL. */
- const struct gcc_cp_function_args *) /* Argument DEFAULTS. */
-
/* Return a declaration for the (INDEX - 1)th argument of
FUNCTION_DECL, i.e., for the first argument, use zero as the index.
If FUNCTION_DECL is a non-static member function, use -1 to get the
@@ -904,14 +879,14 @@ GCC_METHOD2 (gcc_decl, get_function_parameter_decl,
expressions in default parameters, the only kind that may have to
be introduced through this interface. */
-GCC_METHOD1 (gcc_expr, get_lambda_expr,
+GCC_METHOD1 (gcc_expr, build_lambda_expr,
gcc_type) /* Argument CLOSURE_TYPE. */
/* Return an integer type with the given properties. If BUILTIN_NAME
is non-NULL, it must name a builtin integral type with the given
signedness and size, and that is the type that will be returned. */
-GCC_METHOD3 (gcc_type, int_type,
+GCC_METHOD3 (gcc_type, get_int_type,
int /* bool */, /* Argument IS_UNSIGNED. */
unsigned long, /* Argument SIZE_IN_BYTES. */
const char *) /* Argument BUILTIN_NAME. */
@@ -919,23 +894,23 @@ GCC_METHOD3 (gcc_type, int_type,
/* Return the 'char' type, a distinct type from both 'signed char' and
'unsigned char' returned by int_type. */
-GCC_METHOD0 (gcc_type, char_type)
+GCC_METHOD0 (gcc_type, get_char_type)
/* Return a floating point type with the given properties. If BUILTIN_NAME
is non-NULL, it must name a builtin integral type with the given
signedness and size, and that is the type that will be returned. */
-GCC_METHOD2 (gcc_type, float_type,
+GCC_METHOD2 (gcc_type, get_float_type,
unsigned long, /* Argument SIZE_IN_BYTES. */
const char *) /* Argument BUILTIN_NAME. */
/* Return the 'void' type. */
-GCC_METHOD0 (gcc_type, void_type)
+GCC_METHOD0 (gcc_type, get_void_type)
/* Return the 'bool' type. */
-GCC_METHOD0 (gcc_type, bool_type)
+GCC_METHOD0 (gcc_type, get_bool_type)
/* Return the std::nullptr_t type. */
@@ -1007,8 +982,65 @@ GCC_METHOD1 (gcc_type, error,
/* Declare a static_assert with the given CONDITION and ERRORMSG at
FILENAME:LINE_NUMBER. */
-GCC_METHOD4 (int /* bool */, new_static_assert,
+GCC_METHOD4 (int /* bool */, add_static_assert,
gcc_expr, /* Argument CONDITION. */
const char *, /* Argument ERRORMSG. */
const char *, /* Argument FILENAME. */
unsigned int) /* Argument LINE_NUMBER. */
+
+#if 0
+
+/* FIXME: We don't want to expose the internal implementation detail
+ that default parms are stored in function types, and it's not clear
+ how this or other approaches would interact with the type sharing
+ of e.g. ctor clones, so we're leaving this out, since default args
+ are not even present in debug information anyway. Besides, the set
+ of default args for a function may grow within its scope, and vary
+ independently in other scopes. */
+
+/* Create a modified version of a function type that has default
+ values for some of its arguments. The returned type should ONLY be
+ used to define functions or methods, never to declare parameters,
+ variables, types or the like.
+
+ DEFAULTS must have at most as many N_ELEMENTS as there are
+ arguments without default values in FUNCTION_TYPE. Say, if
+ FUNCTION_TYPE has an argument list such as (T1, T2, T3, T4 = V0)
+ and DEFAULTS has 2 elements (V1, V2), the returned type will have
+ the following argument list: (T1, T2 = V1, T3 = V2, T4 = V0).
+
+ Any NULL expressions in DEFAULTS will be marked as deferred, and
+ they should be filled in with set_deferred_function_default_args. */
+
+GCC_METHOD2 (gcc_type, add_function_default_args,
+ gcc_type, /* Argument FUNCTION_TYPE. */
+ const struct gcc_cp_function_args *) /* Argument DEFAULTS. */
+
+/* Fill in the first deferred default args in FUNCTION_DECL with the
+ expressions given in DEFAULTS. This can be used when the
+ declaration of a parameter is needed to create a default
+ expression, such as taking the size of an earlier parameter, or
+ building a lambda expression in the parameter's context. */
+
+GCC_METHOD2 (int /* bool */, set_deferred_function_default_args,
+ gcc_decl, /* Argument FUNCTION_DECL. */
+ const struct gcc_cp_function_args *) /* Argument DEFAULTS. */
+
+#endif
+
+
+/* When you add entry points, add them at the end, so that the new API
+ version remains compatible with the old version.
+
+ The following conventions have been observed as to naming entry points:
+
+ - build_* creates (and maybe records) something and returns it;
+ - add_* creates and records something, but doesn't return it;
+ - get_* obtains something without creating it;
+ - start_* marks the beginning of a compound (type, list, ...);
+ - finish_* completes the compound when needed.
+
+ Entry points that return an int (bool) and don't have a return value
+ specification return nonzero (true) on success and zero (false) on
+ failure. This is in line with libcc1's conventions of returning a
+ zero-initialized value in case of e.g. a transport error. */
diff --git a/include/gcc-cp-interface.h b/include/gcc-cp-interface.h
index 9cae248..83cb2d0 100644
--- a/include/gcc-cp-interface.h
+++ b/include/gcc-cp-interface.h
@@ -1,6 +1,6 @@
/* Interface between GCC C++ FE and GDB
- Copyright (C) 2014-2016 Free Software Foundation, Inc.
+ Copyright (C) 2014-2017 Free Software Foundation, Inc.
This file is part of GCC.
@@ -41,7 +41,7 @@ struct gcc_cp_context;
enum gcc_cp_api_version
{
- GCC_CP_FE_VERSION_0 = 0xffffffff-16
+ GCC_CP_FE_VERSION_0 = 0xffffffff-17
};
/* Qualifiers. */
@@ -73,8 +73,6 @@ typedef unsigned long long gcc_utempl;
typedef unsigned long long gcc_expr;
-/* FIXME: do we need to support argument packs? */
-
typedef enum
{ GCC_CP_TPARG_VALUE, GCC_CP_TPARG_CLASS,
GCC_CP_TPARG_TEMPL, GCC_CP_TPARG_PACK }
@@ -134,14 +132,14 @@ enum gcc_cp_symbol_kind
GCC_CP_SYMBOL_LABEL,
- /* A class, forward declared in new_decl (to be later defined in
+ /* A class, forward declared in build_decl (to be later defined in
start_class_definition), or, in a template parameter list scope,
a declaration of a template class, closing the parameter
list. */
GCC_CP_SYMBOL_CLASS,
- /* A union, forward declared in new_decl (to be later defined in
+ /* A union, forward declared in build_decl (to be later defined in
start_class_definition). */
GCC_CP_SYMBOL_UNION,
@@ -197,12 +195,10 @@ enum gcc_cp_symbol_kind
operators. */
GCC_CP_FLAG_SPECIAL_FUNCTION = GCC_CP_FLAG_BASE,
- /* We intentionally cannot express inline, constexpr, friend or
- virtual override for functions. We can't inline or
- constexpr-replace without a source-level body. Since we disable
- access control, friend is meaningless. The override keyword is
- only meaningless within the definition of the containing
- class. */
+ /* We intentionally cannot express inline, constexpr, or virtual
+ override for functions. We can't inline or constexpr-replace
+ without a source-level body. The override keyword is only
+ meaningful within the definition of the containing class. */
/* This indicates a "virtual" member function, explicitly or
implicitly (due to a virtual function with the same name and
@@ -296,8 +292,8 @@ enum gcc_cp_symbol_kind
- GCC_CP_FLAG_BASE),
- /* Flags to be used when introducing a class with
- start_new_class_type, or a class template with new_decl. */
+ /* Flags to be used when introducing a class or a class template
+ with build_decl. */
/* This indicates an enum type without any flags. */
GCC_CP_FLAG_CLASS_NOFLAG = 0,
@@ -364,20 +360,12 @@ struct gcc_vbase_array
enum gcc_cp_oracle_request
{
- /* An ordinary symbol -- a variable, function, typedef, or enum
- constant. All namespace-scoped symbols with the requested name
- should be defined in response to this request. */
-
- GCC_CP_ORACLE_SYMBOL,
-
- /* A struct, union, or enum tag. All members of the tagged type
- should be defined in response to this request. */
-
- GCC_CP_ORACLE_TAG,
-
- /* A label. */
+ /* An identifier in namespace scope -- type, variable, function,
+ namespace, template. All namespace-scoped symbols with the
+ requested name, in any namespace (including the global
+ namespace), should be defined in response to this request. */
- GCC_CP_ORACLE_LABEL
+ GCC_CP_ORACLE_IDENTIFIER
};
/* The type of the function called by GCC to ask GDB for a symbol's
diff --git a/libcc1/libcp1plugin.cc b/libcc1/libcp1plugin.cc
index 0be8190..01740fd 100644
--- a/libcc1/libcp1plugin.cc
+++ b/libcc1/libcp1plugin.cc
@@ -245,14 +245,8 @@ plugin_binding_oracle (enum cp_oracle_request kind, tree identifier)
switch (kind)
{
- case CP_ORACLE_SYMBOL:
- request = GCC_CP_ORACLE_SYMBOL;
- break;
- case CP_ORACLE_TAG:
- request = GCC_CP_ORACLE_TAG;
- break;
- case CP_ORACLE_LABEL:
- request = GCC_CP_ORACLE_LABEL;
+ case CP_ORACLE_IDENTIFIER:
+ request = GCC_CP_ORACLE_IDENTIFIER;
break;
default:
abort ();
@@ -866,7 +860,7 @@ plugin_push_function (cc1_plugin::connection *,
}
int
-plugin_pop_namespace (cc1_plugin::connection *)
+plugin_pop_binding_level (cc1_plugin::connection *)
{
pop_scope ();
return 1;
@@ -919,7 +913,7 @@ get_current_scope ()
}
gcc_decl
-plugin_get_current_binding_level (cc1_plugin::connection *)
+plugin_get_current_binding_level_decl (cc1_plugin::connection *)
{
tree decl = get_current_scope ();
@@ -927,9 +921,36 @@ plugin_get_current_binding_level (cc1_plugin::connection *)
}
int
-plugin_using_namespace (cc1_plugin::connection *,
- gcc_decl used_ns_in,
- int inline_p)
+plugin_make_namespace_inline (cc1_plugin::connection *)
+{
+ tree inline_ns = current_namespace;
+
+ gcc_assert (toplevel_bindings_p ());
+ gcc_assert (inline_ns != global_namespace);
+
+ tree parent_ns = CP_DECL_CONTEXT (inline_ns);
+
+ if (purpose_member (DECL_NAMESPACE_ASSOCIATIONS (inline_ns),
+ parent_ns))
+ return 0;
+
+ pop_namespace ();
+
+ gcc_assert (current_namespace == parent_ns);
+
+ DECL_NAMESPACE_ASSOCIATIONS (inline_ns)
+ = tree_cons (parent_ns, 0,
+ DECL_NAMESPACE_ASSOCIATIONS (inline_ns));
+ do_using_directive (inline_ns);
+
+ push_namespace (DECL_NAME (inline_ns));
+
+ return 1;
+}
+
+int
+plugin_add_using_namespace (cc1_plugin::connection *,
+ gcc_decl used_ns_in)
{
tree used_ns = convert_in (used_ns_in);
@@ -937,26 +958,11 @@ plugin_using_namespace (cc1_plugin::connection *,
do_using_directive (used_ns);
- /* ??? Should we build the attribute and call parse_using_directive
- instead, to avoid logic duplication? */
- if (inline_p)
- {
- /* Make sure other values are not used; we might want to make it
- an enum bitfield in the future. */
- gcc_assert (inline_p == 1);
-
- gcc_assert (toplevel_bindings_p ());
- gcc_assert (is_ancestor (current_namespace, used_ns));
- DECL_NAMESPACE_ASSOCIATIONS (used_ns)
- = tree_cons (current_namespace, 0,
- DECL_NAMESPACE_ASSOCIATIONS (used_ns));
- }
-
return 1;
}
int
-plugin_new_namespace_alias (cc1_plugin::connection *,
+plugin_add_namespace_alias (cc1_plugin::connection *,
const char *id,
gcc_decl target_in)
{
@@ -995,7 +1001,7 @@ set_access_flags (tree decl, enum gcc_cp_symbol_kind flags)
}
int
-plugin_new_using_decl (cc1_plugin::connection *,
+plugin_add_using_decl (cc1_plugin::connection *,
enum gcc_cp_symbol_kind flags,
gcc_decl target_in)
{
@@ -1020,9 +1026,6 @@ plugin_new_using_decl (cc1_plugin::connection *,
{
tree decl = do_class_using_decl (tcontext, identifier);
- if (DECL_DECLARES_TYPE_P (target))
- USING_DECL_TYPENAME_P (decl);
-
set_access_flags (decl, flags);
finish_member_declaration (decl);
@@ -1059,14 +1062,14 @@ build_named_class_type (enum tree_code code,
#define TP_PARM_LIST TREE_TYPE (current_template_parms)
gcc_decl
-plugin_new_decl (cc1_plugin::connection *self,
- const char *name,
- enum gcc_cp_symbol_kind sym_kind,
- gcc_type sym_type_in,
- const char *substitution_name,
- gcc_address address,
- const char *filename,
- unsigned int line_number)
+plugin_build_decl (cc1_plugin::connection *self,
+ const char *name,
+ enum gcc_cp_symbol_kind sym_kind,
+ gcc_type sym_type_in,
+ const char *substitution_name,
+ gcc_address address,
+ const char *filename,
+ unsigned int line_number)
{
plugin_context *ctx = static_cast<plugin_context *> (self);
gcc_assert (!name || !strchr (name, ':')); // FIXME: this can go eventually.
@@ -1097,13 +1100,6 @@ plugin_new_decl (cc1_plugin::connection *self,
gcc_assert (!sym_flags);
break;
- case GCC_CP_SYMBOL_LABEL:
- // FIXME: we aren't ready to handle labels yet.
- // It isn't clear how to translate them properly
- // and in any case a "goto" isn't likely to work.
- gcc_assert (!sym_flags);
- return convert_out (error_mark_node);
-
case GCC_CP_SYMBOL_CLASS:
code = RECORD_TYPE;
gcc_assert (!(sym_flags & ~GCC_CP_FLAG_MASK_CLASS));
@@ -1654,7 +1650,7 @@ plugin_define_cdtor_clone (cc1_plugin::connection *self,
}
int
-plugin_new_friend (cc1_plugin::connection * /* self */,
+plugin_add_friend (cc1_plugin::connection * /* self */,
gcc_decl decl_in,
gcc_type type_in)
{
@@ -1758,11 +1754,11 @@ start_class_def (tree type,
}
gcc_type
-plugin_start_class_definition (cc1_plugin::connection *self,
- gcc_decl typedecl_in,
- const gcc_vbase_array *base_classes,
- const char *filename,
- unsigned int line_number)
+plugin_start_class_type (cc1_plugin::connection *self,
+ gcc_decl typedecl_in,
+ const gcc_vbase_array *base_classes,
+ const char *filename,
+ unsigned int line_number)
{
plugin_context *ctx = static_cast<plugin_context *> (self);
source_location loc = ctx->get_source_location (filename, line_number);
@@ -1780,12 +1776,12 @@ plugin_start_class_definition (cc1_plugin::connection *self,
}
gcc_type
-plugin_start_new_closure_type (cc1_plugin::connection *self,
- int discriminator,
- gcc_decl extra_scope_in,
- enum gcc_cp_symbol_kind flags,
- const char *filename,
- unsigned int line_number)
+plugin_start_closure_class_type (cc1_plugin::connection *self,
+ int discriminator,
+ gcc_decl extra_scope_in,
+ enum gcc_cp_symbol_kind flags,
+ const char *filename,
+ unsigned int line_number)
{
plugin_context *ctx = static_cast<plugin_context *> (self);
tree extra_scope = convert_in (extra_scope_in);
@@ -1842,8 +1838,8 @@ plugin_start_new_closure_type (cc1_plugin::connection *self,
}
gcc_expr
-plugin_get_lambda_expr (cc1_plugin::connection *self,
- gcc_type closure_type_in)
+plugin_build_lambda_expr (cc1_plugin::connection *self,
+ gcc_type closure_type_in)
{
plugin_context *ctx = static_cast<plugin_context *> (self);
tree closure_type = convert_in (closure_type_in);
@@ -1858,12 +1854,12 @@ plugin_get_lambda_expr (cc1_plugin::connection *self,
}
gcc_decl
-plugin_new_field (cc1_plugin::connection *,
- const char *field_name,
- gcc_type field_type_in,
- enum gcc_cp_symbol_kind flags,
- unsigned long bitsize,
- unsigned long bitpos)
+plugin_build_field (cc1_plugin::connection *,
+ const char *field_name,
+ gcc_type field_type_in,
+ enum gcc_cp_symbol_kind flags,
+ unsigned long bitsize,
+ unsigned long bitpos)
{
tree record_or_union_type = current_class_type;
tree field_type = convert_in (field_type_in);
@@ -1914,8 +1910,8 @@ plugin_new_field (cc1_plugin::connection *,
}
int
-plugin_finish_record_or_union (cc1_plugin::connection *,
- unsigned long size_in_bytes)
+plugin_finish_class_type (cc1_plugin::connection *,
+ unsigned long size_in_bytes)
{
tree record_or_union_type = current_class_type;
@@ -1930,12 +1926,12 @@ plugin_finish_record_or_union (cc1_plugin::connection *,
}
gcc_type
-plugin_start_new_enum_type (cc1_plugin::connection *self,
- const char *name,
- gcc_type underlying_int_type_in,
- enum gcc_cp_symbol_kind flags,
- const char *filename,
- unsigned int line_number)
+plugin_start_enum_type (cc1_plugin::connection *self,
+ const char *name,
+ gcc_type underlying_int_type_in,
+ enum gcc_cp_symbol_kind flags,
+ const char *filename,
+ unsigned int line_number)
{
plugin_context *ctx = static_cast<plugin_context *> (self);
tree underlying_int_type = convert_in (underlying_int_type_in);
@@ -1970,10 +1966,10 @@ plugin_start_new_enum_type (cc1_plugin::connection *self,
}
gcc_decl
-plugin_build_add_enum_constant (cc1_plugin::connection *,
- gcc_type enum_type_in,
- const char *name,
- unsigned long value)
+plugin_build_enum_constant (cc1_plugin::connection *,
+ gcc_type enum_type_in,
+ const char *name,
+ unsigned long value)
{
tree enum_type = convert_in (enum_type_in);
@@ -2026,6 +2022,8 @@ plugin_build_function_type (cc1_plugin::connection *self,
return convert_out (ctx->preserve (result));
}
+#if 0
+
gcc_type
plugin_add_function_default_args (cc1_plugin::connection *self,
gcc_type function_type_in,
@@ -2113,6 +2111,8 @@ plugin_set_deferred_function_default_args (cc1_plugin::connection *,
return 1;
}
+#endif
+
gcc_decl
plugin_get_function_parameter_decl (cc1_plugin::connection *,
gcc_decl function_in,
@@ -2221,7 +2221,7 @@ plugin_build_pointer_to_member_type (cc1_plugin::connection *self,
}
int
-plugin_start_new_template_decl (cc1_plugin::connection *self ATTRIBUTE_UNUSED)
+plugin_start_template_decl (cc1_plugin::connection *)
{
begin_template_parm_list ();
@@ -2231,8 +2231,8 @@ plugin_start_new_template_decl (cc1_plugin::connection *self ATTRIBUTE_UNUSED)
}
gcc_decl
-plugin_type_decl (cc1_plugin::connection *,
- gcc_type type_in)
+plugin_get_type_decl (cc1_plugin::connection *,
+ gcc_type type_in)
{
tree type = convert_in (type_in);
@@ -2243,8 +2243,8 @@ plugin_type_decl (cc1_plugin::connection *,
}
gcc_type
-plugin_decl_type (cc1_plugin::connection *,
- gcc_decl decl_in)
+plugin_get_decl_type (cc1_plugin::connection *,
+ gcc_decl decl_in)
{
tree decl = convert_in (decl_in);
@@ -2255,12 +2255,12 @@ plugin_decl_type (cc1_plugin::connection *,
}
gcc_type
-plugin_new_template_typename_parm (cc1_plugin::connection *self,
- const char *id,
- int /* bool */ pack_p,
- gcc_type default_type,
- const char *filename,
- unsigned int line_number)
+plugin_build_type_template_parameter (cc1_plugin::connection *self,
+ const char *id,
+ int /* bool */ pack_p,
+ gcc_type default_type,
+ const char *filename,
+ unsigned int line_number)
{
plugin_context *ctx = static_cast<plugin_context *> (self);
source_location loc = ctx->get_source_location (filename, line_number);
@@ -2285,12 +2285,12 @@ plugin_new_template_typename_parm (cc1_plugin::connection *self,
}
gcc_utempl
-plugin_new_template_template_parm (cc1_plugin::connection *self,
- const char *id,
- int /* bool */ pack_p,
- gcc_utempl default_templ,
- const char *filename,
- unsigned int line_number)
+plugin_build_template_template_parameter (cc1_plugin::connection *self,
+ const char *id,
+ int /* bool */ pack_p,
+ gcc_utempl default_templ,
+ const char *filename,
+ unsigned int line_number)
{
plugin_context *ctx = static_cast<plugin_context *> (self);
source_location loc = ctx->get_source_location (filename, line_number);
@@ -2320,12 +2320,12 @@ plugin_new_template_template_parm (cc1_plugin::connection *self,
}
gcc_decl
-plugin_new_template_value_parm (cc1_plugin::connection *self,
- gcc_type type,
- const char *id,
- gcc_expr default_value,
- const char *filename,
- unsigned int line_number)
+plugin_build_value_template_parameter (cc1_plugin::connection *self,
+ gcc_type type,
+ const char *id,
+ gcc_expr default_value,
+ const char *filename,
+ unsigned int line_number)
{
plugin_context *ctx = static_cast<plugin_context *> (self);
source_location loc = ctx->get_source_location (filename, line_number);
@@ -2390,10 +2390,10 @@ targlist (const gcc_cp_template_args *targs)
}
gcc_type
-plugin_new_dependent_typename (cc1_plugin::connection *self,
- gcc_type enclosing_type,
- const char *id,
- const gcc_cp_template_args *targs)
+plugin_build_dependent_typename (cc1_plugin::connection *self,
+ gcc_type enclosing_type,
+ const char *id,
+ const gcc_cp_template_args *targs)
{
plugin_context *ctx = static_cast<plugin_context *> (self);
tree type = convert_in (enclosing_type);
@@ -2407,9 +2407,9 @@ plugin_new_dependent_typename (cc1_plugin::connection *self,
}
gcc_utempl
-plugin_new_dependent_class_template (cc1_plugin::connection *self,
- gcc_type enclosing_type,
- const char *id)
+plugin_build_dependent_class_template (cc1_plugin::connection *self,
+ gcc_type enclosing_type,
+ const char *id)
{
plugin_context *ctx = static_cast<plugin_context *> (self);
tree type = convert_in (enclosing_type);
@@ -2420,9 +2420,9 @@ plugin_new_dependent_class_template (cc1_plugin::connection *self,
}
gcc_type
-plugin_new_dependent_typespec (cc1_plugin::connection *self,
- gcc_utempl template_decl,
- const gcc_cp_template_args *targs)
+plugin_build_dependent_type_template_id (cc1_plugin::connection *self,
+ gcc_utempl template_decl,
+ const gcc_cp_template_args *targs)
{
plugin_context *ctx = static_cast<plugin_context *> (self);
tree type = convert_in (template_decl);
@@ -2432,12 +2432,12 @@ plugin_new_dependent_typespec (cc1_plugin::connection *self,
}
gcc_expr
-plugin_new_dependent_value_expr (cc1_plugin::connection *self,
- gcc_decl enclosing_scope,
- enum gcc_cp_symbol_kind flags,
- const char *name,
- gcc_type conv_type_in,
- const gcc_cp_template_args *targs)
+plugin_build_dependent_expr (cc1_plugin::connection *self,
+ gcc_decl enclosing_scope,
+ enum gcc_cp_symbol_kind flags,
+ const char *name,
+ gcc_type conv_type_in,
+ const gcc_cp_template_args *targs)
{
plugin_context *ctx = static_cast<plugin_context *> (self);
tree scope = convert_in (enclosing_scope);
@@ -2691,8 +2691,8 @@ plugin_new_dependent_value_expr (cc1_plugin::connection *self,
}
gcc_expr
-plugin_literal_expr (cc1_plugin::connection *self,
- gcc_type type, unsigned long value)
+plugin_build_literal_expr (cc1_plugin::connection *self,
+ gcc_type type, unsigned long value)
{
plugin_context *ctx = static_cast<plugin_context *> (self);
tree t = convert_in (type);
@@ -2701,9 +2701,9 @@ plugin_literal_expr (cc1_plugin::connection *self,
}
gcc_expr
-plugin_decl_expr (cc1_plugin::connection *self,
- gcc_decl decl_in,
- int qualified_p)
+plugin_build_decl_expr (cc1_plugin::connection *self,
+ gcc_decl decl_in,
+ int qualified_p)
{
plugin_context *ctx = static_cast<plugin_context *> (self);
tree decl = convert_in (decl_in);
@@ -2719,7 +2719,7 @@ plugin_decl_expr (cc1_plugin::connection *self,
}
gcc_expr
-plugin_unary_value_expr (cc1_plugin::connection *self,
+plugin_build_unary_expr (cc1_plugin::connection *self,
const char *unary_op,
gcc_expr operand)
{
@@ -2860,7 +2860,7 @@ plugin_unary_value_expr (cc1_plugin::connection *self,
}
gcc_expr
-plugin_binary_value_expr (cc1_plugin::connection *self,
+plugin_build_binary_expr (cc1_plugin::connection *self,
const char *binary_op,
gcc_expr operand1,
gcc_expr operand2)
@@ -2985,7 +2985,7 @@ plugin_binary_value_expr (cc1_plugin::connection *self,
}
gcc_expr
-plugin_ternary_value_expr (cc1_plugin::connection *self,
+plugin_build_ternary_expr (cc1_plugin::connection *self,
const char *ternary_op,
gcc_expr operand1,
gcc_expr operand2,
@@ -3017,9 +3017,9 @@ plugin_ternary_value_expr (cc1_plugin::connection *self,
}
gcc_expr
-plugin_unary_type_expr (cc1_plugin::connection *self,
- const char *unary_op,
- gcc_type operand)
+plugin_build_unary_type_expr (cc1_plugin::connection *self,
+ const char *unary_op,
+ gcc_type operand)
{
plugin_context *ctx = static_cast<plugin_context *> (self);
tree type = convert_in (operand);
@@ -3080,7 +3080,7 @@ plugin_unary_type_expr (cc1_plugin::connection *self,
}
gcc_expr
-plugin_type_value_expr (cc1_plugin::connection *self,
+plugin_build_cast_expr (cc1_plugin::connection *self,
const char *binary_op,
gcc_type operand1,
gcc_expr operand2)
@@ -3162,10 +3162,10 @@ args_to_ctor_elts (const struct gcc_cp_function_args *args_in)
}
gcc_expr
-plugin_values_expr (cc1_plugin::connection *self,
- const char *conv_op,
- gcc_type type_in,
- const struct gcc_cp_function_args *values_in)
+plugin_build_expression_list_expr (cc1_plugin::connection *self,
+ const char *conv_op,
+ gcc_type type_in,
+ const struct gcc_cp_function_args *values_in)
{
plugin_context *ctx = static_cast<plugin_context *> (self);
tree type = convert_in (type_in);
@@ -3203,11 +3203,11 @@ plugin_values_expr (cc1_plugin::connection *self,
}
gcc_expr
-plugin_alloc_expr (cc1_plugin::connection *self,
- const char *new_op,
- const struct gcc_cp_function_args *placement_in,
- gcc_type type_in,
- const struct gcc_cp_function_args *initializer_in)
+plugin_build_new_expr (cc1_plugin::connection *self,
+ const char *new_op,
+ const struct gcc_cp_function_args *placement_in,
+ gcc_type type_in,
+ const struct gcc_cp_function_args *initializer_in)
{
plugin_context *ctx = static_cast<plugin_context *> (self);
tree type = convert_in (type_in);
@@ -3291,9 +3291,9 @@ plugin_alloc_expr (cc1_plugin::connection *self,
}
gcc_expr
-plugin_call_expr (cc1_plugin::connection *self,
- gcc_expr callable_in, int qualified_p,
- const struct gcc_cp_function_args *args_in)
+plugin_build_call_expr (cc1_plugin::connection *self,
+ gcc_expr callable_in, int qualified_p,
+ const struct gcc_cp_function_args *args_in)
{
plugin_context *ctx = static_cast<plugin_context *> (self);
tree callable = convert_in (callable_in);
@@ -3352,8 +3352,8 @@ plugin_call_expr (cc1_plugin::connection *self,
}
gcc_type
-plugin_expr_type (cc1_plugin::connection *self,
- gcc_expr operand)
+plugin_get_expr_type (cc1_plugin::connection *self,
+ gcc_expr operand)
{
plugin_context *ctx = static_cast<plugin_context *> (self);
tree op0 = convert_in (operand);
@@ -3369,12 +3369,12 @@ plugin_expr_type (cc1_plugin::connection *self,
}
gcc_decl
-plugin_specialize_function_template (cc1_plugin::connection *self,
- gcc_decl template_decl,
- const gcc_cp_template_args *targs,
- gcc_address address,
- const char *filename,
- unsigned int line_number)
+plugin_build_function_template_specialization (cc1_plugin::connection *self,
+ gcc_decl template_decl,
+ const gcc_cp_template_args *targs,
+ gcc_address address,
+ const char *filename,
+ unsigned int line_number)
{
plugin_context *ctx = static_cast<plugin_context *> (self);
source_location loc = ctx->get_source_location (filename, line_number);
@@ -3390,11 +3390,11 @@ plugin_specialize_function_template (cc1_plugin::connection *self,
}
gcc_decl
-plugin_specialize_class_template (cc1_plugin::connection *self,
- gcc_decl template_decl,
- const gcc_cp_template_args *args,
- const char *filename,
- unsigned int line_number)
+plugin_build_class_template_specialization (cc1_plugin::connection *self,
+ gcc_decl template_decl,
+ const gcc_cp_template_args *args,
+ const char *filename,
+ unsigned int line_number)
{
plugin_context *ctx = static_cast<plugin_context *> (self);
source_location loc = ctx->get_source_location (filename, line_number);
@@ -3427,9 +3427,9 @@ safe_lookup_builtin_type (const char *builtin_name)
}
gcc_type
-plugin_int_type (cc1_plugin::connection *self,
- int is_unsigned, unsigned long size_in_bytes,
- const char *builtin_name)
+plugin_get_int_type (cc1_plugin::connection *self,
+ int is_unsigned, unsigned long size_in_bytes,
+ const char *builtin_name)
{
tree result;
@@ -3457,15 +3457,15 @@ plugin_int_type (cc1_plugin::connection *self,
}
gcc_type
-plugin_char_type (cc1_plugin::connection *)
+plugin_get_char_type (cc1_plugin::connection *)
{
return convert_out (char_type_node);
}
gcc_type
-plugin_float_type (cc1_plugin::connection *,
- unsigned long size_in_bytes,
- const char *builtin_name)
+plugin_get_float_type (cc1_plugin::connection *,
+ unsigned long size_in_bytes,
+ const char *builtin_name)
{
if (builtin_name)
{
@@ -3490,13 +3490,13 @@ plugin_float_type (cc1_plugin::connection *,
}
gcc_type
-plugin_void_type (cc1_plugin::connection *)
+plugin_get_void_type (cc1_plugin::connection *)
{
return convert_out (void_type_node);
}
gcc_type
-plugin_bool_type (cc1_plugin::connection *)
+plugin_get_bool_type (cc1_plugin::connection *)
{
return convert_out (boolean_type_node);
}
@@ -3643,7 +3643,7 @@ plugin_error (cc1_plugin::connection *,
}
int
-plugin_new_static_assert (cc1_plugin::connection *self,
+plugin_add_static_assert (cc1_plugin::connection *self,
gcc_expr condition_in,
const char *errormsg,
const char *filename,
--
Alexandre Oliva, freedom fighter http://FSFLA.org/~lxoliva/
You must be the change you wish to see in the world. -- Gandhi
Be Free! -- http://FSFLA.org/ FSF Latin America board member
Free Software Evangelist|Red Hat Brasil GNU Toolchain Engineer