From 9918693037dce8aa4bb6f08741b6812923486c18 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 19 Jun 2024 11:26:03 +0200 Subject: Merging upstream version 1.76.0+dfsg1. Signed-off-by: Daniel Baumann --- tests/codegen/debug-accessibility/crate-enum.rs | 26 +++++++++++++++++++ tests/codegen/debug-accessibility/crate-struct.rs | 23 +++++++++++++++++ tests/codegen/debug-accessibility/private-enum.rs | 21 +++++++++++++++ .../codegen/debug-accessibility/private-struct.rs | 17 ++++++++++++ tests/codegen/debug-accessibility/public-enum.rs | 21 +++++++++++++++ tests/codegen/debug-accessibility/public-struct.rs | 17 ++++++++++++ tests/codegen/debug-accessibility/struct-fields.rs | 30 ++++++++++++++++++++++ tests/codegen/debug-accessibility/super-enum.rs | 27 +++++++++++++++++++ tests/codegen/debug-accessibility/super-struct.rs | 23 +++++++++++++++++ tests/codegen/debug-accessibility/tuple-fields.rs | 24 +++++++++++++++++ 10 files changed, 229 insertions(+) create mode 100644 tests/codegen/debug-accessibility/crate-enum.rs create mode 100644 tests/codegen/debug-accessibility/crate-struct.rs create mode 100644 tests/codegen/debug-accessibility/private-enum.rs create mode 100644 tests/codegen/debug-accessibility/private-struct.rs create mode 100644 tests/codegen/debug-accessibility/public-enum.rs create mode 100644 tests/codegen/debug-accessibility/public-struct.rs create mode 100644 tests/codegen/debug-accessibility/struct-fields.rs create mode 100644 tests/codegen/debug-accessibility/super-enum.rs create mode 100644 tests/codegen/debug-accessibility/super-struct.rs create mode 100644 tests/codegen/debug-accessibility/tuple-fields.rs (limited to 'tests/codegen/debug-accessibility') diff --git a/tests/codegen/debug-accessibility/crate-enum.rs b/tests/codegen/debug-accessibility/crate-enum.rs new file mode 100644 index 000000000..eeea18dd8 --- /dev/null +++ b/tests/codegen/debug-accessibility/crate-enum.rs @@ -0,0 +1,26 @@ +// compile-flags: -C debuginfo=2 +// ignore-tidy-linelength + +#![allow(dead_code)] + +// Checks that visibility information is present in the debuginfo for crate-visibility enums. + +mod module { + use std::hint::black_box; + + pub(crate) enum CrateFooEnum { + A, + B(u32), + C { x: u32 }, + } + + // NONMSVC: {{!.*}} = !DICompositeType(tag: DW_TAG_structure_type, name: "CrateFooEnum"{{.*}}flags: DIFlagProtected{{.*}}) + // MSVC: {{!.*}} = !DICompositeType(tag: DW_TAG_union_type, name: "enum2$"{{.*}}flags: DIFlagProtected{{.*}}) + pub fn use_everything() { + black_box(CrateFooEnum::A); + } +} + +fn main() { + module::use_everything(); +} diff --git a/tests/codegen/debug-accessibility/crate-struct.rs b/tests/codegen/debug-accessibility/crate-struct.rs new file mode 100644 index 000000000..68d126a34 --- /dev/null +++ b/tests/codegen/debug-accessibility/crate-struct.rs @@ -0,0 +1,23 @@ +// compile-flags: -C debuginfo=2 + +#![allow(dead_code)] + +// Checks that visibility information is present in the debuginfo for crate-visibility structs. + +mod module { + use std::hint::black_box; + + pub(crate) struct CrateFooStruct { + x: u32, + } + + // CHECK: {{!.*}} = !DICompositeType(tag: DW_TAG_structure_type, name: "CrateFooStruct"{{.*}}flags: DIFlagProtected{{.*}}) + + pub fn use_everything() { + black_box(CrateFooStruct { x: 2 }); + } +} + +fn main() { + module::use_everything(); +} diff --git a/tests/codegen/debug-accessibility/private-enum.rs b/tests/codegen/debug-accessibility/private-enum.rs new file mode 100644 index 000000000..7f81026dd --- /dev/null +++ b/tests/codegen/debug-accessibility/private-enum.rs @@ -0,0 +1,21 @@ +// compile-flags: -C debuginfo=2 +// ignore-tidy-linelength + +#![allow(dead_code)] + +// Checks that visibility information is present in the debuginfo for private enums. + +use std::hint::black_box; + +enum PrivateFooEnum { + A, + B(u32), + C { x: u32 }, +} + +// NONMSVC: {{!.*}} = !DICompositeType(tag: DW_TAG_structure_type, name: "PrivateFooEnum"{{.*}}flags: DIFlagPrivate{{.*}}) +// MSVC: {{!.*}} = !DICompositeType(tag: DW_TAG_union_type, name: "enum2$"{{.*}}flags: DIFlagPrivate{{.*}}) + +fn main() { + black_box(PrivateFooEnum::A); +} diff --git a/tests/codegen/debug-accessibility/private-struct.rs b/tests/codegen/debug-accessibility/private-struct.rs new file mode 100644 index 000000000..43b260f90 --- /dev/null +++ b/tests/codegen/debug-accessibility/private-struct.rs @@ -0,0 +1,17 @@ +// compile-flags: -C debuginfo=2 + +#![allow(dead_code)] + +// Checks that visibility information is present in the debuginfo for private structs. + +use std::hint::black_box; + +struct PrivateFooStruct { + x: u32, +} + +// CHECK: {{!.*}} = !DICompositeType(tag: DW_TAG_structure_type, name: "PrivateFooStruct"{{.*}}flags: DIFlagPrivate{{.*}}) + +fn main() { + black_box(PrivateFooStruct { x: 1 }); +} diff --git a/tests/codegen/debug-accessibility/public-enum.rs b/tests/codegen/debug-accessibility/public-enum.rs new file mode 100644 index 000000000..29ae5fd64 --- /dev/null +++ b/tests/codegen/debug-accessibility/public-enum.rs @@ -0,0 +1,21 @@ +// compile-flags: -C debuginfo=2 +// ignore-tidy-linelength + +#![allow(dead_code)] + +// Checks that visibility information is present in the debuginfo for types and their fields. + +use std::hint::black_box; + +pub enum PublicFooEnum { + A, + B(u32), + C { x: u32 }, +} + +// NONMSVC: {{!.*}} = !DICompositeType(tag: DW_TAG_structure_type, name: "PublicFooEnum"{{.*}}flags: DIFlagPublic{{.*}}) +// MSVC: {{!.*}} = !DICompositeType(tag: DW_TAG_union_type, name: "enum2$"{{.*}}flags: DIFlagPublic{{.*}}) + +fn main() { + black_box(PublicFooEnum::A); +} diff --git a/tests/codegen/debug-accessibility/public-struct.rs b/tests/codegen/debug-accessibility/public-struct.rs new file mode 100644 index 000000000..e7cd9b40d --- /dev/null +++ b/tests/codegen/debug-accessibility/public-struct.rs @@ -0,0 +1,17 @@ +// compile-flags: -C debuginfo=2 + +#![allow(dead_code)] + +// Checks that visibility information is present in the debuginfo for public structs. + +use std::hint::black_box; + +pub struct PublicFooStruct { + x: u32, +} + +// CHECK: {{!.*}} = !DICompositeType(tag: DW_TAG_structure_type, name: "PublicFooStruct"{{.*}}flags: DIFlagPublic{{.*}}) + +fn main() { + black_box(PublicFooStruct { x: 4 }); +} diff --git a/tests/codegen/debug-accessibility/struct-fields.rs b/tests/codegen/debug-accessibility/struct-fields.rs new file mode 100644 index 000000000..76831bdc6 --- /dev/null +++ b/tests/codegen/debug-accessibility/struct-fields.rs @@ -0,0 +1,30 @@ +// compile-flags: -C debuginfo=2 + +#![allow(dead_code)] + +// Checks that visibility information is present in the debuginfo for struct fields. + +mod module { + use std::hint::black_box; + + struct StructFields { + a: u32, + pub(crate) b: u32, + pub(super) c: u32, + pub d: u32, + } + + // CHECK: [[StructFields:!.*]] = !DICompositeType(tag: DW_TAG_structure_type, name: "StructFields"{{.*}}flags: DIFlagPrivate{{.*}}) + // CHECK: {{!.*}} = !DIDerivedType(tag: DW_TAG_member, name: "a", scope: [[StructFields]]{{.*}}flags: DIFlagPrivate{{.*}}) + // CHECK: {{!.*}} = !DIDerivedType(tag: DW_TAG_member, name: "b", scope: [[StructFields]]{{.*}}flags: DIFlagProtected{{.*}}) + // CHECK: {{!.*}} = !DIDerivedType(tag: DW_TAG_member, name: "c", scope: [[StructFields]]{{.*}}flags: DIFlagProtected{{.*}}) + // CHECK: {{!.*}} = !DIDerivedType(tag: DW_TAG_member, name: "d", scope: [[StructFields]]{{.*}}flags: DIFlagPublic{{.*}}) + + pub fn use_everything() { + black_box(StructFields { a: 1, b: 2, c: 3, d: 4 }); + } +} + +fn main() { + module::use_everything(); +} diff --git a/tests/codegen/debug-accessibility/super-enum.rs b/tests/codegen/debug-accessibility/super-enum.rs new file mode 100644 index 000000000..9d83fb45b --- /dev/null +++ b/tests/codegen/debug-accessibility/super-enum.rs @@ -0,0 +1,27 @@ +// compile-flags: -C debuginfo=2 +// ignore-tidy-linelength + +#![allow(dead_code)] + +// Checks that visibility information is present in the debuginfo for super-visibility enums. + +mod module { + use std::hint::black_box; + + pub(super) enum SuperFooEnum { + A, + B(u32), + C { x: u32 }, + } + + // NONMSVC: {{!.*}} = !DICompositeType(tag: DW_TAG_structure_type, name: "SuperFooEnum"{{.*}}flags: DIFlagProtected{{.*}}) + // MSVC: {{!.*}} = !DICompositeType(tag: DW_TAG_union_type, name: "enum2$"{{.*}}flags: DIFlagProtected{{.*}}) + + pub fn use_everything() { + black_box(SuperFooEnum::A); + } +} + +fn main() { + module::use_everything(); +} diff --git a/tests/codegen/debug-accessibility/super-struct.rs b/tests/codegen/debug-accessibility/super-struct.rs new file mode 100644 index 000000000..481006c39 --- /dev/null +++ b/tests/codegen/debug-accessibility/super-struct.rs @@ -0,0 +1,23 @@ +// compile-flags: -C debuginfo=2 + +#![allow(dead_code)] + +// Checks that visibility information is present in the debuginfo for super-visibility structs. + +mod module { + use std::hint::black_box; + + pub(super) struct SuperFooStruct { + x: u32, + } + + // CHECK: {{!.*}} = !DICompositeType(tag: DW_TAG_structure_type, name: "SuperFooStruct"{{.*}}flags: DIFlagProtected{{.*}}) + + pub fn use_everything() { + black_box(SuperFooStruct { x: 3 }); + } +} + +fn main() { + module::use_everything(); +} diff --git a/tests/codegen/debug-accessibility/tuple-fields.rs b/tests/codegen/debug-accessibility/tuple-fields.rs new file mode 100644 index 000000000..1163ba2c7 --- /dev/null +++ b/tests/codegen/debug-accessibility/tuple-fields.rs @@ -0,0 +1,24 @@ +// compile-flags: -C debuginfo=2 + +#![allow(dead_code)] + +// Checks that visibility information is present in the debuginfo for tuple struct fields. + +mod module { + use std::hint::black_box; + + struct TupleFields(u32, pub(crate) u32, pub(super) u32, pub u32); + + // CHECK: [[TupleFields:!.*]] = !DICompositeType(tag: DW_TAG_structure_type, name: "TupleFields"{{.*}}flags: DIFlagPrivate{{.*}}) + // CHECK: {{!.*}} = !DIDerivedType(tag: DW_TAG_member, name: "__0", scope: [[TupleFields]]{{.*}}flags: DIFlagPrivate{{.*}}) + // CHECK: {{!.*}} = !DIDerivedType(tag: DW_TAG_member, name: "__1", scope: [[TupleFields]]{{.*}}flags: DIFlagProtected{{.*}}) + // CHECK: {{!.*}} = !DIDerivedType(tag: DW_TAG_member, name: "__2", scope: [[TupleFields]]{{.*}}flags: DIFlagProtected{{.*}}) + // CHECK: {{!.*}} = !DIDerivedType(tag: DW_TAG_member, name: "__3", scope: [[TupleFields]]{{.*}}flags: DIFlagPublic{{.*}}) + pub fn use_everything() { + black_box(TupleFields(1, 2, 3, 4)); + } +} + +fn main() { + module::use_everything(); +} -- cgit v1.2.3