Clang Project

clang_source_code/test/OpenMP/constexpr_codegen.cpp
1// RUN: %clang_cc1 -verify -fopenmp -std=c++11 -triple x86_64-unknown-unknown -x c++ -emit-llvm %s -fexceptions -fcxx-exceptions -o - | FileCheck %s
2// RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -triple x86_64-unknown-unknown -fexceptions -fcxx-exceptions -emit-pch -o %t %s
3// RUN: %clang_cc1 -fopenmp -x c++ -triple x86_64-unknown-unknown -fexceptions -fcxx-exceptions -debug-info-kind=limited -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s
4
5// RUN: %clang_cc1 -verify -fopenmp-simd -std=c++11 -triple x86_64-unknown-unknown -x c++ -emit-llvm %s -fexceptions -fcxx-exceptions -o - | FileCheck --check-prefix SIMD-ONLY1 %s
6// RUN: %clang_cc1 -fopenmp-simd -x c++ -std=c++11 -triple x86_64-unknown-unknown -fexceptions -fcxx-exceptions -emit-pch -o %t %s
7// RUN: %clang_cc1 -fopenmp-simd -x c++ -triple x86_64-unknown-unknown -fexceptions -fcxx-exceptions -debug-info-kind=limited -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY1 %s
8// SIMD-ONLY1-NOT: {{__kmpc|__tgt}}
9
10// expected-no-diagnostics
11//
12#ifndef HEADER
13#define HEADER
14
15// CHECK: @{{.*}}Foo{{.*}}bar{{.*}} = constant i32 1,
16
17// Section A - Define a class with a static constexpr data member.
18struct Foo {
19  static constexpr int bar = 1;
20};
21
22// Section B - ODR-use the data member.
23void F(const int &);
24void Test() { F(Foo::bar); }
25
26// Section C - Define the data member.
27constexpr int Foo::bar;
28#endif
29
30