brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.7 KiB · 962dcc4 Raw
121 lines · cpp
1// RUN: %clang_cc1 -emit-llvm -triple i386-linux-gnu %s -o - | FileCheck %s2// RUN: %clang_cc1 -x c++ -emit-pch -triple i386-linux-gnu -o %t %s3// RUN: %clang_cc1 -include-pch %t %s -triple i386-linux-gnu -emit-llvm -o - | FileCheck %s4// expected-no-diagnostics5 6#ifndef HEADER7#define HEADER8 9/// foo: declarations only10 11[[omp::assume("foo:before1")]] void foo();12 13[[omp::assume("foo:before2")]]14[[omp::assume("foo:before3")]] void15foo();16 17/// baz: static function declarations and a definition18 19[[omp::assume("baz:before1")]] static void baz();20 21[[omp::assume("baz:before2")]]22[[omp::assume("baz:before3")]] static void23baz();24 25// Definition26[[omp::assume("baz:def1,baz:def2")]] static void baz() { foo(); }27 28[[omp::assume("baz:after")]] static void baz();29 30/// bar: external function declarations and a definition31 32[[omp::assume("bar:before1")]] void bar();33 34[[omp::assume("bar:before2")]]35[[omp::assume("bar:before3")]] void36bar();37 38// Definition39[[omp::assume("bar:def1,bar:def2")]] void bar() { baz(); }40 41[[omp::assume("bar:after")]] void bar();42 43/// back to foo44 45[[omp::assume("foo:after")]] void foo();46 47/// class tests48class C {49  [[omp::assume("C:private_method")]] void private_method();50  [[omp::assume("C:private_static")]] static void private_static();51 52public:53  [[omp::assume("C:public_method1")]] void public_method();54  [[omp::assume("C:public_static1")]] static void public_static();55};56 57[[omp::assume("C:public_method2")]] void C::public_method() {58  private_method();59}60 61[[omp::assume("C:public_static2")]] void C::public_static() {62  private_static();63}64 65/// template tests66template <typename T>67[[omp::assume("template_func<T>")]] void template_func() {}68 69template <>70[[omp::assume("template_func<float>")]] void template_func<float>() {}71 72template <>73void template_func<int>() {}74 75template <typename T>76struct S {77  [[omp::assume("S<T>::method")]] void method();78};79 80template <>81[[omp::assume("S<float>::method")]] void S<float>::method() {}82 83template <>84void S<int>::method() {}85 86// CHECK:         define{{.*}} void @_Z3barv() #087// CHECK:         define{{.*}} void @_ZL3bazv() #188// CHECK:         define{{.*}} void @_ZN1C13public_methodEv({{.*}}) #289// CHECK:         declare{{.*}} void @_ZN1C14private_methodEv({{.*}}) #390// CHECK:         define{{.*}} void @_ZN1C13public_staticEv() #491// CHECK:         declare{{.*}} void @_ZN1C14private_staticEv() #592// CHECK:         define{{.*}} void @_Z13template_funcIfEvv() #693// CHECK:         define{{.*}} void @_Z13template_funcIiEvv() #794// CHECK:         define{{.*}} void @_ZN1SIfE6methodEv({{.*}}) #895// CHECK:         define{{.*}} void @_ZN1SIiE6methodEv({{.*}}) #996// CHECK:         declare{{.*}} void @_Z3foov() #1097// CHECK:         attributes #098// CHECK-SAME:      "llvm.assume"="bar:before1,bar:before2,bar:before3,bar:def1,bar:def2"99// CHECK:         attributes #1100// CHECK-SAME:      "llvm.assume"="baz:before1,baz:before2,baz:before3,baz:def1,baz:def2,baz:after"101// CHECK:         attributes #2102// CHECK-SAME:      "llvm.assume"="C:public_method1,C:public_method2"103// CHECK:         attributes #3104// CHECK-SAME:      "llvm.assume"="C:private_method"105// CHECK:         attributes #4106// CHECK-SAME:      "llvm.assume"="C:public_static1,C:public_static2"107// CHECK:         attributes #5108// CHECK-SAME:      "llvm.assume"="C:private_static"109// CHECK:         attributes #6110// CHECK-SAME:      "llvm.assume"="template_func<T>,template_func<float>"111// CHECK:         attributes #7112// CHECK-SAME:      "llvm.assume"="template_func<T>"113// CHECK:         attributes #8114// CHECK-SAME:      "llvm.assume"="S<T>::method,S<float>::method"115// CHECK:         attributes #9116// CHECK-SAME:      "llvm.assume"="S<T>::method"117// CHECK:         attributes #10118// CHECK-SAME:      "llvm.assume"="foo:before1,foo:before2,foo:before3"119 120#endif121