]> git.ipfire.org Git - thirdparty/gcc.git/commit
OpenMP/C++: Store location in cp_parser_omp_var_list for kind=0
authorTobias Burnus <tburnus@baylibre.com>
Fri, 3 Jan 2025 09:12:32 +0000 (10:12 +0100)
committerTobias Burnus <tburnus@baylibre.com>
Fri, 3 Jan 2025 09:12:32 +0000 (10:12 +0100)
commitcf94ba812ca49608decbd1e28296f1b618c9c7d9
tree82e70f73a9ed42a8f9ad558f4795545a48847513
parent9a2f716765f2b7c69973995ae15a71c97401b2af
OpenMP/C++: Store location in cp_parser_omp_var_list for kind=0

cp_parser_omp_var_list and cp_parser_omp_var_list_no_open have a special
modus: kind = 0 alias kind = OMP_CLAUSE_ERROR, which returns a simple tree
list; however, for a decl, no location is associated with that variable,
yielding to confusing error locations. With this patch, also for kind=0,
a reasonable error location is stored, albeit with creating a tree node
(build_empty_stmt), which is otherwise not used.

gcc/cp/ChangeLog:

* parser.cc (cp_parser_omp_var_list_no_open,
cp_parser_omp_var_list): For kind=0 (= OMP_CLAUSE_ERROR),
store also the expression location in the tree list.
(cp_parser_oacc_data_clause_deviceptr,
cp_finish_omp_declare_variant): Use that location instead or
input_location/the before-parsing location.
* semantics.cc (finish_omp_threadprivate): Likewise.
gcc/cp/parser.cc
gcc/cp/semantics.cc