brintos

brintos / llvm-project-archived public Read only

0
0
Text · 7.4 KiB · 6204cbd Raw
167 lines · cpp
1// clang-format off2// REQUIRES: lld, x863 4// RUN: %clang_cl --target=x86_64-windows-msvc -Od -Z7 -c /GR- /Fo%t.obj -- %s5// RUN: lld-link -debug:full -nodefaultlib -entry:main %t.obj -out:%t.exe -pdb:%t.pdb6 7// RUN: lldb-test symbols --find=function --name=main --function-flags=full %t.exe \8// RUN:     | FileCheck %s --check-prefix=FIND-MAIN9// RUN: lldb-test symbols --find=function --name=main --function-flags=method %t.exe \10// RUN:     | FileCheck %s --check-prefix=FIND-NO-FUNCTION11// RUN: lldb-test symbols --find=function --name=main --function-flags=base %t.exe \12// RUN:     | FileCheck %s --check-prefix=FIND-MAIN13 14// RUN: lldb-test symbols --find=function --name=static_fn --function-flags=full %t.exe \15// RUN:     | FileCheck %s --check-prefix=FIND-STATIC16// RUN: lldb-test symbols --find=function --name=static_fn --function-flags=method %t.exe \17// RUN:     | FileCheck %s --check-prefix=FIND-NO-FUNCTION18// RUN: lldb-test symbols --find=function --name=static_fn --function-flags=base %t.exe \19// RUN:     | FileCheck %s --check-prefix=FIND-STATIC20 21// RUN: lldb-test symbols --find=function --name=varargs_fn --function-flags=full %t.exe \22// RUN:     | FileCheck %s --check-prefix=FIND-VAR23// RUN: lldb-test symbols --find=function --name=varargs_fn --function-flags=method %t.exe \24// RUN:     | FileCheck %s --check-prefix=FIND-NO-FUNCTION25// RUN: lldb-test symbols --find=function --name=varargs_fn --function-flags=base %t.exe \26// RUN:     | FileCheck %s --check-prefix=FIND-VAR27 28// RUN: lldb-test symbols --find=function --name=Struct::simple_method --function-flags=full %t.exe \29// RUN:     | FileCheck %s --check-prefix=FIND-SIMPLE30// RUN: lldb-test symbols --find=function --name=Struct::simple_method --function-flags=method %t.exe \31// RUN:     | FileCheck %s --check-prefix=FIND-SIMPLE32// RUN: lldb-test symbols --find=function --name=Struct::simple_method --function-flags=base %t.exe \33// RUN:     | FileCheck %s --check-prefix=FIND-SIMPLE34 35// RUN: lldb-test symbols --find=function --name=Struct::virtual_method --function-flags=full %t.exe \36// RUN:     | FileCheck %s --check-prefix=FIND-VIRTUAL37// RUN: lldb-test symbols --find=function --name=Struct::virtual_method --function-flags=method %t.exe \38// RUN:     | FileCheck %s --check-prefix=FIND-VIRTUAL39// RUN: lldb-test symbols --find=function --name=Struct::virtual_method --function-flags=base %t.exe \40// RUN:     | FileCheck %s --check-prefix=FIND-VIRTUAL41 42// RUN: lldb-test symbols --find=function --name=Struct::static_method --function-flags=full %t.exe \43// RUN:     | FileCheck %s --check-prefix=FIND-STATIC-METHOD44// RUN: lldb-test symbols --find=function --name=Struct::static_method --function-flags=method %t.exe \45// RUN:     | FileCheck %s --check-prefix=FIND-NO-FUNCTION46// RUN: lldb-test symbols --find=function --name=Struct::static_method --function-flags=base %t.exe \47// RUN:     | FileCheck %s --check-prefix=FIND-STATIC-METHOD48 49// RUN: lldb-test symbols --find=function --name=Struct::overloaded_method --function-flags=full %t.exe \50// RUN:     | FileCheck %s --check-prefix=FIND-OVERLOAD-FULL51// RUN: lldb-test symbols --find=function --name=Struct::overloaded_method --function-flags=method %t.exe \52// RUN:     | FileCheck %s --check-prefix=FIND-OVERLOAD-METHOD53// RUN: lldb-test symbols --find=function --name=Struct::overloaded_method --function-flags=base %t.exe \54// RUN:     | FileCheck %s --check-prefix=FIND-OVERLOAD-BASE55 56struct Struct {57  int simple_method() {58    return 1;59  }60 61  virtual int virtual_method() {62    return 2;63  }64 65  static int static_method() {66    return 3;67  }68 69  int overloaded_method() {70    return 4 + overloaded_method('a') + overloaded_method('a', 1);71  }72protected:73  virtual int overloaded_method(char c) {74    return 5;75  }76private:77  static int overloaded_method(char c, int i, ...) {78    return 6;79  }80};81 82class Class {83public:84  bool overloaded_method() {85    return false;86  }87  bool overloaded_method(int i) {88    return i > 0;89  }90  static int overloaded_method(bool b) {91    return b ? 1 : 2;92  }93};94 95char overloaded_method() {96  return 0;97}98char overloaded_method(int i) {99  return 0;100}101 102Struct s;103Class c;104 105static int static_fn() {106  return 42;107}108 109int varargs_fn(int x, int y, ...) {110  return x + y;111}112 113int main(int argc, char **argv) {114  return static_fn() + varargs_fn(argc, argc) + s.simple_method() +115  Struct::static_method() + s.virtual_method() + s.overloaded_method() + 116  Class::overloaded_method(false) + c.overloaded_method(1) + c.overloaded_method() 117  + overloaded_method() + overloaded_method(1);118}119 120// FIND-MAIN:      Function: id = {{.*}}, name = "main"121// FIND-MAIN-NEXT: FuncType: id = {{.*}}, compiler_type = "int (int, char **)"122 123// FIND-NO-FUNCTION: Found 0 functions124 125// FIND-STATIC:      Function: id = {{.*}}, name = "{{.*}}static_fn{{.*}}"126// FIND-STATIC-NEXT: FuncType: id = {{.*}}, compiler_type = "int (void)"127 128// FIND-VAR:      Function: id = {{.*}}, name = "{{.*}}varargs_fn{{.*}}"129// FIND-VAR-NEXT: FuncType: id = {{.*}}, compiler_type = "int (int, int, ...)"130 131// FIND-SIMPLE:      Function: id = {{.*}}, name = "{{.*}}Struct::simple_method{{.*}}"132// FIND-SIMPLE-NEXT: FuncType: id = {{.*}}, compiler_type = "int (void)"133 134// FIND-VIRTUAL:      Function: id = {{.*}}, name = "{{.*}}Struct::virtual_method{{.*}}"135// FIND-VIRTUAL-NEXT: FuncType: id = {{.*}}, compiler_type = "int (void)"136 137// FIND-STATIC-METHOD:      Function: id = {{.*}}, name = "{{.*}}Struct::static_method{{.*}}"138// FIND-STATIC-METHOD-NEXT: FuncType: id = {{.*}}, compiler_type = "int (void)"139 140// FIND-OVERLOAD-FULL-NOT: "Class::overloaded_method"141// FIND-OVERLOAD-FULL-NOT: "overloaded_method"142// FIND-OVERLOAD-FULL-DAG: Function: id = {{.*}}, name = "{{.*}}Struct::overloaded_method{{.*}}"143// FIND-OVERLOAD-FULL-DAG: FuncType: id = {{.*}}, compiler_type = "int (void)"144// FIND-OVERLOAD-FULL-DAG: FuncType: id = {{.*}}, compiler_type = "int (char)"145// FIND-OVERLOAD-FULL-DAG: FuncType: id = {{.*}}, compiler_type = "int (char, int, ...)"146 147// FIND-OVERLOAD-BASE-DAG: Function: id = {{.*}}, name = "{{.*}}Struct::overloaded_method{{.*}}"148// FIND-OVERLOAD-BASE-DAG: FuncType: id = {{.*}}, compiler_type = "int (void)"149// FIND-OVERLOAD-BASE-DAG: FuncType: id = {{.*}}, compiler_type = "int (char)"150// FIND-OVERLOAD-BASE-DAG: FuncType: id = {{.*}}, compiler_type = "int (char, int, ...)"151// FIND-OVERLOAD-BASE-DAG: Function: id = {{.*}}, name = "int Class::overloaded_method(bool)"152// FIND-OVERLOAD-BASE-DAG: FuncType: id = {{.*}}, compiler_type = "_Bool (void)"153// FIND-OVERLOAD-BASE-DAG: FuncType: id = {{.*}}, compiler_type = "_Bool (int)"154// FIND-OVERLOAD-BASE-DAG: FuncType: id = {{.*}}, compiler_type = "int (_Bool)"155// FIND-OVERLOAD-BASE-DAG: Function: id = {{.*}}, name = "char overloaded_method(void)"156// FIND-OVERLOAD-BASE-DAG: Function: id = {{.*}}, name = "char overloaded_method(int)"157// FIND-OVERLOAD-BASE-DAG: FuncType: id = {{.*}}, compiler_type = "char (void)"158// FIND-OVERLOAD-BASE-DAG: FuncType: id = {{.*}}, compiler_type = "char (int)"159 160// FIND-OVERLOAD-METHOD-NOT: "overloaded_method"161// FIND-OVERLOAD-METHOD-DAG: Function: id = {{.*}}, name = "{{.*}}Struct::overloaded_method{{.*}}"162// FIND-OVERLOAD-METHOD-DAG: FuncType: id = {{.*}}, compiler_type = "int (void)"163// FIND-OVERLOAD-METHOD-DAG: FuncType: id = {{.*}}, compiler_type = "int (char)"164// FIND-OVERLOAD-METHOD-DAG: Function: id = {{.*}}, name = "bool Class::overloaded_method(void)"165// FIND-OVERLOAD-METHOD-DAG: FuncType: id = {{.*}}, compiler_type = "_Bool (void)"166// FIND-OVERLOAD-METHOD-DAG: FuncType: id = {{.*}}, compiler_type = "_Bool (int)"167