summaryrefslogtreecommitdiffstats
path: root/clang/test/OpenMP/allocate_allocator_messages.cpp
diff options
context:
space:
mode:
authorAlexey Bataev <a.bataev@hotmail.com>2019-03-19 20:33:44 +0000
committerAlexey Bataev <a.bataev@hotmail.com>2019-03-19 20:33:44 +0000
commit282555ad826818b10e85defbc56e2eb51782c941 (patch)
tree50bc9e09e8fd4abf70f9eb903b5bf55b5e998775 /clang/test/OpenMP/allocate_allocator_messages.cpp
parenta0feccdf5692389920206444aea6b34105554c7f (diff)
downloadbcm5719-llvm-282555ad826818b10e85defbc56e2eb51782c941.tar.gz
bcm5719-llvm-282555ad826818b10e85defbc56e2eb51782c941.zip
[OPENMP]Warn if the different allocator is used for the variable.
If the allocator was specified for the variable and next one is found with the different allocator, the warning is emitted, and the allocator is ignored. llvm-svn: 356513
Diffstat (limited to 'clang/test/OpenMP/allocate_allocator_messages.cpp')
-rw-r--r--clang/test/OpenMP/allocate_allocator_messages.cpp17
1 files changed, 14 insertions, 3 deletions
diff --git a/clang/test/OpenMP/allocate_allocator_messages.cpp b/clang/test/OpenMP/allocate_allocator_messages.cpp
index b5af2b5f71c..db7d53d2f2c 100644
--- a/clang/test/OpenMP/allocate_allocator_messages.cpp
+++ b/clang/test/OpenMP/allocate_allocator_messages.cpp
@@ -14,16 +14,27 @@ int sss;
#pragma omp allocate(sss) allocator(0,sss) // expected-error {{expected ')'}} expected-error {{omp_allocator_handle_t type not found; include <omp.h>}} expected-note {{to match this '('}}
#pragma omp allocate(sss) allocator(sss) // expected-error {{omp_allocator_handle_t type not found; include <omp.h>}}
-typedef void *omp_allocator_handle_t;
+typedef void **omp_allocator_handle_t;
+extern const omp_allocator_handle_t omp_thread_mem_alloc;
+extern const omp_allocator_handle_t omp_high_bw_mem_alloc;
struct St1{
int a;
static int b;
-#pragma omp allocate(b) allocator(sss) // expected-error {{initializing 'omp_allocator_handle_t' (aka 'void *') with an expression of incompatible type 'int'}}
+#pragma omp allocate(b) allocator(sss) // expected-error {{initializing 'omp_allocator_handle_t' (aka 'void **') with an expression of incompatible type 'int'}} expected-note {{previous allocator is specified here}}
+#pragma omp allocate(b)
+#pragma omp allocate(b) allocator(omp_thread_mem_alloc) // expected-warning {{allocate directive specifies 'omp_thread_mem_alloc' allocator while previously used default}}
} d; // expected-note 2 {{'d' defined here}}
// expected-error@+1 {{expected one of the predefined allocators for the variables with the static storage: 'omp_default_mem_alloc', 'omp_large_cap_mem_alloc', 'omp_const_mem_alloc', 'omp_high_bw_mem_alloc', 'omp_low_lat_mem_alloc', 'omp_cgroup_mem_alloc', 'omp_pteam_mem_alloc' or 'omp_thread_mem_alloc'}}
#pragma omp allocate(d) allocator(nullptr)
-extern void *allocator;
+extern void **allocator;
// expected-error@+1 {{expected one of the predefined allocators for the variables with the static storage: 'omp_default_mem_alloc', 'omp_large_cap_mem_alloc', 'omp_const_mem_alloc', 'omp_high_bw_mem_alloc', 'omp_low_lat_mem_alloc', 'omp_cgroup_mem_alloc', 'omp_pteam_mem_alloc' or 'omp_thread_mem_alloc'}}
#pragma omp allocate(d) allocator(allocator)
+#pragma omp allocate(d) allocator(omp_thread_mem_alloc) // expected-note {{previous allocator is specified here}}
+#pragma omp allocate(d) // expected-warning {{allocate directive specifies default allocator while previously used 'omp_thread_mem_alloc'}}
+
+int c;
+#pragma omp allocate(c) allocator(omp_thread_mem_alloc) // expected-note {{previous allocator is specified here}}
+#pragma omp allocate(c) allocator(omp_high_bw_mem_alloc) // expected-warning {{allocate directive specifies 'omp_high_bw_mem_alloc' allocator while previously used 'omp_thread_mem_alloc'}}
+
OpenPOWER on IntegriCloud