diff options
author | Giuliano Procida <gprocida@google.com> | 2023-11-17 09:29:17 +0000 |
---|---|---|
committer | Giuliano Procida <gprocida@google.com> | 2023-11-20 12:59:29 +0000 |
commit | 585b57e2af8f562d19531e45ecf2cdd22b0e9cbd (patch) | |
tree | 010ed2511c0eeeb5180856820a4e5719bbd4c534 | |
parent | 51b5cb889f948751d23a24151dcea0e63e3ed8f5 (diff) | |
download | stg-585b57e2af8f562d19531e45ecf2cdd22b0e9cbd.tar.gz |
test cases: simplify reference/type_and_type diff test
This test case no longer tests more than needed nor requires passing
`-fstandalone-debug` to Clang.
PiperOrigin-RevId: 583304332
Change-Id: I49e23a2bda2da57636a83a1c7cab31f16c03b1bd
6 files changed, 75 insertions, 83 deletions
diff --git a/test_cases/diff_tests/reference/expected/kind_and_type_cc.o_o_flat b/test_cases/diff_tests/reference/expected/kind_and_type_cc.o_o_flat index bc69275..cc876f4 100644 --- a/test_cases/diff_tests/reference/expected/kind_and_type_cc.o_o_flat +++ b/test_cases/diff_tests/reference/expected/kind_and_type_cc.o_o_flat @@ -1,19 +1,19 @@ -function symbol 'void func(struct boo)' {_Z4func3boo} changed - type 'void(struct boo)' changed - parameter 1 type 'struct boo' changed +function symbol 'int func(struct foo)' {_Z4func3foo} changed + type 'int(struct foo)' changed + parameter 1 type 'struct foo' changed -type 'struct boo' changed - member changed from 'struct foo& lref_to_ptr' to 'struct foo* lref_to_ptr' - type changed from 'struct foo&' to 'struct foo*' - member changed from 'struct foo* ptr_to_lref' to 'struct foo& ptr_to_lref' - type changed from 'struct foo*' to 'struct foo&' - member changed from 'struct foo&& rref_to_ptr' to 'struct foo* rref_to_ptr' - type changed from 'struct foo&&' to 'struct foo*' - member changed from 'struct foo* ptr_to_rref' to 'struct foo&& ptr_to_rref' - type changed from 'struct foo*' to 'struct foo&&' - member changed from 'struct foo& lref_to_rref' to 'struct foo&& lref_to_rref' - type changed from 'struct foo&' to 'struct foo&&' - member changed from 'struct foo&& rref_to_lref' to 'struct foo& rref_to_lref' - type changed from 'struct foo&&' to 'struct foo&' +type 'struct foo' changed + member changed from 'int& lref_to_ptr' to 'int* lref_to_ptr' + type changed from 'int&' to 'int*' + member changed from 'int* ptr_to_lref' to 'int& ptr_to_lref' + type changed from 'int*' to 'int&' + member changed from 'int&& rref_to_ptr' to 'int* rref_to_ptr' + type changed from 'int&&' to 'int*' + member changed from 'int* ptr_to_rref' to 'int&& ptr_to_rref' + type changed from 'int*' to 'int&&' + member changed from 'int& lref_to_rref' to 'int&& lref_to_rref' + type changed from 'int&' to 'int&&' + member changed from 'int&& rref_to_lref' to 'int& rref_to_lref' + type changed from 'int&&' to 'int&' exit code 4 diff --git a/test_cases/diff_tests/reference/expected/kind_and_type_cc.o_o_plain b/test_cases/diff_tests/reference/expected/kind_and_type_cc.o_o_plain index d80f248..7614687 100644 --- a/test_cases/diff_tests/reference/expected/kind_and_type_cc.o_o_plain +++ b/test_cases/diff_tests/reference/expected/kind_and_type_cc.o_o_plain @@ -1,17 +1,17 @@ -function symbol 'void func(struct boo)' {_Z4func3boo} changed - type 'void(struct boo)' changed - parameter 1 type 'struct boo' changed - member changed from 'struct foo& lref_to_ptr' to 'struct foo* lref_to_ptr' - type changed from 'struct foo&' to 'struct foo*' - member changed from 'struct foo* ptr_to_lref' to 'struct foo& ptr_to_lref' - type changed from 'struct foo*' to 'struct foo&' - member changed from 'struct foo&& rref_to_ptr' to 'struct foo* rref_to_ptr' - type changed from 'struct foo&&' to 'struct foo*' - member changed from 'struct foo* ptr_to_rref' to 'struct foo&& ptr_to_rref' - type changed from 'struct foo*' to 'struct foo&&' - member changed from 'struct foo& lref_to_rref' to 'struct foo&& lref_to_rref' - type changed from 'struct foo&' to 'struct foo&&' - member changed from 'struct foo&& rref_to_lref' to 'struct foo& rref_to_lref' - type changed from 'struct foo&&' to 'struct foo&' +function symbol 'int func(struct foo)' {_Z4func3foo} changed + type 'int(struct foo)' changed + parameter 1 type 'struct foo' changed + member changed from 'int& lref_to_ptr' to 'int* lref_to_ptr' + type changed from 'int&' to 'int*' + member changed from 'int* ptr_to_lref' to 'int& ptr_to_lref' + type changed from 'int*' to 'int&' + member changed from 'int&& rref_to_ptr' to 'int* rref_to_ptr' + type changed from 'int&&' to 'int*' + member changed from 'int* ptr_to_rref' to 'int&& ptr_to_rref' + type changed from 'int*' to 'int&&' + member changed from 'int& lref_to_rref' to 'int&& lref_to_rref' + type changed from 'int&' to 'int&&' + member changed from 'int&& rref_to_lref' to 'int& rref_to_lref' + type changed from 'int&&' to 'int&' exit code 4 diff --git a/test_cases/diff_tests/reference/expected/kind_and_type_cc.o_o_small b/test_cases/diff_tests/reference/expected/kind_and_type_cc.o_o_small index 552c81f..ce627d1 100644 --- a/test_cases/diff_tests/reference/expected/kind_and_type_cc.o_o_small +++ b/test_cases/diff_tests/reference/expected/kind_and_type_cc.o_o_small @@ -1,15 +1,15 @@ -type 'struct boo' changed - member changed from 'struct foo& lref_to_ptr' to 'struct foo* lref_to_ptr' - type changed from 'struct foo&' to 'struct foo*' - member changed from 'struct foo* ptr_to_lref' to 'struct foo& ptr_to_lref' - type changed from 'struct foo*' to 'struct foo&' - member changed from 'struct foo&& rref_to_ptr' to 'struct foo* rref_to_ptr' - type changed from 'struct foo&&' to 'struct foo*' - member changed from 'struct foo* ptr_to_rref' to 'struct foo&& ptr_to_rref' - type changed from 'struct foo*' to 'struct foo&&' - member changed from 'struct foo& lref_to_rref' to 'struct foo&& lref_to_rref' - type changed from 'struct foo&' to 'struct foo&&' - member changed from 'struct foo&& rref_to_lref' to 'struct foo& rref_to_lref' - type changed from 'struct foo&&' to 'struct foo&' +type 'struct foo' changed + member changed from 'int& lref_to_ptr' to 'int* lref_to_ptr' + type changed from 'int&' to 'int*' + member changed from 'int* ptr_to_lref' to 'int& ptr_to_lref' + type changed from 'int*' to 'int&' + member changed from 'int&& rref_to_ptr' to 'int* rref_to_ptr' + type changed from 'int&&' to 'int*' + member changed from 'int* ptr_to_rref' to 'int&& ptr_to_rref' + type changed from 'int*' to 'int&&' + member changed from 'int& lref_to_rref' to 'int&& lref_to_rref' + type changed from 'int&' to 'int&&' + member changed from 'int&& rref_to_lref' to 'int& rref_to_lref' + type changed from 'int&&' to 'int&' exit code 4 diff --git a/test_cases/diff_tests/reference/expected/kind_and_type_cc.o_o_viz b/test_cases/diff_tests/reference/expected/kind_and_type_cc.o_o_viz index faf4e73..64d5b93 100644 --- a/test_cases/diff_tests/reference/expected/kind_and_type_cc.o_o_viz +++ b/test_cases/diff_tests/reference/expected/kind_and_type_cc.o_o_viz @@ -1,30 +1,30 @@ digraph "ABI diff" { "0" [shape=rectangle, label="'interface'"] - "1" [label="'void func(struct boo)' {_Z4func3boo}"] - "2" [label="'void(struct boo)'"] - "3" [shape=rectangle, label="'struct boo'"] - "4" [label="'struct foo& lref_to_ptr' -> 'struct foo* lref_to_ptr'"] - "5" [color=red, label="'struct foo&' -> 'struct foo*'"] + "1" [label="'int func(struct foo)' {_Z4func3foo}"] + "2" [label="'int(struct foo)'"] + "3" [shape=rectangle, label="'struct foo'"] + "4" [label="'int& lref_to_ptr' -> 'int* lref_to_ptr'"] + "5" [color=red, label="'int&' -> 'int*'"] "4" -> "5" [label=""] "3" -> "4" [label=""] - "6" [label="'struct foo* ptr_to_lref' -> 'struct foo& ptr_to_lref'"] - "7" [color=red, label="'struct foo*' -> 'struct foo&'"] + "6" [label="'int* ptr_to_lref' -> 'int& ptr_to_lref'"] + "7" [color=red, label="'int*' -> 'int&'"] "6" -> "7" [label=""] "3" -> "6" [label=""] - "8" [label="'struct foo&& rref_to_ptr' -> 'struct foo* rref_to_ptr'"] - "9" [color=red, label="'struct foo&&' -> 'struct foo*'"] + "8" [label="'int&& rref_to_ptr' -> 'int* rref_to_ptr'"] + "9" [color=red, label="'int&&' -> 'int*'"] "8" -> "9" [label=""] "3" -> "8" [label=""] - "10" [label="'struct foo* ptr_to_rref' -> 'struct foo&& ptr_to_rref'"] - "11" [color=red, label="'struct foo*' -> 'struct foo&&'"] + "10" [label="'int* ptr_to_rref' -> 'int&& ptr_to_rref'"] + "11" [color=red, label="'int*' -> 'int&&'"] "10" -> "11" [label=""] "3" -> "10" [label=""] - "12" [label="'struct foo& lref_to_rref' -> 'struct foo&& lref_to_rref'"] - "13" [color=red, label="'struct foo&' -> 'struct foo&&'"] + "12" [label="'int& lref_to_rref' -> 'int&& lref_to_rref'"] + "13" [color=red, label="'int&' -> 'int&&'"] "12" -> "13" [label=""] "3" -> "12" [label=""] - "14" [label="'struct foo&& rref_to_lref' -> 'struct foo& rref_to_lref'"] - "15" [color=red, label="'struct foo&&' -> 'struct foo&'"] + "14" [label="'int&& rref_to_lref' -> 'int& rref_to_lref'"] + "15" [color=red, label="'int&&' -> 'int&'"] "14" -> "15" [label=""] "3" -> "14" [label=""] "2" -> "3" [label="parameter 1"] diff --git a/test_cases/diff_tests/reference/kind_and_type.0.cc b/test_cases/diff_tests/reference/kind_and_type.0.cc index 080d9c5..28e8c13 100644 --- a/test_cases/diff_tests/reference/kind_and_type.0.cc +++ b/test_cases/diff_tests/reference/kind_and_type.0.cc @@ -1,18 +1,14 @@ struct foo { - int x; -}; - -struct boo { - foo& lref_to_ptr; - foo* ptr_to_lref; + int& lref_to_ptr; + int* ptr_to_lref; - foo&& rref_to_ptr; - foo* ptr_to_rref; + int&& rref_to_ptr; + int* ptr_to_rref; - foo& lref_to_rref; - foo&& rref_to_lref; + int& lref_to_rref; + int&& rref_to_lref; }; -void func(boo a) { - (void) a; +int func(foo x) { + return x.lref_to_ptr + x.rref_to_lref; } diff --git a/test_cases/diff_tests/reference/kind_and_type.1.cc b/test_cases/diff_tests/reference/kind_and_type.1.cc index f458303..ee24cfe 100644 --- a/test_cases/diff_tests/reference/kind_and_type.1.cc +++ b/test_cases/diff_tests/reference/kind_and_type.1.cc @@ -1,18 +1,14 @@ struct foo { - long x; -}; - -struct boo { - foo* lref_to_ptr; - foo& ptr_to_lref; + int* lref_to_ptr; + int& ptr_to_lref; - foo* rref_to_ptr; - foo&& ptr_to_rref; + int* rref_to_ptr; + int&& ptr_to_rref; - foo&& lref_to_rref; - foo& rref_to_lref; + int&& lref_to_rref; + int& rref_to_lref; }; -void func(boo a) { - (void) a; +int func(foo x) { + return *x.lref_to_ptr + x.rref_to_lref; } |