llvm-project/clang/test/OpenMP/begin_declare_variant_executable_scope.c
Johannes Doerfert 53fe3df0f6
[OpenMP] Allow begin/end declare variant in executable context (#139344)
We are missing a few declerative directives in the parser for executable
and declerative directives causing us to error out if they are inside of
functions. This adds support for begin/end declare variant by reusing
the logic we used in global scope.
2025-05-12 09:06:03 -07:00

24 lines
737 B
C

// RUN: %clang_cc1 -triple=x86_64-pc-win32 -verify -fopenmp -x c -std=c99 -fms-extensions -Wno-pragma-pack %s
// RUN: %clang_cc1 -triple=x86_64-pc-win32 -verify -fopenmp-simd -x c -std=c99 -fms-extensions -Wno-pragma-pack %s
// expected-no-diagnostics
#pragma omp begin declare variant match(implementation={vendor(ibm)})
void f(int);
#pragma omp end declare variant
#pragma omp begin declare variant match(implementation={vendor(llvm)})
void f(void);
#pragma omp end declare variant
int main() {
#pragma omp begin declare variant match(implementation={vendor(ibm)})
int i = 0;
f(i);
#pragma omp end declare variant
#pragma omp begin declare variant match(implementation={vendor(llvm)})
f();
#pragma omp end declare variant
}