1// clang-format off
2// REQUIRES: lld, x86
3
4// RUN: %clang_cl --target=x86_64-windows-msvc -Od -Z7 -c /GR- /Fo%t.obj -- %s
5// RUN: lld-link -debug:full -nodefaultlib -entry:main %t.obj -out:%t.exe -pdb:%t.pdb
6
7// RUN: lldb-test symbols --find=function --name=main --function-flags=full %t.exe \
8// RUN: | FileCheck %s --check-prefix=FIND-MAIN
9
10// RUN: lldb-test symbols --find=function --name=static_fn --function-flags=full %t.exe \
11// RUN: | FileCheck %s --check-prefix=FIND-STATIC
12
13// RUN: lldb-test symbols --find=function --name=varargs_fn --function-flags=full %t.exe \
14// RUN: | FileCheck %s --check-prefix=FIND-VAR
15
16// RUN: lldb-test symbols --find=function --name=Struct::simple_method --function-flags=full %t.exe \
17// RUN: | FileCheck %s --check-prefix=FIND-SIMPLE
18
19// RUN: lldb-test symbols --find=function --name=Struct::virtual_method --function-flags=full %t.exe \
20// RUN: | FileCheck %s --check-prefix=FIND-VIRTUAL
21
22// RUN: lldb-test symbols --find=function --name=Struct::static_method --function-flags=full %t.exe \
23// RUN: | FileCheck %s --check-prefix=FIND-STATIC-METHOD
24
25// RUN: lldb-test symbols --find=function --name=Struct::overloaded_method --function-flags=full %t.exe \
26// RUN: | FileCheck %s --check-prefix=FIND-OVERLOAD
27
28struct Struct {
29 int simple_method() {
30 return 1;
31 }
32
33 virtual int virtual_method() {
34 return 2;
35 }
36
37 static int static_method() {
38 return 3;
39 }
40
41 int overloaded_method() {
42 return 4 + overloaded_method(c: 'a') + overloaded_method(c: 'a', i: 1);
43 }
44protected:
45 virtual int overloaded_method(char c) {
46 return 5;
47 }
48private:
49 static int overloaded_method(char c, int i, ...) {
50 return 6;
51 }
52};
53
54Struct s;
55
56static int static_fn() {
57 return 42;
58}
59
60int varargs_fn(int x, int y, ...) {
61 return x + y;
62}
63
64int main(int argc, char **argv) {
65 return static_fn() + varargs_fn(x: argc, y: argc) + s.simple_method() +
66 Struct::static_method() + s.virtual_method() + s.overloaded_method();
67}
68
69// FIND-MAIN: Function: id = {{.*}}, name = "main"
70// FIND-MAIN-NEXT: FuncType: id = {{.*}}, compiler_type = "int (int, char **)"
71
72// FIND-STATIC: Function: id = {{.*}}, name = "{{.*}}static_fn{{.*}}"
73// FIND-STATIC-NEXT: FuncType: id = {{.*}}, compiler_type = "int (void)"
74
75// FIND-VAR: Function: id = {{.*}}, name = "{{.*}}varargs_fn{{.*}}"
76// FIND-VAR-NEXT: FuncType: id = {{.*}}, compiler_type = "int (int, int, ...)"
77
78// FIND-SIMPLE: Function: id = {{.*}}, name = "{{.*}}Struct::simple_method{{.*}}"
79// FIND-SIMPLE-NEXT: FuncType: id = {{.*}}, compiler_type = "int (void)"
80
81// FIND-VIRTUAL: Function: id = {{.*}}, name = "{{.*}}Struct::virtual_method{{.*}}"
82// FIND-VIRTUAL-NEXT: FuncType: id = {{.*}}, compiler_type = "int (void)"
83
84// FIND-STATIC-METHOD: Function: id = {{.*}}, name = "{{.*}}Struct::static_method{{.*}}"
85// FIND-STATIC-METHOD-NEXT: FuncType: id = {{.*}}, compiler_type = "int (void)"
86
87// FIND-OVERLOAD: Function: id = {{.*}}, name = "{{.*}}Struct::overloaded_method{{.*}}"
88// FIND-OVERLOAD: FuncType: id = {{.*}}, compiler_type = "int (void)"
89// FIND-OVERLOAD: FuncType: id = {{.*}}, compiler_type = "int (char)"
90// FIND-OVERLOAD: FuncType: id = {{.*}}, compiler_type = "int (char, int, ...)"
91

source code of lldb/test/Shell/SymbolFile/NativePDB/find-functions.cpp