brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.4 KiB · 30815bd Raw
110 lines · cpp
1// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -debug-info-kind=limited -emit-llvm -std=c++11 -o - %s | FileCheck --check-prefix LINUX %s2// RUN: %clang_cc1 -triple x86_64-windows-msvc -debug-info-kind=limited -gcodeview -emit-llvm -std=c++11 -o - %s | FileCheck --check-prefix MSVC %s3// RUN: %clang_cc1 -triple x86_64-uefi -debug-info-kind=limited -gcodeview -emit-llvm -std=c++11 -o - %s | FileCheck --check-prefix MSVC %s4 5int main(int argc, char* argv[], char* arge[]) {6  //7  // In CodeView, the LF_MFUNCTION entry for "bar()" refers to the forward8  // reference of the unnamed struct. Visual Studio requires a unique9  // identifier to match the LF_STRUCTURE forward reference to the definition.10  //11  struct { void bar() {} } one;12  //13  // LINUX:      !{{[0-9]+}} = !DILocalVariable(name: "one"14  // LINUX-SAME:     type: [[TYPE_OF_ONE:![0-9]+]]15  // LINUX-SAME:     )16  // LINUX:      [[TYPE_OF_ONE]] = distinct !DICompositeType(17  // LINUX-SAME:     tag: DW_TAG_structure_type18  // LINUX-NOT:      name:19  // LINUX-NOT:      identifier:20  // LINUX-SAME:     )21  //22  // MSVC:       !{{[0-9]+}} = !DILocalVariable(name: "one"23  // MSVC-SAME:      type: [[TYPE_OF_ONE:![0-9]+]]24  // MSVC-SAME:      )25  // MSVC:       [[TYPE_OF_ONE]] = distinct !DICompositeType26  // MSVC-SAME:      tag: DW_TAG_structure_type27  // MSVC-SAME:      name: "<unnamed-type-one>"28  // MSVC-SAME:      identifier: ".?AU<unnamed-type-one>@?1??main@@9@"29  // MSVC-SAME:      )30 31 32  // In CodeView, the LF_POINTER entry for "ptr2unnamed" refers to the forward33  // reference of the unnamed struct. Visual Studio requires a unique34  // identifier to match the LF_STRUCTURE forward reference to the definition.35  //36  struct { int bar; } two = { 42 };37  int decltype(two)::*ptr2unnamed = &decltype(two)::bar;38  //39  // LINUX:      !{{[0-9]+}} = !DILocalVariable(name: "two"40  // LINUX-SAME:     type: [[TYPE_OF_TWO:![0-9]+]]41  // LINUX-SAME:     )42  // LINUX:      [[TYPE_OF_TWO]] = distinct !DICompositeType(43  // LINUX-SAME:     tag: DW_TAG_structure_type44  // LINUX-NOT:      name:45  // LINUX-NOT:      identifier:46  // LINUX-SAME:     )47  //48  // MSVC:       !{{[0-9]+}} = !DILocalVariable(name: "two"49  // MSVC-SAME:      type: [[TYPE_OF_TWO:![0-9]+]]50  // MSVC-SAME:      )51  // MSVC:       [[TYPE_OF_TWO]] = distinct !DICompositeType52  // MSVC-SAME:      tag: DW_TAG_structure_type53  // MSVC-SAME:      name: "<unnamed-type-two>"54  // MSVC-SAME:      identifier: ".?AU<unnamed-type-two>@?2??main@@9@"55  // MSVC-SAME:      )56 57 58  // In DWARF, named structures which are not externally visibile do not59  // require an identifier.  In CodeView, named structures are given an60  // identifier.61  //62  struct named { int bar; int named::* p2mem; } three = { 42, &named::bar };63  //64  // LINUX:      !{{[0-9]+}} = !DILocalVariable(name: "three"65  // LINUX-SAME:     type: [[TYPE_OF_THREE:![0-9]+]]66  // LINUX-SAME:     )67  // LINUX:      [[TYPE_OF_THREE]] = distinct !DICompositeType(68  // LINUX-SAME:     tag: DW_TAG_structure_type69  // LINUX-SAME:     name: "named"70  // LINUX-NOT:      identifier:71  // LINUX-SAME:     )72  //73  // MSVC:       !{{[0-9]+}} = !DILocalVariable(name: "three"74  // MSVC-SAME:      type: [[TYPE_OF_THREE:![0-9]+]]75  // MSVC-SAME:      )76  // MSVC:       [[TYPE_OF_THREE]] = distinct !DICompositeType77  // MSVC-SAME:      tag: DW_TAG_structure_type78  // MSVC-SAME:      name: "named"79  // MSVC-SAME:      identifier: ".?AUnamed@?1??main@@9@"80  // MSVC-SAME:      )81 82 83  // In CodeView, the LF_MFUNCTION entry for the lambda "operator()" routine84  // refers to the forward reference of the unnamed LF_CLASS for the lambda.85  // Visual Studio requires a unique identifier to match the forward reference86  // of the LF_CLASS to its definition.87  //88  auto four = [argc](int i) -> int { return argc == i ? 1 : 0; };89  //90  // LINUX:      !{{[0-9]+}} = !DILocalVariable(name: "four"91  // LINUX-SAME:     type: [[TYPE_OF_FOUR:![0-9]+]]92  // LINUX-SAME:     )93  // LINUX:      [[TYPE_OF_FOUR]] = distinct !DICompositeType(94  // LINUX-SAME:     tag: DW_TAG_class_type95  // LINUX-NOT:      name:96  // LINUX-NOT:      identifier:97  // LINUX-SAME:     )98  //99  // MSVC:       !{{[0-9]+}} = !DILocalVariable(name: "four"100  // MSVC-SAME:      type: [[TYPE_OF_FOUR:![0-9]+]]101  // MSVC-SAME:      )102  // MSVC:       [[TYPE_OF_FOUR]] = distinct !DICompositeType103  // MSVC-SAME:      tag: DW_TAG_class_type104  // MSVC-SAME:      name: "<lambda_0>"105  // MSVC-SAME:      identifier: ".?AV<lambda_0>@?0??main@@9@"106  // MSVC-SAME:      )107 108  return 0;109}110