Other parts of the front end that need to create entities (like
VAR_DECLs or FUNCTION_DECLs) should do that directly. */
-static cp_declarator *make_id_declarator
+static cp_declarator *make_id_declarator
(tree);
-static cp_declarator *make_call_declarator
+static cp_declarator *make_call_declarator
(cp_declarator *, cp_parameter_declarator *, cp_cv_quals, tree);
-static cp_declarator *make_array_declarator
+static cp_declarator *make_array_declarator
(cp_declarator *, tree);
-static cp_declarator *make_pointer_declarator
+static cp_declarator *make_pointer_declarator
(cp_cv_quals, cp_declarator *);
-static cp_declarator *make_reference_declarator
+static cp_declarator *make_reference_declarator
(cp_cv_quals, cp_declarator *);
-static cp_parameter_declarator *make_parameter_declarator
+static cp_parameter_declarator *make_parameter_declarator
(cp_decl_specifier_seq *, cp_declarator *, tree);
-static cp_declarator *make_ptrmem_declarator
+static cp_declarator *make_ptrmem_declarator
(cp_cv_quals, tree, cp_declarator *);
cp_declarator *cp_error_declarator;
make_id_declarator (tree id)
{
cp_declarator *declarator;
-
+
declarator = make_declarator (cdk_id);
declarator->u.id.name = id;
declarator->u.id.sfk = sfk_none;
indicates what exceptions can be thrown. */
cp_declarator *
-make_call_declarator (cp_declarator *target,
+make_call_declarator (cp_declarator *target,
cp_parameter_declarator *parms,
cp_cv_quals cv_qualifiers,
tree exception_specification)
DECLARATOR and DEFAULT_ARGUMENT. */
cp_parameter_declarator *
-make_parameter_declarator (cp_decl_specifier_seq *decl_specifiers,
+make_parameter_declarator (cp_decl_specifier_seq *decl_specifiers,
cp_declarator *declarator,
tree default_argument)
{
cp_parameter_declarator *parameter;
- parameter = ((cp_parameter_declarator *)
+ parameter = ((cp_parameter_declarator *)
alloc_declarator (sizeof (cp_parameter_declarator)));
parameter->next = NULL;
if (decl_specifiers)
static tree cp_parser_function_specifier_opt
(cp_parser *, cp_decl_specifier_seq *);
static tree cp_parser_type_specifier
- (cp_parser *, cp_parser_flags, cp_decl_specifier_seq *, bool,
+ (cp_parser *, cp_parser_flags, cp_decl_specifier_seq *, bool,
int *, bool *);
static tree cp_parser_simple_type_specifier
(cp_parser *, cp_decl_specifier_seq *, cp_parser_flags);
(cp_parser *);
static void cp_parser_set_storage_class
(cp_decl_specifier_seq *, cp_storage_class);
-static void cp_parser_set_decl_spec_type
+static void cp_parser_set_decl_spec_type
(cp_decl_specifier_seq *, tree, bool);
static bool cp_parser_friend_p
(const cp_decl_specifier_seq *);
static void *declarator_obstack_base;
bool success;
-
+
/* Create the declarator obstack, if necessary. */
if (!cp_error_declarator)
{
{
/* Consume the EOF token. */
cp_parser_require (parser, CPP_EOF, "end-of-file");
-
+
/* Finish up. */
finish_translation_unit ();
if (parser->integral_constant_expression_p
&& !dependent_type_p (type)
&& !INTEGRAL_OR_ENUMERATION_TYPE_P (type)
- && (cp_parser_non_integral_constant_expression
+ && (cp_parser_non_integral_constant_expression
(parser,
"a cast to a type other than an integral or "
"enumeration type")))
cp_parser_require (parser, CPP_CLOSE_PAREN, "`)'");
}
/* `typeid' may not appear in an integral constant expression. */
- if (cp_parser_non_integral_constant_expression(parser,
+ if (cp_parser_non_integral_constant_expression(parser,
"`typeid' operator"))
return error_mark_node;
/* Restore the saved message. */
/* Create a TYPENAME_TYPE to represent the type to which the
functional cast is being performed. */
else
- type = make_typename_type (parser->scope, id,
+ type = make_typename_type (parser->scope, id,
/*complain=*/1);
postfix_expression = cp_parser_functional_cast (parser, type);
postfix-expression . pseudo-destructor-name
postfix-expression -> template [opt] id-expression
postfix-expression -> pseudo-destructor-name */
-
+
/* Consume the `.' or `->' operator. */
cp_lexer_consume_token (parser->lexer);
parser->object_scope = NULL_TREE;
}
if (scope && name && BASELINK_P (name))
- adjust_result_of_qualified_name_lookup
+ adjust_result_of_qualified_name_lookup
(name, BINFO_TYPE (BASELINK_BINFO (name)), scope);
postfix_expression
= finish_class_member_access_expr (postfix_expression, name);
/* Outside of offsetof, these operators may not appear in
constant-expressions. */
if (!for_offsetof
- && (cp_parser_non_integral_constant_expression
+ && (cp_parser_non_integral_constant_expression
(parser, token_type == CPP_DEREF ? "'->'" : "`.'")))
postfix_expression = error_mark_node;
abort ();
}
- if (non_constant_p
+ if (non_constant_p
&& cp_parser_non_integral_constant_expression (parser,
non_constant_p))
expression = error_mark_node;
type = cp_parser_type_id (parser);
/* Look for the closing `)'. */
cp_parser_require (parser, CPP_CLOSE_PAREN, "`)'");
- /* There should not be a direct-new-declarator in this production,
+ /* There should not be a direct-new-declarator in this production,
but GCC used to allowed this, so we check and emit a sensible error
message for this case. */
if (cp_lexer_next_token_is (parser->lexer, CPP_OPEN_SQUARE))
outer_declarator = declarator;
declarator = declarator->declarator;
}
- while (declarator
+ while (declarator
&& declarator->kind == cdk_array
&& declarator->declarator
&& declarator->declarator->kind == cdk_array)
outer_declarator = declarator;
declarator = declarator->declarator;
}
-
+
if (declarator && declarator->kind == cdk_array)
{
*nelts = declarator->u.array.bounds;
*nelts = integer_one_node;
else if (!processing_template_decl)
{
- if (!build_expr_type_conversion (WANT_INT | WANT_ENUM, *nelts,
+ if (!build_expr_type_conversion (WANT_INT | WANT_ENUM, *nelts,
false))
pedwarn ("size in array new must have integral type");
*nelts = save_expr (cp_convert (sizetype, *nelts));
if (parser->integral_constant_expression_p
&& !dependent_type_p (type)
&& !INTEGRAL_OR_ENUMERATION_TYPE_P (type)
- && (cp_parser_non_integral_constant_expression
+ && (cp_parser_non_integral_constant_expression
(parser,
"a cast to a type other than an integral or "
"enumeration type")))
finish_for_expr (expression, statement);
/* Look for the `)'. */
cp_parser_require (parser, CPP_CLOSE_PAREN, "`)'");
-
+
/* Parse the body of the for-statement. */
parser->in_iteration_statement_p = true;
cp_parser_already_scoped_statement (parser);
/* In a block scope, a valid declaration must always have a
decl-specifier-seq. By not trying to parse declarators, we can
resolve the declaration/expression ambiguity more quickly. */
- if (!function_definition_allowed_p
+ if (!function_definition_allowed_p
&& !decl_specifiers.any_specifiers_p)
{
cp_parser_error (parser, "expected declaration");
(i.e., a type declaration)
2: one of the decl-specifiers is an enum-specifier or a
class-specifier (i.e., a type definition)
-
+
*/
static void
if (token->keyword == RID_ATTRIBUTE)
{
/* Parse the attributes. */
- decl_specs->attributes
+ decl_specs->attributes
= chainon (decl_specs->attributes,
cp_parser_attributes_opt (parser));
continue;
/* Constructors are a special case. The `S' in `S()' is not a
decl-specifier; it is the beginning of the declarator. */
- constructor_p
+ constructor_p
= (!found_decl_spec
&& constructor_possible_p
- && (cp_parser_constructor_declarator_p
+ && (cp_parser_constructor_declarator_p
(parser, decl_specs->specs[(int) ds_friend] != 0)));
/* If we don't have a DECL_SPEC yet, then we must be looking at
if (cp_parser_parse_definitely (parser))
{
cp_declarator *declarator;
-
+
/* Parse another optional declarator. */
declarator = cp_parser_conversion_declarator_opt (parser);
-
+
/* Create the representation of the declarator. */
if (class_type)
declarator = make_ptrmem_declarator (cv_quals, class_type,
declarator = make_pointer_declarator (cv_quals, declarator);
else
declarator = make_reference_declarator (cv_quals, declarator);
-
+
return declarator;
}
parameter_declarator
= cp_parser_parameter_declaration (parser, /*template_parm_p=*/true,
/*parenthesized_p=*/NULL);
- return (build_tree_list
+ return (build_tree_list
(parameter_declarator->default_argument,
grokdeclarator (parameter_declarator->declarator,
¶meter_declarator->decl_specifiers,
- PARM, /*initialized=*/0,
+ PARM, /*initialized=*/0,
/*attrlist=*/NULL)));
}
(and must) do name-lookup normally. */
if (template_keyword_p
&& (!parser->scope
- || (TYPE_P (parser->scope)
+ || (TYPE_P (parser->scope)
&& dependent_type_p (parser->scope))))
return identifier;
}
extension_specifier
= cp_parser_storage_class_specifier_opt (parser);
if (!extension_specifier)
- extension_specifier
+ extension_specifier
= cp_parser_function_specifier_opt (parser,
/*decl_specs=*/NULL);
}
case RID_TYPENAME:
/* Look for an elaborated-type-specifier. */
- type_spec
- = (cp_parser_elaborated_type_specifier
+ type_spec
+ = (cp_parser_elaborated_type_specifier
(parser,
decl_specs && decl_specs->specs[(int) ds_friend],
is_declaration));
if (is_cv_qualifier)
*is_cv_qualifier = true;
break;
-
+
case RID_VOLATILE:
ds = ds_volatile;
if (is_cv_qualifier)
/* If we do not already have a type-specifier, assume we are looking
at a simple-type-specifier. */
- type_spec = cp_parser_simple_type_specifier (parser,
+ type_spec = cp_parser_simple_type_specifier (parser,
decl_specs,
flags);
appropriately updated. */
static tree
-cp_parser_simple_type_specifier (cp_parser* parser,
+cp_parser_simple_type_specifier (cp_parser* parser,
cp_decl_specifier_seq *decl_specs,
cp_parser_flags flags)
{
if (decl_specs)
cp_parser_set_decl_spec_type (decl_specs, type,
/*user_defined_p=*/true);
-
+
return type;
default:
&& token->keyword != RID_UNSIGNED
&& token->keyword != RID_SHORT
&& token->keyword != RID_LONG))
- cp_parser_set_decl_spec_type (decl_specs,
+ cp_parser_set_decl_spec_type (decl_specs,
type,
/*user_defined=*/false);
if (decl_specs)
else
type = cp_parser_type_name (parser);
/* Keep track of all name-lookups performed in class scopes. */
- if (type
+ if (type
&& !qualified_p
- && TREE_CODE (type) == TYPE_DECL
+ && TREE_CODE (type) == TYPE_DECL
&& TREE_CODE (DECL_NAME (type)) == IDENTIFIER_NODE)
maybe_note_name_used_in_class (DECL_NAME (type), type);
/* If it didn't work out, we don't have a TYPE. */
if (ctor_dtor_or_conv_p && declarator->u.id.sfk != sfk_none)
*ctor_dtor_or_conv_p = -1;
if (TREE_CODE (id) == SCOPE_REF
- && TREE_CODE (unqualified_name) == TYPE_DECL
+ && TREE_CODE (unqualified_name) == TYPE_DECL
&& CLASSTYPE_USE_TEMPLATE (TREE_TYPE (unqualified_name)))
{
error ("invalid use of constructor as a template");
inform ("use `%T::%D' instead of `%T::%T' to name the "
- "constructor in a qualified name", class_type,
+ "constructor in a qualified name", class_type,
DECL_NAME (TYPE_TI_TEMPLATE (class_type)),
class_type, class_type);
}
GNU Extension:
cv-qualifier:
- __restrict__
+ __restrict__
Returns a bitmask representing the cv-qualifiers. */
{
cp_token *token;
cp_cv_quals cv_qualifier;
-
+
/* Peek at the next token. */
token = cp_lexer_peek_token (parser->lexer);
/* See if it's a cv-qualifier. */
case RID_CONST:
cv_qualifier = TYPE_QUAL_CONST;
break;
-
+
case RID_VOLATILE:
cv_qualifier = TYPE_QUAL_VOLATILE;
break;
-
+
case RID_RESTRICT:
cv_qualifier = TYPE_QUAL_RESTRICT;
break;
-
+
default:
cv_qualifier = TYPE_UNQUALIFIED;
break;
}
-
+
if (!cv_qualifier)
break;
/* Check for attributes first. */
if (cp_lexer_next_token_is_keyword (parser->lexer, RID_ATTRIBUTE))
{
- type_specifier_seq->attributes =
+ type_specifier_seq->attributes =
chainon (type_specifier_seq->attributes,
cp_parser_attributes_opt (parser));
continue;
/* Finish the parameter list. */
if (parameters && ellipsis_p)
parameters->ellipsis_p = true;
-
+
return parameters;
}
parser->default_arg_ok_p = saved_default_arg_ok_p;
/* After the declarator, allow more attributes. */
decl_specifiers.attributes
- = chainon (decl_specifiers.attributes,
+ = chainon (decl_specifiers.attributes,
cp_parser_attributes_opt (parser));
}
assignment-expression. */
if (cp_lexer_next_token_is_not (parser->lexer, CPP_OPEN_BRACE))
{
- initializer
+ initializer
= cp_parser_constant_expression (parser,
/*allow_non_constant_p=*/true,
non_constant_p);
if (nested_name_specifier_p)
pop_p = push_scope (CP_DECL_CONTEXT (TYPE_MAIN_DECL (type)));
type = begin_class_definition (type);
-
+
if (type == error_mark_node)
/* If the type is erroneous, skip the entire body of the class. */
cp_parser_skip_to_closing_brace (parser);
else
/* Parse the member-specification. */
cp_parser_member_specification_opt (parser);
-
+
/* Look for the trailing `}'. */
cp_parser_require (parser, CPP_CLOSE_BRACE, "`}'");
/* We get better error messages by noticing a common problem: a
bool* nested_name_specifier_p,
tree *attributes_p)
{
- cp_token *token;
tree nested_name_specifier;
enum tag_types class_key;
tree id = NULL_TREE;
is valid. */
if (nested_name_specifier)
pop_p = push_scope (nested_name_specifier);
-
+
bases = NULL_TREE;
-
+
/* Get the list of base-classes, if there is one. */
if (cp_lexer_next_token_is (parser->lexer, CPP_COLON))
bases = cp_parser_base_clause (parser);
-
+
/* Process the base classes. */
xref_basetypes (type, bases);
A<T>::B will be represented by a TYPENAME_TYPE, and
therefore not recognized by check_tag_decl. */
- if (!type
+ if (!type
&& decl_specifiers.type
&& TYPE_P (decl_specifiers.type))
type = decl_specifiers.type;
attributes = chainon (prefix_attributes, attributes);
/* Create the bitfield declaration. */
- decl = grokbitfield (identifier
+ decl = grokbitfield (identifier
? make_id_declarator (identifier)
: NULL,
&decl_specifiers,
case cdk_pointer:
case cdk_reference:
case cdk_ptrmem:
- return (cp_parser_check_declarator_template_parameters
+ return (cp_parser_check_declarator_template_parameters
(parser, declarator->declarator));
case cdk_error:
/* Parse the right-hand side of the expression. */
rhs = (*fn) (parser);
/* Build the binary tree node. */
- lhs = build_x_binary_op (map_node->tree_type, lhs, rhs,
+ lhs = build_x_binary_op (map_node->tree_type, lhs, rhs,
&overloaded_p);
/* If the binary operator required the use of an
overloaded operator, then this expression cannot be an
permissible in an integral constant-expression if at
least one of the operands is of enumeration type. */
if (overloaded_p
- && (cp_parser_non_integral_constant_expression
+ && (cp_parser_non_integral_constant_expression
(parser, "calls to overloaded operators")))
lhs = error_mark_node;
break;
/* There are no access checks when parsing a template, as we do not
know if a specialization will be a friend. */
push_deferring_access_checks (dk_no_check);
-
+
decl = cp_parser_single_declaration (parser,
member_p,
&friend_p);
pop_deferring_access_checks ();
-
+
/* If this is a member template declaration, let the front
end know. */
if (member_p && !friend_p && decl)
cast = build_functional_cast (type, expression_list);
/* [expr.const]/1: In an integral constant expression "only type
conversions to integral or enumeration type can be used". */
- if (cast != error_mark_node && !type_dependent_expression_p (type)
+ if (cast != error_mark_node && !type_dependent_expression_p (type)
&& !INTEGRAL_OR_ENUMERATION_TYPE_P (TREE_TYPE (type)))
{
- if (cp_parser_non_integral_constant_expression
+ if (cp_parser_non_integral_constant_expression
(parser, "a call to a constructor"))
return error_mark_node;
}
bool user_defined_p)
{
decl_specs->any_specifiers_p = true;
-
+
/* If the user tries to redeclare a built-in type (with, for example,
in "typedef int wchar_t;") we remember that this is what
happened. In system headers, we ignore these declarations so
that G++ can work with system headers that are not C++-safe. */
- if (decl_specs->specs[(int) ds_typedef]
+ if (decl_specs->specs[(int) ds_typedef]
&& !user_defined_p
&& (decl_specs->type
|| decl_specs->specs[(int) ds_long]
c_lex_string_translate = -1;
cp_parser_cache_group_1 (parser, cache, end, depth);
-
+
c_lex_string_translate = saved_c_lex_string_translate;
}