summary refs log tree commit diff
path: root/src/test/codegen
diff options
context:
space:
mode:
authorManish Goregaokar <manishsmail@gmail.com>2020-06-26 00:38:56 -0700
committerGitHub <noreply@github.com>2020-06-26 00:38:56 -0700
commit14dc103a85694a67e25ade61c3af4db234b14a9a (patch)
tree76165d29e754116d7092ba34c7767177f4dd05c5 /src/test/codegen
parente093b6525079cb71d4158f97480ac6f6ce311eac (diff)
parente4b7d2c5071d1066159702d8176c6d87d843403e (diff)
downloadrust-14dc103a85694a67e25ade61c3af4db234b14a9a.tar.gz
rust-14dc103a85694a67e25ade61c3af4db234b14a9a.zip
Rollup merge of #72620 - tmiasko:linkage-name, r=eddyb
Omit DW_AT_linkage_name when it is the same as DW_AT_name

The DWARF standard suggests that it might be useful to include
`DW_AT_linkage_name` when it is *distinct* from the identifier name.

Fixes #46487.
Fixes #59422.
Diffstat (limited to 'src/test/codegen')
-rw-r--r--src/test/codegen/debug-linkage-name.rs42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/test/codegen/debug-linkage-name.rs b/src/test/codegen/debug-linkage-name.rs
new file mode 100644
index 00000000000..0d7dca3aba3
--- /dev/null
+++ b/src/test/codegen/debug-linkage-name.rs
@@ -0,0 +1,42 @@
+// Verifies that linkage name is omitted when it is
+// the same as variable / function name.
+//
+// compile-flags: -C no-prepopulate-passes
+// compile-flags: -C debuginfo=2
+#![crate_type = "lib"]
+
+pub mod xyz {
+    // CHECK: !DIGlobalVariable(name: "A",
+    // CHECK:                   linkageName:
+    // CHECK-SAME:              line: 12,
+    pub static A: u32 = 1;
+
+    // CHECK: !DIGlobalVariable(name: "B",
+    // CHECK-NOT:               linkageName:
+    // CHECK-SAME:              line: 18,
+    #[no_mangle]
+    pub static B: u32 = 2;
+
+    // CHECK: !DIGlobalVariable(name: "C",
+    // CHECK-NOT:               linkageName:
+    // CHECK-SAME:              line: 24,
+    #[export_name = "C"]
+    pub static C: u32 = 2;
+
+    // CHECK: !DISubprogram(name: "e",
+    // CHECK:               linkageName:
+    // CHECK-SAME:          line: 29,
+    pub extern fn e() {}
+
+    // CHECK: !DISubprogram(name: "f",
+    // CHECK-NOT:           linkageName:
+    // CHECK-SAME:          line: 35,
+    #[no_mangle]
+    pub extern fn f() {}
+
+    // CHECK: !DISubprogram(name: "g",
+    // CHECK-NOT:           linkageName:
+    // CHECK-SAME:          line: 41,
+    #[export_name = "g"]
+    pub extern fn g() {}
+}