diff options
author | Joel E. Denny <jdenny.ornl@gmail.com> | 2021-07-20 11:17:56 -0400 |
---|---|---|
committer | Joel E. Denny <jdenny.ornl@gmail.com> | 2021-07-20 11:23:20 -0400 |
commit | 5b0a948a81e695f044e88659be18a28256b1e309 (patch) | |
tree | 9128c23ec79e39db6dc4acf99c4475db39da7823 /clang/test/utils | |
parent | 2f5b2ea6cd854edfa2722ae0b5acf604a333e785 (diff) | |
download | llvm-5b0a948a81e695f044e88659be18a28256b1e309.zip llvm-5b0a948a81e695f044e88659be18a28256b1e309.tar.gz llvm-5b0a948a81e695f044e88659be18a28256b1e309.tar.bz2 |
[UpdateCCTestChecks] Implement --global-hex-value-regex
For example, in OpenMP offload codegen tests, global variables like
`.offload_maptypes*` are much easier to read in hex.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D104743
Diffstat (limited to 'clang/test/utils')
3 files changed, 54 insertions, 0 deletions
diff --git a/clang/test/utils/update_cc_test_checks/Inputs/global-hex-value-regex.c b/clang/test/utils/update_cc_test_checks/Inputs/global-hex-value-regex.c new file mode 100644 index 0000000..ad4c109 --- /dev/null +++ b/clang/test/utils/update_cc_test_checks/Inputs/global-hex-value-regex.c @@ -0,0 +1,10 @@ +// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -emit-llvm -o - %s | FileCheck %s + +void foo() { + static int hex = 0x10; + static int dec = 10; +} +void bar() { + static int hex = 0x20; + static int dec = 20; +} diff --git a/clang/test/utils/update_cc_test_checks/Inputs/global-hex-value-regex.c.expected b/clang/test/utils/update_cc_test_checks/Inputs/global-hex-value-regex.c.expected new file mode 100644 index 0000000..3018d02 --- /dev/null +++ b/clang/test/utils/update_cc_test_checks/Inputs/global-hex-value-regex.c.expected @@ -0,0 +1,25 @@ +// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --check-globals --global-value-regex "foo\..*" "bar\..*" --global-hex-value-regex ".*\.hex" +// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -emit-llvm -o - %s | FileCheck %s + +//. +// CHECK: @foo.hex = internal global i32 [[#0x10]], align 4 +// CHECK: @foo.dec = internal global i32 10, align 4 +// CHECK: @bar.hex = internal global i32 [[#0x20]], align 4 +// CHECK: @bar.dec = internal global i32 20, align 4 +//. +// CHECK-LABEL: @foo( +// CHECK-NEXT: entry: +// CHECK-NEXT: ret void +// +void foo() { + static int hex = 0x10; + static int dec = 10; +} +// CHECK-LABEL: @bar( +// CHECK-NEXT: entry: +// CHECK-NEXT: ret void +// +void bar() { + static int hex = 0x20; + static int dec = 20; +} diff --git a/clang/test/utils/update_cc_test_checks/global-hex-value-regex.test b/clang/test/utils/update_cc_test_checks/global-hex-value-regex.test new file mode 100644 index 0000000..6ff06b4 --- /dev/null +++ b/clang/test/utils/update_cc_test_checks/global-hex-value-regex.test @@ -0,0 +1,19 @@ +RUN: rm -rf %t && mkdir %t + +# Check --global-hex-value-regex. +RUN: cp %S/Inputs/global-hex-value-regex.c %t/test.c +RUN: %update_cc_test_checks %t/test.c --check-globals \ +RUN: --global-value-regex "foo\..*" "bar\..*" \ +RUN: --global-hex-value-regex ".*\.hex" +RUN: diff -u %S/Inputs/global-hex-value-regex.c.expected %t/test.c + +# Check that the generated directives actually work correctly. +RUN: cp %S/Inputs/lit.cfg.example %t/lit.cfg +# Show lit failures while avoiding confusing FileCheck input dump nesting. +RUN: %lit %t +# Lit was successful. Sanity-check the results with deterministic test order. +RUN: rm %t/.lit_test_times.txt +RUN: %lit %t 2>&1 | FileCheck %s + +CHECK: Testing: 1 tests +CHECK: PASS: {{.*}} test.c |