Joel E. Denny | 9eaf0d1 | 2021-06-25 12:40:04 -0400 | [diff] [blame] | 1 | RUN: rm -rf %t && mkdir %t |
| 2 | |
Henrik G. Olsson | e6eda66c | 2023-11-13 14:45:27 +0100 | [diff] [blame] | 3 | # Check --check-globals all in normal mode and in --include-generated-funcs mode. |
Joel E. Denny | 9eaf0d1 | 2021-06-25 12:40:04 -0400 | [diff] [blame] | 4 | |
| 5 | RUN: cp %S/Inputs/check-globals.c %t/norm.c |
Henrik G. Olsson | e6eda66c | 2023-11-13 14:45:27 +0100 | [diff] [blame] | 6 | RUN: %update_cc_test_checks %t/norm.c --check-globals all |
Joel E. Denny | 9eaf0d1 | 2021-06-25 12:40:04 -0400 | [diff] [blame] | 7 | RUN: FileCheck %s --input-file=%t/norm.c --match-full-lines -strict-whitespace \ |
| 8 | RUN: -check-prefixes=BOTH,NRM |
| 9 | |
| 10 | RUN: cp %S/Inputs/check-globals.c %t/igf.c |
Henrik G. Olsson | e6eda66c | 2023-11-13 14:45:27 +0100 | [diff] [blame] | 11 | RUN: %update_cc_test_checks %t/igf.c --check-globals all --include-generated-funcs |
Joel E. Denny | 9eaf0d1 | 2021-06-25 12:40:04 -0400 | [diff] [blame] | 12 | RUN: FileCheck %s --input-file=%t/igf.c --match-full-lines -strict-whitespace \ |
| 13 | RUN: -check-prefixes=BOTH,IGF |
| 14 | |
| 15 | # Check that repeating doesn't change it, such as duplicating '//.' occurrences. |
| 16 | |
| 17 | RUN: cp %t/norm.c %t/norm-again.c |
Henrik G. Olsson | e6eda66c | 2023-11-13 14:45:27 +0100 | [diff] [blame] | 18 | RUN: %update_cc_test_checks %t/norm-again.c --check-globals all |
Joel E. Denny | 9eaf0d1 | 2021-06-25 12:40:04 -0400 | [diff] [blame] | 19 | RUN: diff -u %t/norm.c %t/norm-again.c |
| 20 | RUN: rm %t/norm-again.c |
| 21 | |
| 22 | RUN: cp %t/igf.c %t/igf-again.c |
Henrik G. Olsson | e6eda66c | 2023-11-13 14:45:27 +0100 | [diff] [blame] | 23 | RUN: %update_cc_test_checks %t/igf-again.c --check-globals all \ |
Joel E. Denny | 9eaf0d1 | 2021-06-25 12:40:04 -0400 | [diff] [blame] | 24 | RUN: --include-generated-funcs |
| 25 | RUN: diff -u %t/igf.c %t/igf-again.c |
| 26 | RUN: rm %t/igf-again.c |
| 27 | |
| 28 | # Check that the generated directives actually work correctly. For example, |
| 29 | # they're not in the wrong order. |
| 30 | |
| 31 | RUN: cp %S/Inputs/lit.cfg.example %t/lit.cfg |
| 32 | # Show lit failures while avoiding confusing FileCheck input dump nesting. |
| 33 | RUN: %lit %t |
Joel E. Denny | cc60fa2 | 2021-06-25 14:06:52 -0400 | [diff] [blame] | 34 | # Lit was successful. Sanity-check the results with deterministic test order. |
| 35 | RUN: rm %t/.lit_test_times.txt |
Joel E. Denny | 9eaf0d1 | 2021-06-25 12:40:04 -0400 | [diff] [blame] | 36 | RUN: %lit %t 2>&1 | FileCheck -check-prefix=LIT-RUN %s |
| 37 | |
| 38 | END. |
| 39 | |
| 40 | BOTH-NOT:{{.}} |
| 41 | NRM:// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --check-globals |
| 42 | IGF:// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --check-globals --include-generated-funcs |
| 43 | BOTH-NEXT:// {{.*}} |
| 44 | BOTH-NEXT:// RUN: true |
| 45 | BOTH-NEXT:// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -emit-llvm -o - %s | FileCheck %s |
| 46 | BOTH-EMPTY: |
Aaron Ballman | 0dd49a5 | 2022-02-12 07:23:43 -0500 | [diff] [blame] | 47 | IGF-NEXT:void foo(void) { |
Joel E. Denny | 9eaf0d1 | 2021-06-25 12:40:04 -0400 | [diff] [blame] | 48 | IGF-NEXT: static int i, j; |
| 49 | IGF-NEXT:} |
Aaron Ballman | 0dd49a5 | 2022-02-12 07:23:43 -0500 | [diff] [blame] | 50 | IGF-NEXT:void bar(void) { |
Joel E. Denny | 9eaf0d1 | 2021-06-25 12:40:04 -0400 | [diff] [blame] | 51 | IGF-NEXT: static int i, j; |
| 52 | IGF-NEXT:} |
| 53 | BOTH-NEXT://. |
| 54 | BOTH-NEXT:// CHECK: @foo.i = internal global i32 0, align 4 |
| 55 | BOTH-NEXT:// CHECK: @foo.j = internal global i32 0, align 4 |
| 56 | BOTH-NEXT:// CHECK: @bar.i = internal global i32 0, align 4 |
| 57 | BOTH-NEXT:// CHECK: @bar.j = internal global i32 0, align 4 |
| 58 | BOTH-NEXT://. |
Nikita Popov | 697bfa4 | 2022-12-13 09:13:39 +0100 | [diff] [blame] | 59 | BOTH-NEXT:// CHECK-LABEL: @foo( |
Joel E. Denny | 9eaf0d1 | 2021-06-25 12:40:04 -0400 | [diff] [blame] | 60 | BOTH-NEXT:// CHECK-NEXT: entry: |
| 61 | BOTH-NEXT:// CHECK-NEXT: ret void |
| 62 | BOTH-NEXT:// |
Aaron Ballman | 0dd49a5 | 2022-02-12 07:23:43 -0500 | [diff] [blame] | 63 | NRM-NEXT:void foo(void) { |
Joel E. Denny | 9eaf0d1 | 2021-06-25 12:40:04 -0400 | [diff] [blame] | 64 | NRM-NEXT: static int i, j; |
| 65 | NRM-NEXT:} |
| 66 | IGF-NEXT:// |
Nikita Popov | 697bfa4 | 2022-12-13 09:13:39 +0100 | [diff] [blame] | 67 | BOTH-NEXT:// CHECK-LABEL: @bar( |
Joel E. Denny | 9eaf0d1 | 2021-06-25 12:40:04 -0400 | [diff] [blame] | 68 | BOTH-NEXT:// CHECK-NEXT: entry: |
| 69 | BOTH-NEXT:// CHECK-NEXT: ret void |
| 70 | BOTH-NEXT:// |
Aaron Ballman | 0dd49a5 | 2022-02-12 07:23:43 -0500 | [diff] [blame] | 71 | NRM-NEXT:void bar(void) { |
Joel E. Denny | 9eaf0d1 | 2021-06-25 12:40:04 -0400 | [diff] [blame] | 72 | NRM-NEXT: static int i, j; |
| 73 | NRM-NEXT:} |
| 74 | BOTH-NEXT://. |
| 75 | BOTH-NEXT:// CHECK: attributes {{.*}} |
| 76 | BOTH-NEXT://. |
Henrik G. Olsson | e6eda66c | 2023-11-13 14:45:27 +0100 | [diff] [blame] | 77 | BOTH-NEXT:// CHECK: {{\[\[META0:!\[0-9\]\+\]\]}} = {{.*}} |
| 78 | BOTH-NEXT:// CHECK: {{\[\[META1:!\[0-9\]\+\]\]}} = {{.*}} |
Joel E. Denny | 9eaf0d1 | 2021-06-25 12:40:04 -0400 | [diff] [blame] | 79 | BOTH-NEXT://. |
| 80 | BOTH-NOT:{{.}} |
| 81 | |
| 82 | LIT-RUN: Testing: 2 tests |
| 83 | LIT-RUN: PASS: {{.*}} igf.c |
| 84 | LIT-RUN: PASS: {{.*}} norm.c |