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|81|84}} 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: @_Z5prio_v = {{.*}}alias i32 (), i32 ()* @_Z4priov 12 // CHECK-DAG: @_ZL6prio1_v = internal alias i32 (), i32 ()* @_ZL5prio2v 13 // CHECK-DAG: @_Z4callv = {{.*}}alias i32 (), i32 ()* @_Z4testv 14 // CHECK-DAG: @_ZL9stat_usedv = internal alias i32 (), i32 ()* @_ZL10stat_used_v 15 // CHECK-DAG: @_ZN12SpecialFuncs6MethodEv = {{.*}}alias i32 (%struct.SpecialFuncs*), i32 (%struct.SpecialFuncs*)* @_ZN12SpecialFuncs7method_Ev 16 // CHECK-DAG: declare {{.*}}i32 @_Z5bazzzv() 17 // CHECK-DAG: declare {{.*}}i32 @_Z3bazv() 18 // CHECK-DAG: ret i32 2 19 // CHECK-DAG: ret i32 3 20 // CHECK-DAG: ret i32 5 21 // CHECK-DAG: ret i32 6 22 // CHECK-DAG: ret i32 7 23 // CHECK-DAG: ret i32 82 24 // CHECK-DAG: ret i32 83 25 // CHECK-NOT: ret i32 {{1|4|81|84}} 26 27 #ifndef HEADER 28 #define HEADER 29 30 int foo() { return 2; } 31 32 #pragma omp declare variant(foo) match(implementation = {vendor(llvm)}) 33 int bar() { return 1; } 34 35 int bazzz(); 36 #pragma omp declare variant(bazzz) match(implementation = {vendor(llvm)}) 37 int baz() { return 1; } 38 39 int test(); 40 #pragma omp declare variant(test) match(implementation = {vendor(llvm)}) 41 int call() { return 1; } 42 43 static int stat_unused_(); 44 #pragma omp declare variant(stat_unused_) match(implementation = {vendor(llvm)}) 45 static int stat_unused() { return 1; } 46 47 static int stat_used_(); 48 #pragma omp declare variant(stat_used_) match(implementation = {vendor(llvm)}) 49 static int stat_used() { return 1; } 50 51 int main() { return bar() + baz() + call() + stat_used(); } 52 53 int test() { return 3; } 54 static int stat_unused_() { return 4; } 55 static int stat_used_() { return 5; } 56 57 struct SpecialFuncs { 58 void vd() {} 59 SpecialFuncs(); 60 ~SpecialFuncs(); 61 62 int method_() { return 6; } 63 #pragma omp declare variant(SpecialFuncs::method_) \ 64 match(implementation = {vendor(llvm)}) 65 int method() { return 1; } 66 #pragma omp declare variant(SpecialFuncs::method_) \ 67 match(implementation = {vendor(llvm)}) 68 int Method(); 69 } s; 70 71 int SpecialFuncs::Method() { return 1; } 72 73 struct SpecSpecialFuncs { 74 void vd() {} 75 SpecSpecialFuncs(); 76 ~SpecSpecialFuncs(); 77 78 int method_(); 79 #pragma omp declare variant(SpecSpecialFuncs::method_) \ 80 match(implementation = {vendor(llvm)}) 81 int method() { return 1; } 82 #pragma omp declare variant(SpecSpecialFuncs::method_) \ 83 match(implementation = {vendor(llvm)}) 84 int Method(); 85 } s1; 86 87 int SpecSpecialFuncs::method_() { return 7; } 88 int SpecSpecialFuncs::Method() { return 1; } 89 90 void xxx() { 91 (void)s.method(); 92 (void)s1.method(); 93 } 94 95 int prio() { return 81; } 96 int prio1() { return 82; } 97 98 #pragma omp declare variant(prio) match(implementation = {vendor(llvm)}) 99 #pragma omp declare variant(prio1) match(implementation = {vendor(score(1): llvm)}) 100 int prio_() { return 1; } 101 102 static int prio2() { return 83; } 103 static int prio3() { return 84; } 104 static int prio4() { return 84; } 105 106 #pragma omp declare variant(prio4) match(implementation = {vendor(score(3): llvm)}) 107 #pragma omp declare variant(prio2) match(implementation = {vendor(score(5): llvm)}) 108 #pragma omp declare variant(prio3) match(implementation = {vendor(score(1): llvm)}) 109 static int prio1_() { return 1; } 110 111 int int_fn() { return prio1_(); } 112 113 #endif // HEADER 114