brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.9 KiB · c3f41d8 Raw
57 lines · c
1// RUN: %clang_cc1 -Wno-error=return-type -emit-llvm -std=c2x %s -o - | FileCheck %s2// RUN: %clang_cc1 -Wno-error=return-type -triple %itanium_abi_triple -x c++ -emit-llvm %s -o - | FileCheck %s --check-prefix=CHECK-CXX3 4typedef void (*fptrs_t[4])(void);5fptrs_t p __attribute__((noreturn));6 7void __attribute__((noreturn)) f(void) {8  p[0]();9}10// CHECK: call void11// CHECK-NEXT: unreachable12 13// CHECK-LABEL: @test_conditional_gnu(14// CHECK:         %cond = select i1 %tobool, ptr @t1, ptr @t215// CHECK:         call void %cond(16// CHECK:         call void %cond2(17// CHECK-NEXT:    unreachable18 19// CHECK-CXX-LABEL: @_Z20test_conditional_gnui(20// CHECK-CXX:         %cond{{.*}} = phi ptr [ @_Z2t1i, %{{.*}} ], [ @_Z2t2i, %{{.*}} ]21// CHECK-CXX:         call void %cond{{.*}}(22// CHECK-CXX:         %cond{{.*}} = phi ptr [ @_Z2t1i, %{{.*}} ], [ @_Z2t1i, %{{.*}} ]23// CHECK-CXX:         call void %cond{{.*}}(24// CHECK-CXX-NEXT:    unreachable25void t1(int) __attribute__((noreturn));26void t2(int);27__attribute__((noreturn)) void test_conditional_gnu(int a) {28  // The conditional operator isn't noreturn because t2 isn't.29  (a ? t1 : t2)(a);30  // The conditional operator is noreturn.31  (a ? t1 : t1)(a);32}33 34// CHECK-LABEL: @test_conditional_Noreturn(35// CHECK:         %cond = select i1 %tobool, ptr @t3, ptr @t236// CHECK:         call void %cond(37// CHECK:         %cond2 = select i1 %tobool1, ptr @t3, ptr @t338// CHECK:         call void %cond2(39// CHECK-NEXT:    ret void40_Noreturn void t3(int);41_Noreturn void test_conditional_Noreturn(int a) {42  (a ? t3 : t2)(a);43  (a ? t3 : t3)(a);44}45 46// CHECK-LABEL: @test_conditional_std(47// CHECK:         %cond = select i1 %tobool, ptr @t4, ptr @t248// CHECK:         call void %cond(49// CHECK:         %cond2 = select i1 %tobool1, ptr @t4, ptr @t450// CHECK:         call void %cond2(51// CHECK-NEXT:    ret void52[[noreturn]] void t4(int);53[[noreturn]] void test_conditional_std(int a) {54  (a ? t4 : t2)(a);55  (a ? t4 : t4)(a);56}57