If KIND is nonzero, create the appropriate node and install the decl
in OMP_CLAUSE_DECL and add the node to the head of the list.
- If KIND is zero, create a TREE_LIST with the decl in TREE_PURPOSE;
- return the list created.
+ If KIND is zero (= OMP_CLAUSE_ERROR), create a TREE_LIST with the decl
+ in TREE_PURPOSE and the location in TREE_VALUE (accessible using
+ EXPR_LOCATION); return the list created.
COLON can be NULL if only closing parenthesis should end the list,
or pointer to bool which will receive false if the list is terminated
goto build_clause;
}
token = cp_lexer_peek_token (parser->lexer);
- if (kind != 0
+ if (kind != 0 /* kind != OMP_CLAUSE_ERROR */
&& cp_parser_is_keyword (token, RID_THIS))
{
decl = finish_this_expr ();
decl = process_outer_var_ref (decl, tf_warning_or_error);
if (decl == error_mark_node)
;
- else if (kind != 0)
+ else if (kind != 0) /* kind != OMP_CLAUSE_ERROR */
{
switch (kind)
{
OMP_CLAUSE_CHAIN (u) = list;
list = u;
}
- else
- list = tree_cons (decl, NULL_TREE, list);
+ else /* kind == 0 alias kind == OMP_CLAUSE_ERROR */
+ list = tree_cons (decl, build_empty_stmt (token->location), list);
get_comma:
if (cp_lexer_next_token_is_not (parser->lexer, CPP_COMMA))
{
if (parser->lexer->in_omp_decl_attribute)
{
+ location_t loc = cp_lexer_peek_token (parser->lexer)->location;
if (kind)
{
- location_t loc = cp_lexer_peek_token (parser->lexer)->location;
tree u = build_omp_clause (loc, kind);
OMP_CLAUSE_DECL (u) = parser->lexer->in_omp_decl_attribute;
OMP_CLAUSE_CHAIN (u) = list;
return u;
}
- else
- return tree_cons (parser->lexer->in_omp_decl_attribute, NULL_TREE,
- list);
+ else /* kind == OMP_CLAUSE_ERROR */
+ return tree_cons (parser->lexer->in_omp_decl_attribute,
+ build_empty_stmt (loc), list);
}
if (cp_parser_require (parser, CPP_OPEN_PAREN, RT_OPEN_PAREN))
static tree
cp_parser_oacc_data_clause_deviceptr (cp_parser *parser, tree list)
{
- location_t loc = cp_lexer_peek_token (parser->lexer)->location;
tree vars, t;
/* Can't use OMP_CLAUSE_MAP here (that is, can't use the generic
for (t = vars; t; t = TREE_CHAIN (t))
{
tree v = TREE_PURPOSE (t);
+ location_t loc = EXPR_LOCATION (TREE_VALUE (t));
tree u = build_omp_clause (loc, OMP_CLAUSE_MAP);
OMP_CLAUSE_SET_MAP_KIND (u, GOMP_MAP_FORCE_DEVICEPTR);
OMP_CLAUSE_DECL (u) = v;
{
cp_lexer_consume_token (parser->lexer); // need_device_ptr
cp_lexer_consume_token (parser->lexer); // :
- location_t arg_loc
- = cp_lexer_peek_token (parser->lexer)->location;
tree arg;
tree list
for (tree c = list; c != NULL_TREE; c = TREE_CHAIN (c))
{
tree decl = TREE_PURPOSE (c);
+ location_t arg_loc = EXPR_LOCATION (TREE_VALUE (c));
int idx;
for (arg = parms, idx = 0; arg != NULL;
arg = TREE_CHAIN (arg), idx++)
arg = TREE_VALUE (arg);
if (adjust_args_list.contains (arg))
{
- // TODO fix location
error_at (arg_loc, "%qD is specified more than once",
decl);
continue;
for (t = vars; t; t = TREE_CHAIN (t))
{
tree v = TREE_PURPOSE (t);
+ location_t loc = EXPR_LOCATION (TREE_VALUE (t));
if (error_operand_p (v))
;
else if (!VAR_P (v))
- error ("%<threadprivate%> %qD is not file, namespace "
- "or block scope variable", v);
+ error_at (loc, "%<threadprivate%> %qD is not file, namespace "
+ "or block scope variable", v);
/* If V had already been marked threadprivate, it doesn't matter
whether it had been used prior to this point. */
else if (TREE_USED (v)
&& (DECL_LANG_SPECIFIC (v) == NULL
|| !CP_DECL_THREADPRIVATE_P (v)))
- error ("%qE declared %<threadprivate%> after first use", v);
+ error_at (loc, "%qE declared %<threadprivate%> after first use", v);
else if (! TREE_STATIC (v) && ! DECL_EXTERNAL (v))
- error ("automatic variable %qE cannot be %<threadprivate%>", v);
+ error_at (loc, "automatic variable %qE cannot be %<threadprivate%>", v);
else if (! COMPLETE_TYPE_P (complete_type (TREE_TYPE (v))))
- error ("%<threadprivate%> %qE has incomplete type", v);
+ error_at (loc, "%<threadprivate%> %qE has incomplete type", v);
else if (TREE_STATIC (v) && TYPE_P (CP_DECL_CONTEXT (v))
&& CP_DECL_CONTEXT (v) != current_class_type)
- error ("%<threadprivate%> %qE directive not "
- "in %qT definition", v, CP_DECL_CONTEXT (v));
+ error_at (loc, "%<threadprivate%> %qE directive not "
+ "in %qT definition", v, CP_DECL_CONTEXT (v));
else
{
/* Allocate a LANG_SPECIFIC structure for V, if needed. */