summaryrefslogtreecommitdiffstats
path: root/tests/codegen/debug-linkage-name.rs
blob: 9011a7da51db8e72e8f755c953b45f6ae4199818 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
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 "C" fn e() {}

    // CHECK: !DISubprogram(name: "f",
    // CHECK-NOT:           linkageName:
    // CHECK-SAME:          line: 35,
    #[no_mangle]
    pub extern "C" fn f() {}

    // CHECK: !DISubprogram(name: "g",
    // CHECK-NOT:           linkageName:
    // CHECK-SAME:          line: 41,
    #[export_name = "g"]
    pub extern "C" fn g() {}
}