Debian Codegraph @

clang/test/OpenMP/assume_template.cpp

raw
1 // RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=60 -ast-print %s | FileCheck %s
2 // RUN: %clang_cc1 -fopenmp -fopenmp-version=60 -x c++ -std=c++11 -emit-pch -o %t %s
3 // RUN: %clang_cc1 -fopenmp -fopenmp-version=60 -std=c++11 -include-pch %t -verify %s -ast-print | FileCheck %s
4 // expected-no-diagnostics
5
6 #ifndef HEADER
7 #define HEADER
8
9 extern int qux(int);
10
11 template<typename T>
12 int foo(T arg)
13 {
14 #pragma omp assume no_openmp_routines
15 {
16 auto fn = [](int x) { return qux(x); };
17 // CHECK: auto fn = [](int x) {
18 return fn(5);
19 }
20 #pragma omp assume no_openmp_constructs
21 {
22 auto fn = [](int x) { return qux(x); };
23 // CHECK: auto fn = [](int x) {
24 return fn(6);
25 }
26 }
27
28 template<typename T>
29 class C {
30 T m;
31
32 public:
33 T bar(T a);
34 };
35
36 // We're really just checking this parses. All the assumptions are thrown
37 // away immediately for now.
38 template<typename T>
39 T C<T>::bar(T a)
40 {
41 #pragma omp assume holds(sizeof(T) == 8) absent(parallel)
42 {
43 return (T)qux((int)a);
44 // CHECK: return (T)qux((int)a);
45 }
46 }
47
48 #endif