[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / CodeGen / unique-internal-linkage-names-dwarf.c
blob5a401182450abcaf412f4a55ca4b81a70148408e
1 // This test checks if C functions with internal linkage names are mangled
2 // and the module hash suffixes attached including emitting DW_AT_linkage_name.
3 //
4 // RUN: %clang_cc1 -triple x86_64-unknown-linux -Wno-strict-prototypes -debug-info-kind=limited -dwarf-version=4 -emit-llvm -o - %s | FileCheck %s --check-prefix=PLAIN
5 // RUN: %clang_cc1 -triple x86_64-unknown-linux -Wno-strict-prototypes -debug-info-kind=limited -dwarf-version=4 -funique-internal-linkage-names -emit-llvm -o - %s | FileCheck %s --check-prefix=UNIQUE
6 //
7 // RUN: %clang_cc1 -triple x86_64-unknown-linux -Wno-strict-prototypes -debug-info-kind=limited -dwarf-version=5 -emit-llvm -o - %s | FileCheck %s --check-prefix=PLAIN
8 // RUN: %clang_cc1 -triple x86_64-unknown-linux -Wno-strict-prototypes -debug-info-kind=limited -dwarf-version=5 -funique-internal-linkage-names -emit-llvm -o - %s | FileCheck %s --check-prefix=UNIQUE
10 static int glob;
11 // foo should be given a uniquefied name under -funique-internal-linkage-names.
12 static int foo(void) {
13 return glob;
16 // K&R prototypes should be given uniquefied names under -funique-internal-linkage-names.
17 static int bar(a) int a;
19 return glob + a;
22 void baz(void) {
23 foo();
24 bar(1);
28 // PLAIN: @glob = internal global i32
29 // PLAIN: define internal i32 @foo()
30 // PLAIN: define internal i32 @bar(i32 noundef %a)
31 // PLAIN: distinct !DIGlobalVariable(name: "glob"{{.*}})
32 // PLAIN: distinct !DISubprogram(name: "foo"{{.*}})
33 // PLAIN: distinct !DISubprogram(name: "bar"{{.*}})
34 // PLAIN-NOT: linkageName:
36 // UNIQUE: @glob = internal global i32
37 // UNIQUE: define internal i32 @_ZL3foov.[[MODHASH:__uniq.[0-9]+]]()
38 // UNIQUE: define internal i32 @_ZL3bari.[[MODHASH]](i32 noundef %a)
39 // UNIQUE: distinct !DIGlobalVariable(name: "glob"{{.*}})
40 // UNIQUE: distinct !DISubprogram(name: "foo", linkageName: "_ZL3foov.[[MODHASH]]"{{.*}})
41 // UNIQUE: distinct !DISubprogram(name: "bar", linkageName: "_ZL3bari.[[MODHASH]]"{{.*}})