aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiuliano Procida <gprocida@google.com>2023-11-30 17:20:29 +0000
committerGiuliano Procida <gprocida@google.com>2023-12-13 11:24:01 +0000
commitb253c41955e7d1ad981ae868c4b04a392dcdbed2 (patch)
tree6376ec276362a14a9c2cdb70d1de235cd0057409
parent811788d30ad644ea5e04e4a8335688e6bd1e327e (diff)
downloadstg-b253c41955e7d1ad981ae868c4b04a392dcdbed2.tar.gz
test cases: add a typedef to the test case
STG does not model `typedef`s without a definition, but if it did, the definition here should be filtered out. We cannot drop the `typedef` altogether as that would leave dangling references. Faking a dummy definition would become problematic at the point of type deduplication, with all such `Typedef` nodes pointing to the same thing. PiperOrigin-RevId: 586696207 Change-Id: I966b92b6a3f637c3fe03ad3e6de4ed6e94ec6120
-rw-r--r--test_cases/info_tests/source_filter/expected/types_cc.elf_stg23
-rw-r--r--test_cases/info_tests/source_filter/types.cc3
2 files changed, 26 insertions, 0 deletions
diff --git a/test_cases/info_tests/source_filter/expected/types_cc.elf_stg b/test_cases/info_tests/source_filter/expected/types_cc.elf_stg
index 4ec229b..f6c669d 100644
--- a/test_cases/info_tests/source_filter/expected/types_cc.elf_stg
+++ b/test_cases/info_tests/source_filter/expected/types_cc.elf_stg
@@ -1,5 +1,19 @@
version: 0x00000002
root_id: 0x84ea5130
+special {
+ id: 0x48b5725f
+ kind: VOID
+}
+pointer_reference {
+ id: 0x18bd6530
+ kind: POINTER
+ pointee_type_id: 0x48b5725f
+}
+typedef {
+ id: 0x4f137329
+ name: "Typedef"
+ referred_type_id: 0x18bd6530
+}
struct_union {
id: 0x54a61673
kind: STRUCT
@@ -56,6 +70,14 @@ elf_symbol {
full_name: "foo_struct"
}
elf_symbol {
+ id: 0x90772e58
+ name: "foo_typedef"
+ is_defined: true
+ symbol_type: OBJECT
+ type_id: 0x4f137329
+ full_name: "foo_typedef"
+}
+elf_symbol {
id: 0xc77e6f56
name: "foo_union"
is_defined: true
@@ -69,5 +91,6 @@ interface {
symbol_id: 0x5f43725e
symbol_id: 0x49093003
symbol_id: 0x8361f42b
+ symbol_id: 0x90772e58
symbol_id: 0xc77e6f56
}
diff --git a/test_cases/info_tests/source_filter/types.cc b/test_cases/info_tests/source_filter/types.cc
index b73bcb0..5d393dd 100644
--- a/test_cases/info_tests/source_filter/types.cc
+++ b/test_cases/info_tests/source_filter/types.cc
@@ -20,8 +20,11 @@ enum class EnumClass {
ONE = 1,
};
+typedef void* Typedef;
+
Struct foo_struct;
Union foo_union;
Class foo_class;
Enum foo_enum;
EnumClass foo_enum_class;
+Typedef foo_typedef;