Commit 2263c9f2 by Thomas Schwinge Committed by Thomas Schwinge

[C, C++] Use correct location information for OpenACC shape and simple clauses

	gcc/c/
	* c-parser.c (c_parser_oacc_shape_clause): Add loc formal
	parameter.  Adjust all users.
	(c_parser_oacc_simple_clause): Replace parser with loc formal
	parameter.  Adjust all users.
	gcc/cp/
	* parser.c (cp_parser_oacc_simple_clause): Remove parser formal
	parameter, move loc formal parameter to the front.  Adjust all
	users.
	(cp_parser_oacc_shape_clause): Add loc formal parameter.  Adjust
	all users.

From-SVN: r269102
parent 81a5f36d
2019-02-22 Thomas Schwinge <thomas@codesourcery.com>
* c-parser.c (c_parser_oacc_shape_clause): Add loc formal
parameter. Adjust all users.
(c_parser_oacc_simple_clause): Replace parser with loc formal
parameter. Adjust all users.
2019-02-19 Chung-Lin Tang <cltang@codesourcery.com> 2019-02-19 Chung-Lin Tang <cltang@codesourcery.com>
PR c/87924 PR c/87924
......
...@@ -13159,12 +13159,12 @@ c_parser_oacc_single_int_clause (c_parser *parser, omp_clause_code code, ...@@ -13159,12 +13159,12 @@ c_parser_oacc_single_int_clause (c_parser *parser, omp_clause_code code,
*/ */
static tree static tree
c_parser_oacc_shape_clause (c_parser *parser, omp_clause_code kind, c_parser_oacc_shape_clause (c_parser *parser, location_t loc,
omp_clause_code kind,
const char *str, tree list) const char *str, tree list)
{ {
const char *id = "num"; const char *id = "num";
tree ops[2] = { NULL_TREE, NULL_TREE }, c; tree ops[2] = { NULL_TREE, NULL_TREE }, c;
location_t loc = c_parser_peek_token (parser)->location;
if (kind == OMP_CLAUSE_VECTOR) if (kind == OMP_CLAUSE_VECTOR)
id = "length"; id = "length";
...@@ -13296,12 +13296,12 @@ c_parser_oacc_shape_clause (c_parser *parser, omp_clause_code kind, ...@@ -13296,12 +13296,12 @@ c_parser_oacc_shape_clause (c_parser *parser, omp_clause_code kind,
seq */ seq */
static tree static tree
c_parser_oacc_simple_clause (c_parser *parser, enum omp_clause_code code, c_parser_oacc_simple_clause (location_t loc, enum omp_clause_code code,
tree list) tree list)
{ {
check_no_duplicate_clause (list, code, omp_clause_code_name[code]); check_no_duplicate_clause (list, code, omp_clause_code_name[code]);
tree c = build_omp_clause (c_parser_peek_token (parser)->location, code); tree c = build_omp_clause (loc, code);
OMP_CLAUSE_CHAIN (c) = list; OMP_CLAUSE_CHAIN (c) = list;
return c; return c;
...@@ -14807,8 +14807,8 @@ c_parser_oacc_all_clauses (c_parser *parser, omp_clause_mask mask, ...@@ -14807,8 +14807,8 @@ c_parser_oacc_all_clauses (c_parser *parser, omp_clause_mask mask,
c_name = "async"; c_name = "async";
break; break;
case PRAGMA_OACC_CLAUSE_AUTO: case PRAGMA_OACC_CLAUSE_AUTO:
clauses = c_parser_oacc_simple_clause (parser, OMP_CLAUSE_AUTO, clauses = c_parser_oacc_simple_clause (here, OMP_CLAUSE_AUTO,
clauses); clauses);
c_name = "auto"; c_name = "auto";
break; break;
case PRAGMA_OACC_CLAUSE_COLLAPSE: case PRAGMA_OACC_CLAUSE_COLLAPSE:
...@@ -14852,7 +14852,7 @@ c_parser_oacc_all_clauses (c_parser *parser, omp_clause_mask mask, ...@@ -14852,7 +14852,7 @@ c_parser_oacc_all_clauses (c_parser *parser, omp_clause_mask mask,
c_name = "device_resident"; c_name = "device_resident";
break; break;
case PRAGMA_OACC_CLAUSE_FINALIZE: case PRAGMA_OACC_CLAUSE_FINALIZE:
clauses = c_parser_oacc_simple_clause (parser, OMP_CLAUSE_FINALIZE, clauses = c_parser_oacc_simple_clause (here, OMP_CLAUSE_FINALIZE,
clauses); clauses);
c_name = "finalize"; c_name = "finalize";
break; break;
...@@ -14862,7 +14862,7 @@ c_parser_oacc_all_clauses (c_parser *parser, omp_clause_mask mask, ...@@ -14862,7 +14862,7 @@ c_parser_oacc_all_clauses (c_parser *parser, omp_clause_mask mask,
break; break;
case PRAGMA_OACC_CLAUSE_GANG: case PRAGMA_OACC_CLAUSE_GANG:
c_name = "gang"; c_name = "gang";
clauses = c_parser_oacc_shape_clause (parser, OMP_CLAUSE_GANG, clauses = c_parser_oacc_shape_clause (parser, here, OMP_CLAUSE_GANG,
c_name, clauses); c_name, clauses);
break; break;
case PRAGMA_OACC_CLAUSE_HOST: case PRAGMA_OACC_CLAUSE_HOST:
...@@ -14874,13 +14874,13 @@ c_parser_oacc_all_clauses (c_parser *parser, omp_clause_mask mask, ...@@ -14874,13 +14874,13 @@ c_parser_oacc_all_clauses (c_parser *parser, omp_clause_mask mask,
c_name = "if"; c_name = "if";
break; break;
case PRAGMA_OACC_CLAUSE_IF_PRESENT: case PRAGMA_OACC_CLAUSE_IF_PRESENT:
clauses = c_parser_oacc_simple_clause (parser, OMP_CLAUSE_IF_PRESENT, clauses = c_parser_oacc_simple_clause (here, OMP_CLAUSE_IF_PRESENT,
clauses); clauses);
c_name = "if_present"; c_name = "if_present";
break; break;
case PRAGMA_OACC_CLAUSE_INDEPENDENT: case PRAGMA_OACC_CLAUSE_INDEPENDENT:
clauses = c_parser_oacc_simple_clause (parser, OMP_CLAUSE_INDEPENDENT, clauses = c_parser_oacc_simple_clause (here, OMP_CLAUSE_INDEPENDENT,
clauses); clauses);
c_name = "independent"; c_name = "independent";
break; break;
case PRAGMA_OACC_CLAUSE_LINK: case PRAGMA_OACC_CLAUSE_LINK:
...@@ -14914,7 +14914,7 @@ c_parser_oacc_all_clauses (c_parser *parser, omp_clause_mask mask, ...@@ -14914,7 +14914,7 @@ c_parser_oacc_all_clauses (c_parser *parser, omp_clause_mask mask,
c_name = "reduction"; c_name = "reduction";
break; break;
case PRAGMA_OACC_CLAUSE_SEQ: case PRAGMA_OACC_CLAUSE_SEQ:
clauses = c_parser_oacc_simple_clause (parser, OMP_CLAUSE_SEQ, clauses = c_parser_oacc_simple_clause (here, OMP_CLAUSE_SEQ,
clauses); clauses);
c_name = "seq"; c_name = "seq";
break; break;
...@@ -14928,7 +14928,7 @@ c_parser_oacc_all_clauses (c_parser *parser, omp_clause_mask mask, ...@@ -14928,7 +14928,7 @@ c_parser_oacc_all_clauses (c_parser *parser, omp_clause_mask mask,
break; break;
case PRAGMA_OACC_CLAUSE_VECTOR: case PRAGMA_OACC_CLAUSE_VECTOR:
c_name = "vector"; c_name = "vector";
clauses = c_parser_oacc_shape_clause (parser, OMP_CLAUSE_VECTOR, clauses = c_parser_oacc_shape_clause (parser, here, OMP_CLAUSE_VECTOR,
c_name, clauses); c_name, clauses);
break; break;
case PRAGMA_OACC_CLAUSE_VECTOR_LENGTH: case PRAGMA_OACC_CLAUSE_VECTOR_LENGTH:
...@@ -14943,7 +14943,7 @@ c_parser_oacc_all_clauses (c_parser *parser, omp_clause_mask mask, ...@@ -14943,7 +14943,7 @@ c_parser_oacc_all_clauses (c_parser *parser, omp_clause_mask mask,
break; break;
case PRAGMA_OACC_CLAUSE_WORKER: case PRAGMA_OACC_CLAUSE_WORKER:
c_name = "worker"; c_name = "worker";
clauses = c_parser_oacc_shape_clause (parser, OMP_CLAUSE_WORKER, clauses = c_parser_oacc_shape_clause (parser, here, OMP_CLAUSE_WORKER,
c_name, clauses); c_name, clauses);
break; break;
default: default:
......
2019-02-22 Thomas Schwinge <thomas@codesourcery.com>
* parser.c (cp_parser_oacc_simple_clause): Remove parser formal
parameter, move loc formal parameter to the front. Adjust all
users.
(cp_parser_oacc_shape_clause): Add loc formal parameter. Adjust
all users.
2019-02-21 Jason Merrill <jason@redhat.com> 2019-02-21 Jason Merrill <jason@redhat.com>
PR c++/87685 - generic lambda 'this' capture error. PR c++/87685 - generic lambda 'this' capture error.
......
...@@ -32595,13 +32595,14 @@ cp_parser_oacc_data_clause_deviceptr (cp_parser *parser, tree list) ...@@ -32595,13 +32595,14 @@ cp_parser_oacc_data_clause_deviceptr (cp_parser *parser, tree list)
seq */ seq */
static tree static tree
cp_parser_oacc_simple_clause (cp_parser * /* parser */, cp_parser_oacc_simple_clause (location_t loc, enum omp_clause_code code,
enum omp_clause_code code, tree list)
tree list, location_t location)
{ {
check_no_duplicate_clause (list, code, omp_clause_code_name[code], location); check_no_duplicate_clause (list, code, omp_clause_code_name[code], loc);
tree c = build_omp_clause (location, code);
tree c = build_omp_clause (loc, code);
OMP_CLAUSE_CHAIN (c) = list; OMP_CLAUSE_CHAIN (c) = list;
return c; return c;
} }
...@@ -32657,13 +32658,13 @@ cp_parser_oacc_single_int_clause (cp_parser *parser, omp_clause_code code, ...@@ -32657,13 +32658,13 @@ cp_parser_oacc_single_int_clause (cp_parser *parser, omp_clause_code code,
*/ */
static tree static tree
cp_parser_oacc_shape_clause (cp_parser *parser, omp_clause_code kind, cp_parser_oacc_shape_clause (cp_parser *parser, location_t loc,
omp_clause_code kind,
const char *str, tree list) const char *str, tree list)
{ {
const char *id = "num"; const char *id = "num";
cp_lexer *lexer = parser->lexer; cp_lexer *lexer = parser->lexer;
tree ops[2] = { NULL_TREE, NULL_TREE }, c; tree ops[2] = { NULL_TREE, NULL_TREE }, c;
location_t loc = cp_lexer_peek_token (lexer)->location;
if (kind == OMP_CLAUSE_VECTOR) if (kind == OMP_CLAUSE_VECTOR)
id = "length"; id = "length";
...@@ -34884,8 +34885,8 @@ cp_parser_oacc_all_clauses (cp_parser *parser, omp_clause_mask mask, ...@@ -34884,8 +34885,8 @@ cp_parser_oacc_all_clauses (cp_parser *parser, omp_clause_mask mask,
c_name = "async"; c_name = "async";
break; break;
case PRAGMA_OACC_CLAUSE_AUTO: case PRAGMA_OACC_CLAUSE_AUTO:
clauses = cp_parser_oacc_simple_clause (parser, OMP_CLAUSE_AUTO, clauses = cp_parser_oacc_simple_clause (here, OMP_CLAUSE_AUTO,
clauses, here); clauses);
c_name = "auto"; c_name = "auto";
break; break;
case PRAGMA_OACC_CLAUSE_COLLAPSE: case PRAGMA_OACC_CLAUSE_COLLAPSE:
...@@ -34929,8 +34930,8 @@ cp_parser_oacc_all_clauses (cp_parser *parser, omp_clause_mask mask, ...@@ -34929,8 +34930,8 @@ cp_parser_oacc_all_clauses (cp_parser *parser, omp_clause_mask mask,
c_name = "device_resident"; c_name = "device_resident";
break; break;
case PRAGMA_OACC_CLAUSE_FINALIZE: case PRAGMA_OACC_CLAUSE_FINALIZE:
clauses = cp_parser_oacc_simple_clause (parser, OMP_CLAUSE_FINALIZE, clauses = cp_parser_oacc_simple_clause (here, OMP_CLAUSE_FINALIZE,
clauses, here); clauses);
c_name = "finalize"; c_name = "finalize";
break; break;
case PRAGMA_OACC_CLAUSE_FIRSTPRIVATE: case PRAGMA_OACC_CLAUSE_FIRSTPRIVATE:
...@@ -34940,7 +34941,7 @@ cp_parser_oacc_all_clauses (cp_parser *parser, omp_clause_mask mask, ...@@ -34940,7 +34941,7 @@ cp_parser_oacc_all_clauses (cp_parser *parser, omp_clause_mask mask,
break; break;
case PRAGMA_OACC_CLAUSE_GANG: case PRAGMA_OACC_CLAUSE_GANG:
c_name = "gang"; c_name = "gang";
clauses = cp_parser_oacc_shape_clause (parser, OMP_CLAUSE_GANG, clauses = cp_parser_oacc_shape_clause (parser, here, OMP_CLAUSE_GANG,
c_name, clauses); c_name, clauses);
break; break;
case PRAGMA_OACC_CLAUSE_HOST: case PRAGMA_OACC_CLAUSE_HOST:
...@@ -34952,15 +34953,13 @@ cp_parser_oacc_all_clauses (cp_parser *parser, omp_clause_mask mask, ...@@ -34952,15 +34953,13 @@ cp_parser_oacc_all_clauses (cp_parser *parser, omp_clause_mask mask,
c_name = "if"; c_name = "if";
break; break;
case PRAGMA_OACC_CLAUSE_IF_PRESENT: case PRAGMA_OACC_CLAUSE_IF_PRESENT:
clauses = cp_parser_oacc_simple_clause (parser, clauses = cp_parser_oacc_simple_clause (here, OMP_CLAUSE_IF_PRESENT,
OMP_CLAUSE_IF_PRESENT, clauses);
clauses, here);
c_name = "if_present"; c_name = "if_present";
break; break;
case PRAGMA_OACC_CLAUSE_INDEPENDENT: case PRAGMA_OACC_CLAUSE_INDEPENDENT:
clauses = cp_parser_oacc_simple_clause (parser, clauses = cp_parser_oacc_simple_clause (here, OMP_CLAUSE_INDEPENDENT,
OMP_CLAUSE_INDEPENDENT, clauses);
clauses, here);
c_name = "independent"; c_name = "independent";
break; break;
case PRAGMA_OACC_CLAUSE_LINK: case PRAGMA_OACC_CLAUSE_LINK:
...@@ -34995,8 +34994,8 @@ cp_parser_oacc_all_clauses (cp_parser *parser, omp_clause_mask mask, ...@@ -34995,8 +34994,8 @@ cp_parser_oacc_all_clauses (cp_parser *parser, omp_clause_mask mask,
c_name = "reduction"; c_name = "reduction";
break; break;
case PRAGMA_OACC_CLAUSE_SEQ: case PRAGMA_OACC_CLAUSE_SEQ:
clauses = cp_parser_oacc_simple_clause (parser, OMP_CLAUSE_SEQ, clauses = cp_parser_oacc_simple_clause (here, OMP_CLAUSE_SEQ,
clauses, here); clauses);
c_name = "seq"; c_name = "seq";
break; break;
case PRAGMA_OACC_CLAUSE_TILE: case PRAGMA_OACC_CLAUSE_TILE:
...@@ -35010,7 +35009,8 @@ cp_parser_oacc_all_clauses (cp_parser *parser, omp_clause_mask mask, ...@@ -35010,7 +35009,8 @@ cp_parser_oacc_all_clauses (cp_parser *parser, omp_clause_mask mask,
break; break;
case PRAGMA_OACC_CLAUSE_VECTOR: case PRAGMA_OACC_CLAUSE_VECTOR:
c_name = "vector"; c_name = "vector";
clauses = cp_parser_oacc_shape_clause (parser, OMP_CLAUSE_VECTOR, clauses = cp_parser_oacc_shape_clause (parser, here,
OMP_CLAUSE_VECTOR,
c_name, clauses); c_name, clauses);
break; break;
case PRAGMA_OACC_CLAUSE_VECTOR_LENGTH: case PRAGMA_OACC_CLAUSE_VECTOR_LENGTH:
...@@ -35025,7 +35025,8 @@ cp_parser_oacc_all_clauses (cp_parser *parser, omp_clause_mask mask, ...@@ -35025,7 +35025,8 @@ cp_parser_oacc_all_clauses (cp_parser *parser, omp_clause_mask mask,
break; break;
case PRAGMA_OACC_CLAUSE_WORKER: case PRAGMA_OACC_CLAUSE_WORKER:
c_name = "worker"; c_name = "worker";
clauses = cp_parser_oacc_shape_clause (parser, OMP_CLAUSE_WORKER, clauses = cp_parser_oacc_shape_clause (parser, here,
OMP_CLAUSE_WORKER,
c_name, clauses); c_name, clauses);
break; break;
default: default:
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment