1 // RUN: %clang_cc1 -verify -fopenmp -x c++ -triple %itanium_abi_triple -emit-llvm %s -fexceptions -fcxx-exceptions -o - -fsanitize-address-use-after-scope | FileCheck %s 2 // RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -triple %itanium_abi_triple -fexceptions -fcxx-exceptions -emit-pch -o %t -fopenmp-version=50 %s 3 // RUN: %clang_cc1 -fopenmp -x c++ -triple %itanium_abi_triple -fexceptions -fcxx-exceptions -std=c++11 -include-pch %t -verify %s -emit-llvm -o - -fopenmp-version=50 | FileCheck %s 4 // expected-no-diagnostics 5 6 // CHECK-NOT: ret i32 {{1|4}} 7 // CHECK-DAG: @_Z3barv = {{.*}}alias i32 (), i32 ()* @_Z3foov 8 // CHECK-DAG: @_ZN16SpecSpecialFuncs6MethodEv = {{.*}}alias i32 (%struct.SpecSpecialFuncs*), i32 (%struct.SpecSpecialFuncs*)* @_ZN16SpecSpecialFuncs7method_Ev 9 // CHECK-DAG: @_ZN16SpecSpecialFuncs6methodEv = linkonce_odr {{.*}}alias i32 (%struct.SpecSpecialFuncs*), i32 (%struct.SpecSpecialFuncs*)* @_ZN16SpecSpecialFuncs7method_Ev 10 // CHECK-DAG: @_ZN12SpecialFuncs6methodEv = linkonce_odr {{.*}}alias i32 (%struct.SpecialFuncs*), i32 (%struct.SpecialFuncs*)* @_ZN12SpecialFuncs7method_Ev 11 // CHECK-DAG: @_Z4callv = {{.*}}alias i32 (), i32 ()* @_Z4testv 12 // CHECK-DAG: @_ZL9stat_usedv = internal alias i32 (), i32 ()* @_ZL10stat_used_v 13 // CHECK-DAG: @_ZN12SpecialFuncs6MethodEv = {{.*}}alias i32 (%struct.SpecialFuncs*), i32 (%struct.SpecialFuncs*)* @_ZN12SpecialFuncs7method_Ev 14 // CHECK-DAG: declare {{.*}}i32 @_Z5bazzzv() 15 // CHECK-DAG: declare {{.*}}i32 @_Z3bazv() 16 // CHECK-DAG: ret i32 2 17 // CHECK-DAG: ret i32 3 18 // CHECK-DAG: ret i32 5 19 // CHECK-DAG: ret i32 6 20 // CHECK-DAG: ret i32 7 21 // CHECK-NOT: ret i32 {{1|4}} 22 23 #ifndef HEADER 24 #define HEADER 25 26 int foo() { return 2; } 27 28 #pragma omp declare variant(foo) match(implementation = {vendor(llvm)}) 29 int bar() { return 1; } 30 31 int bazzz(); 32 #pragma omp declare variant(bazzz) match(implementation = {vendor(llvm)}) 33 int baz() { return 1; } 34 35 int test(); 36 #pragma omp declare variant(test) match(implementation = {vendor(llvm)}) 37 int call() { return 1; } 38 39 static int stat_unused_(); 40 #pragma omp declare variant(stat_unused_) match(implementation = {vendor(llvm)}) 41 static int stat_unused() { return 1; } 42 43 static int stat_used_(); 44 #pragma omp declare variant(stat_used_) match(implementation = {vendor(llvm)}) 45 static int stat_used() { return 1; } 46 47 int main() { return bar() + baz() + call() + stat_used(); } 48 49 int test() { return 3; } 50 static int stat_unused_() { return 4; } 51 static int stat_used_() { return 5; } 52 53 struct SpecialFuncs { 54 void vd() {} 55 SpecialFuncs(); 56 ~SpecialFuncs(); 57 58 int method_() { return 6; } 59 #pragma omp declare variant(SpecialFuncs::method_) \ 60 match(implementation = {vendor(llvm)}) 61 int method() { return 1; } 62 #pragma omp declare variant(SpecialFuncs::method_) \ 63 match(implementation = {vendor(llvm)}) 64 int Method(); 65 } s; 66 67 int SpecialFuncs::Method() { return 1; } 68 69 struct SpecSpecialFuncs { 70 void vd() {} 71 SpecSpecialFuncs(); 72 ~SpecSpecialFuncs(); 73 74 int method_(); 75 #pragma omp declare variant(SpecSpecialFuncs::method_) \ 76 match(implementation = {vendor(llvm)}) 77 int method() { return 1; } 78 #pragma omp declare variant(SpecSpecialFuncs::method_) \ 79 match(implementation = {vendor(llvm)}) 80 int Method(); 81 } s1; 82 83 int SpecSpecialFuncs::method_() { return 7; } 84 int SpecSpecialFuncs::Method() { return 1; } 85 86 void xxx() { 87 (void)s.method(); 88 (void)s1.method(); 89 } 90 91 #endif // HEADER 92