llvm-project/clang/test/OpenMP/assume_template.cpp
David Pagan a5fc7c3ac1
[clang][OpenMP] New OpenMP 6.0 assumption clause, 'no_openmp_constructs' (#125933)
Add initial parsing/sema support for new assumption clause so clause can
be specified. For now, it's ignored, just like the others.

Added support for 'no_openmp_construct' to release notes.

Testing
- Updated appropriate LIT tests.
- Testing: check-all
2025-02-06 12:41:10 -08:00

49 lines
1.0 KiB
C++

// RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=60 -ast-print %s | FileCheck %s
// RUN: %clang_cc1 -fopenmp -fopenmp-version=60 -x c++ -std=c++11 -emit-pch -o %t %s
// RUN: %clang_cc1 -fopenmp -fopenmp-version=60 -std=c++11 -include-pch %t -verify %s -ast-print | FileCheck %s
// expected-no-diagnostics
#ifndef HEADER
#define HEADER
extern int qux(int);
template<typename T>
int foo(T arg)
{
#pragma omp assume no_openmp_routines
{
auto fn = [](int x) { return qux(x); };
// CHECK: auto fn = [](int x) {
return fn(5);
}
#pragma omp assume no_openmp_constructs
{
auto fn = [](int x) { return qux(x); };
// CHECK: auto fn = [](int x) {
return fn(6);
}
}
template<typename T>
class C {
T m;
public:
T bar(T a);
};
// We're really just checking this parses. All the assumptions are thrown
// away immediately for now.
template<typename T>
T C<T>::bar(T a)
{
#pragma omp assume holds(sizeof(T) == 8) absent(parallel)
{
return (T)qux((int)a);
// CHECK: return (T)qux((int)a);
}
}
#endif