1 // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -debug-info-kind=limited -S -emit-llvm -std=c++11 -o - %s | FileCheck --check-prefix LINUX %s
2 // RUN: %clang_cc1 -triple x86_64-windows-msvc -debug-info-kind=limited -gcodeview -S -emit-llvm -std=c++11 -o - %s | FileCheck --check-prefix MSVC %s
4 int main(int argc
, char* argv
[], char* arge
[]) {
6 // In CodeView, the LF_MFUNCTION entry for "bar()" refers to the forward
7 // reference of the unnamed struct. Visual Studio requires a unique
8 // identifier to match the LF_STRUCTURE forward reference to the definition.
10 struct { void bar() {} } one
;
12 // LINUX: !{{[0-9]+}} = !DILocalVariable(name: "one"
13 // LINUX-SAME: type: [[TYPE_OF_ONE:![0-9]+]]
15 // LINUX: [[TYPE_OF_ONE]] = distinct !DICompositeType(
16 // LINUX-SAME: tag: DW_TAG_structure_type
18 // LINUX-NOT: identifier:
21 // MSVC: !{{[0-9]+}} = !DILocalVariable(name: "one"
22 // MSVC-SAME: type: [[TYPE_OF_ONE:![0-9]+]]
24 // MSVC: [[TYPE_OF_ONE]] = distinct !DICompositeType
25 // MSVC-SAME: tag: DW_TAG_structure_type
26 // MSVC-SAME: name: "<unnamed-type-one>"
27 // MSVC-SAME: identifier: ".?AU<unnamed-type-one>@?1??main@@9@"
31 // In CodeView, the LF_POINTER entry for "ptr2unnamed" refers to the forward
32 // reference of the unnamed struct. Visual Studio requires a unique
33 // identifier to match the LF_STRUCTURE forward reference to the definition.
35 struct { int bar
; } two
= { 42 };
36 int decltype(two
)::*ptr2unnamed
= &decltype(two
)::bar
;
38 // LINUX: !{{[0-9]+}} = !DILocalVariable(name: "two"
39 // LINUX-SAME: type: [[TYPE_OF_TWO:![0-9]+]]
41 // LINUX: [[TYPE_OF_TWO]] = distinct !DICompositeType(
42 // LINUX-SAME: tag: DW_TAG_structure_type
44 // LINUX-NOT: identifier:
47 // MSVC: !{{[0-9]+}} = !DILocalVariable(name: "two"
48 // MSVC-SAME: type: [[TYPE_OF_TWO:![0-9]+]]
50 // MSVC: [[TYPE_OF_TWO]] = distinct !DICompositeType
51 // MSVC-SAME: tag: DW_TAG_structure_type
52 // MSVC-SAME: name: "<unnamed-type-two>"
53 // MSVC-SAME: identifier: ".?AU<unnamed-type-two>@?2??main@@9@"
57 // In DWARF, named structures which are not externally visibile do not
58 // require an identifier. In CodeView, named structures are given an
61 struct named
{ int bar
; int named::* p2mem
; } three
= { 42, &named::bar
};
63 // LINUX: !{{[0-9]+}} = !DILocalVariable(name: "three"
64 // LINUX-SAME: type: [[TYPE_OF_THREE:![0-9]+]]
66 // LINUX: [[TYPE_OF_THREE]] = distinct !DICompositeType(
67 // LINUX-SAME: tag: DW_TAG_structure_type
68 // LINUX-SAME: name: "named"
69 // LINUX-NOT: identifier:
72 // MSVC: !{{[0-9]+}} = !DILocalVariable(name: "three"
73 // MSVC-SAME: type: [[TYPE_OF_THREE:![0-9]+]]
75 // MSVC: [[TYPE_OF_THREE]] = distinct !DICompositeType
76 // MSVC-SAME: tag: DW_TAG_structure_type
77 // MSVC-SAME: name: "named"
78 // MSVC-SAME: identifier: ".?AUnamed@?1??main@@9@"
82 // In CodeView, the LF_MFUNCTION entry for the lambda "operator()" routine
83 // refers to the forward reference of the unnamed LF_CLASS for the lambda.
84 // Visual Studio requires a unique identifier to match the forward reference
85 // of the LF_CLASS to its definition.
87 auto four
= [argc
](int i
) -> int { return argc
== i
? 1 : 0; };
89 // LINUX: !{{[0-9]+}} = !DILocalVariable(name: "four"
90 // LINUX-SAME: type: [[TYPE_OF_FOUR:![0-9]+]]
92 // LINUX: [[TYPE_OF_FOUR]] = distinct !DICompositeType(
93 // LINUX-SAME: tag: DW_TAG_class_type
95 // LINUX-NOT: identifier:
98 // MSVC: !{{[0-9]+}} = !DILocalVariable(name: "four"
99 // MSVC-SAME: type: [[TYPE_OF_FOUR:![0-9]+]]
101 // MSVC: [[TYPE_OF_FOUR]] = distinct !DICompositeType
102 // MSVC-SAME: tag: DW_TAG_class_type
103 // MSVC-SAME: name: "<lambda_0>"
104 // MSVC-SAME: identifier: ".?AV<lambda_0>@?0??main@@9@"