[DFAJumpThreading] Remove incoming StartBlock from all phis when unfolding select...
[llvm-project.git] / clang / test / CodeGenCXX / debug-info-codeview-unnamed.cpp
blob9602ac1b024973012c29d2783bab94b277a3fd7a
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[]) {
5 //
6 // LINUX: [[TYPE_OF_ONE:![0-9]+]] = distinct !DICompositeType(
7 // LINUX-SAME: tag: DW_TAG_structure_type
8 // LINUX-NOT: name:
9 // LINUX-NOT: identifier:
10 // LINUX-SAME: )
12 // MSVC: [[TYPE_OF_ONE:![0-9]+]] = distinct !DICompositeType
13 // MSVC-SAME: tag: DW_TAG_structure_type
14 // MSVC-SAME: name: "<unnamed-type-one>"
15 // MSVC-SAME: identifier: ".?AU<unnamed-type-one>@?1??main@@9@"
16 // MSVC-SAME: )
20 // LINUX: [[TYPE_OF_TWO:![0-9]+]] = distinct !DICompositeType(
21 // LINUX-SAME: tag: DW_TAG_structure_type
22 // LINUX-NOT: name:
23 // LINUX-NOT: identifier:
24 // LINUX-SAME: )
26 // MSVC: [[TYPE_OF_TWO:![0-9]+]] = distinct !DICompositeType
27 // MSVC-SAME: tag: DW_TAG_structure_type
28 // MSVC-SAME: name: "<unnamed-type-two>"
29 // MSVC-SAME: identifier: ".?AU<unnamed-type-two>@?2??main@@9@"
30 // MSVC-SAME: )
34 // LINUX: [[TYPE_OF_THREE:![0-9]+]] = distinct !DICompositeType(
35 // LINUX-SAME: tag: DW_TAG_structure_type
36 // LINUX-SAME: name: "named"
37 // LINUX-NOT: identifier:
38 // LINUX-SAME: )
40 // MSVC: [[TYPE_OF_THREE:![0-9]+]] = distinct !DICompositeType
41 // MSVC-SAME: tag: DW_TAG_structure_type
42 // MSVC-SAME: name: "named"
43 // MSVC-SAME: identifier: ".?AUnamed@?1??main@@9@"
44 // MSVC-SAME: )
47 // LINUX: [[TYPE_OF_FOUR:![0-9]+]] = distinct !DICompositeType(
48 // LINUX-SAME: tag: DW_TAG_class_type
49 // LINUX-NOT: name:
50 // LINUX-NOT: identifier:
51 // LINUX-SAME: )
53 // MSVC: [[TYPE_OF_FOUR:![0-9]+]] = distinct !DICompositeType
54 // MSVC-SAME: tag: DW_TAG_class_type
55 // MSVC-SAME: name: "<lambda_0>"
56 // MSVC-SAME: identifier: ".?AV<lambda_0>@?0??main@@9@"
57 // MSVC-SAME: )
60 // In CodeView, the LF_MFUNCTION entry for "bar()" refers to the forward
61 // reference of the unnamed struct. Visual Studio requires a unique
62 // identifier to match the LF_STRUCTURE forward reference to the definition.
64 struct { void bar() {} } one;
66 // LINUX: !{{[0-9]+}} = !DILocalVariable(name: "one"
67 // LINUX-SAME: type: [[TYPE_OF_ONE]]
68 // LINUX-SAME: )
70 // MSVC: !{{[0-9]+}} = !DILocalVariable(name: "one"
71 // MSVC-SAME: type: [[TYPE_OF_ONE]]
72 // MSVC-SAME: )
75 // In CodeView, the LF_POINTER entry for "ptr2unnamed" refers to the forward
76 // reference of the unnamed struct. Visual Studio requires a unique
77 // identifier to match the LF_STRUCTURE forward reference to the definition.
79 struct { int bar; } two = { 42 };
80 int decltype(two)::*ptr2unnamed = &decltype(two)::bar;
82 // LINUX: !{{[0-9]+}} = !DILocalVariable(name: "two"
83 // LINUX-SAME: type: [[TYPE_OF_TWO]]
84 // LINUX-SAME: )
86 // MSVC: !{{[0-9]+}} = !DILocalVariable(name: "two"
87 // MSVC-SAME: type: [[TYPE_OF_TWO]]
88 // MSVC-SAME: )
91 // In DWARF, named structures which are not externally visibile do not
92 // require an identifier. In CodeView, named structures are given an
93 // identifier.
95 struct named { int bar; int named::* p2mem; } three = { 42, &named::bar };
97 // LINUX: !{{[0-9]+}} = !DILocalVariable(name: "three"
98 // LINUX-SAME: type: [[TYPE_OF_THREE]]
99 // LINUX-SAME: )
101 // MSVC: !{{[0-9]+}} = !DILocalVariable(name: "three"
102 // MSVC-SAME: type: [[TYPE_OF_THREE]]
103 // MSVC-SAME: )
106 // In CodeView, the LF_MFUNCTION entry for the lambda "operator()" routine
107 // refers to the forward reference of the unnamed LF_CLASS for the lambda.
108 // Visual Studio requires a unique identifier to match the forward reference
109 // of the LF_CLASS to its definition.
111 auto four = [argc](int i) -> int { return argc == i ? 1 : 0; };
113 // LINUX: !{{[0-9]+}} = !DILocalVariable(name: "four"
114 // LINUX-SAME: type: [[TYPE_OF_FOUR]]
115 // LINUX-SAME: )
117 // MSVC: !{{[0-9]+}} = !DILocalVariable(name: "four"
118 // MSVC-SAME: type: [[TYPE_OF_FOUR]]
119 // MSVC-SAME: )
121 return 0;