llvm-project/clang/test/OpenMP/assume_lambda.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

38 lines
790 B
C++

// RUN: %clang_cc1 -fopenmp -fopenmp-version=60 -x c++ -std=c++11 -ast-print %s | FileCheck %s
// expected-no-diagnostics
extern int bar(int);
int foo(int arg)
{
#pragma omp assume no_openmp_routines
{
auto fn = [](int x) { return bar(x); };
// CHECK: auto fn = [](int x) {
return fn(5);
}
#pragma omp assume no_openmp_constructs
{
auto fn = [](int x) { return bar(x); };
// CHECK: auto fn = [](int x) {
return fn(6);
}
}
class C {
public:
int foo(int a);
};
// We're really just checking that this parses. All the assumptions are thrown
// away immediately for now.
int C::foo(int a)
{
#pragma omp assume holds(sizeof(void*) == 8) absent(parallel)
{
auto fn = [](int x) { return bar(x); };
// CHECK: auto fn = [](int x) {
return fn(5);
}
}