Vitaly Buka | c34b7aa | 2019-08-24 01:31:38 +0000 | [diff] [blame] | 1 | // RUN: %clang -w -target x86_64-linux-gnu -S -emit-llvm -o - -fno-exceptions -O0 %s | \ |
| 2 | // RUN: FileCheck %s -check-prefixes=CHECK,CHECK-O0 --implicit-check-not=llvm.lifetime |
| 3 | // RUN: %clang -w -target x86_64-linux-gnu -S -emit-llvm -o - -fno-exceptions -O0 \ |
| 4 | // RUN: -fsanitize=address -fsanitize-address-use-after-scope %s | \ |
| 5 | // RUN: FileCheck %s -check-prefixes=CHECK,LIFETIME |
Vitaly Buka | aeca569 | 2019-08-26 22:15:50 +0000 | [diff] [blame] | 6 | // RUN: %clang -w -target x86_64-linux-gnu -S -emit-llvm -o - -fno-exceptions -O0 \ |
| 7 | // RUN: -fsanitize=memory %s | \ |
| 8 | // RUN: FileCheck %s -check-prefixes=CHECK,LIFETIME |
Vitaly Buka | 669d111 | 2019-08-26 22:16:05 +0000 | [diff] [blame^] | 9 | // RUN: %clang -w -target aarch64-linux-gnu -S -emit-llvm -o - -fno-exceptions -O0 \ |
| 10 | // RUN: -fsanitize=hwaddress %s | \ |
| 11 | // RUN: FileCheck %s -check-prefixes=CHECK,LIFETIME |
Vitaly Buka | c34b7aa | 2019-08-24 01:31:38 +0000 | [diff] [blame] | 12 | |
| 13 | extern int bar(char *A, int n); |
| 14 | |
| 15 | struct X { |
| 16 | X(); |
| 17 | ~X(); |
| 18 | int *p; |
| 19 | }; |
| 20 | struct Y { |
| 21 | Y(); |
| 22 | int *p; |
| 23 | }; |
| 24 | |
| 25 | extern "C" void a(), b(), c(), d(); |
| 26 | |
| 27 | // CHECK-LABEL: @_Z3foo |
| 28 | void foo(int n) { |
| 29 | // CHECK-LABEL: call void @a() |
| 30 | a(); |
| 31 | |
| 32 | // CHECK-LABEL: call void @b() |
| 33 | // CHECK: store i1 false |
| 34 | // CHECK-LABEL: br i1 |
| 35 | // |
| 36 | // CHECK-LABEL: cond.true: |
| 37 | // LIFETIME: @llvm.lifetime.start |
| 38 | // LIFETIME: store i1 true |
| 39 | // LIFETIME: call void @_ZN1XC |
| 40 | // CHECK-LABEL: br label |
| 41 | // |
| 42 | // CHECK-LABEL: cond.false: |
| 43 | // LIFETIME: @llvm.lifetime.start |
| 44 | // LIFETIME: store i1 true |
| 45 | // LIFETIME: call void @_ZN1YC |
| 46 | // CHECK-LABEL: br label |
| 47 | // |
| 48 | // CHECK-LABEL: cond.end: |
| 49 | // CHECK: call void @c() |
| 50 | // LIFETIME: @llvm.lifetime.end |
| 51 | // LIFETIME: @llvm.lifetime.end |
| 52 | b(), (n ? X().p : Y().p), c(); |
| 53 | |
| 54 | // CHECK: call void @d() |
| 55 | d(); |
| 56 | } |