]> granicus.if.org Git - clang/commit
[OpenMP] Replace predetermined shared for const variable
authorJoel E. Denny <jdenny.ornl@gmail.com>
Fri, 4 Jan 2019 22:11:31 +0000 (22:11 +0000)
committerJoel E. Denny <jdenny.ornl@gmail.com>
Fri, 4 Jan 2019 22:11:31 +0000 (22:11 +0000)
commitf21e62190820e0ae3570ba617043e42a64c1582b
treefdea367f7696c109cc61b35203b77e998a2dde03
parenta615149ee4fd2b6d97dc029c8827e42b025e1379
[OpenMP] Replace predetermined shared for const variable

The following appears in OpenMP 3.1 sec. 2.9.1.1 as a predetermined
data-sharing attribute:

> Variables with const-qualified type having no mutable member are
> shared.

It does not appear in OpenmP 4.0, 4.5, or 5.0.  This patch removes the
implementation of that attribute when the requested OpenMP version is
greater than 3.1.

One effect of that removal is that `default(none)` affects const
variables without mutable members.

Also, without this patch, if a const variable without mutable members
was explicitly lastprivate or private, it was an error because it was
predetermined shared.  Now, clang instead complains that it's const
without mutable fields, which is a more intelligible diagnostic.  That
should be fine for all of the above versions because they all have
something like the following, which is quoted from OpenMP 5.0
sec. 2.19.3:

> A variable that is privatized must not have a const-qualified type
> unless it is of class type with a mutable member. This restriction does
> not apply to the firstprivate clause.

reduction and linear clauses already have separate checks for const
variables.  Future patches will merge the implementations.

Reviewed By: ABataev

Differential Revision: https://reviews.llvm.org/D56113

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@350439 91177308-0d34-0410-b5e6-96231b3b80d8
40 files changed:
include/clang/Basic/DiagnosticSemaKinds.td
lib/Sema/SemaOpenMP.cpp
test/OpenMP/distribute_parallel_for_lastprivate_messages.cpp
test/OpenMP/distribute_parallel_for_simd_lastprivate_messages.cpp
test/OpenMP/distribute_private_messages.cpp
test/OpenMP/distribute_simd_lastprivate_messages.cpp
test/OpenMP/for_lastprivate_messages.cpp
test/OpenMP/for_simd_lastprivate_messages.cpp
test/OpenMP/parallel_default_messages.cpp
test/OpenMP/parallel_for_lastprivate_messages.cpp
test/OpenMP/parallel_for_simd_lastprivate_messages.cpp
test/OpenMP/parallel_private_messages.cpp
test/OpenMP/parallel_sections_lastprivate_messages.cpp
test/OpenMP/sections_lastprivate_messages.cpp
test/OpenMP/simd_lastprivate_messages.cpp
test/OpenMP/target_parallel_for_lastprivate_messages.cpp
test/OpenMP/target_parallel_for_simd_lastprivate_messages.cpp
test/OpenMP/target_parallel_private_messages.cpp
test/OpenMP/target_simd_lastprivate_messages.cpp
test/OpenMP/target_teams_distribute_lastprivate_messages.cpp
test/OpenMP/target_teams_distribute_parallel_for_lastprivate_messages.cpp
test/OpenMP/target_teams_distribute_parallel_for_private_messages.cpp
test/OpenMP/target_teams_distribute_parallel_for_simd_lastprivate_messages.cpp
test/OpenMP/target_teams_distribute_parallel_for_simd_private_messages.cpp
test/OpenMP/target_teams_distribute_private_messages.cpp
test/OpenMP/target_teams_distribute_simd_lastprivate_messages.cpp
test/OpenMP/target_teams_distribute_simd_private_messages.cpp
test/OpenMP/target_teams_private_messages.cpp
test/OpenMP/task_private_messages.cpp
test/OpenMP/taskloop_lastprivate_messages.cpp
test/OpenMP/taskloop_simd_lastprivate_messages.cpp
test/OpenMP/teams_distribute_lastprivate_messages.cpp
test/OpenMP/teams_distribute_parallel_for_lastprivate_messages.cpp
test/OpenMP/teams_distribute_parallel_for_private_messages.cpp
test/OpenMP/teams_distribute_parallel_for_simd_lastprivate_messages.cpp
test/OpenMP/teams_distribute_parallel_for_simd_private_messages.cpp
test/OpenMP/teams_distribute_private_messages.cpp
test/OpenMP/teams_distribute_simd_lastprivate_messages.cpp
test/OpenMP/teams_distribute_simd_private_messages.cpp
test/OpenMP/teams_private_messages.cpp