1 | // RUN: %clang_cc1 -fblocks -debug-info-kind=limited -gcodeview -emit-llvm %s \ |
2 | // RUN: -o - -triple=x86_64-pc-win32 -std=c++98 | \ |
3 | // RUN: grep 'DISubprogram\|DICompositeType' | sed -e 's/.*name: "\([^"]*\)".*/"\1"/' | \ |
4 | // RUN: FileCheck %s --check-prefix=CHECK --check-prefix=UNQUAL |
5 | // RUN: %clang_cc1 -fblocks -debug-info-kind=line-tables-only -gcodeview -emit-llvm %s \ |
6 | // RUN: -o - -triple=x86_64-pc-win32 -std=c++98 | \ |
7 | // RUN: grep 'DISubprogram' | sed -e 's/.*name: "\([^"]*\)".*/"\1"/' | \ |
8 | // RUN: FileCheck %s --check-prefix=CHECK --check-prefix=QUAL |
9 | |
10 | void freefunc() { } |
11 | // CHECK-DAG: "freefunc" |
12 | |
13 | namespace N { |
14 | int b() { return 0; } |
15 | // UNQUAL-DAG: "b" |
16 | // QUAL-DAG: "N::b" |
17 | namespace { void func() { } } |
18 | // UNQUAL-DAG: "func" |
19 | // QUAL-DAG: "N::`anonymous namespace'::func" |
20 | } |
21 | |
22 | void _c(void) { |
23 | N::func(); |
24 | } |
25 | // CHECK-DAG: "_c" |
26 | |
27 | struct foo { |
28 | int operator+(int); |
29 | foo(){} |
30 | // UNQUAL-DAG: "foo" |
31 | // QUAL-DAG: "foo::foo" |
32 | |
33 | ~foo(){} |
34 | // UNQUAL-DAG: "~foo" |
35 | // QUAL-DAG: "foo::~foo" |
36 | |
37 | foo(int i){} |
38 | // UNQUAL-DAG: "foo" |
39 | // QUAL-DAG: "foo::foo" |
40 | |
41 | foo(char *q){} |
42 | // UNQUAL-DAG: "foo" |
43 | // QUAL-DAG: "foo::foo" |
44 | |
45 | static foo* static_method() { return 0; } |
46 | // UNQUAL-DAG: "static_method" |
47 | // QUAL-DAG: "foo::static_method" |
48 | |
49 | }; |
50 | |
51 | void use_foo() { |
52 | foo f1, f2(1), f3((char*)0); |
53 | foo::static_method(); |
54 | } |
55 | |
56 | // UNQUAL-DAG: "operator+" |
57 | // QUAL-DAG: "foo::operator+" |
58 | int foo::operator+(int a) { return a; } |
59 | |
60 | // PR17371 |
61 | struct OverloadedNewDelete { |
62 | // __cdecl |
63 | void *operator new(__SIZE_TYPE__); |
64 | void *operator new[](__SIZE_TYPE__); |
65 | void operator delete(void *); |
66 | void operator delete[](void *); |
67 | // __thiscall |
68 | int operator+(int); |
69 | }; |
70 | |
71 | void *OverloadedNewDelete::operator new(__SIZE_TYPE__ s) { return 0; } |
72 | void *OverloadedNewDelete::operator new[](__SIZE_TYPE__ s) { return 0; } |
73 | void OverloadedNewDelete::operator delete(void *) { } |
74 | void OverloadedNewDelete::operator delete[](void *) { } |
75 | int OverloadedNewDelete::operator+(int x) { return x; }; |
76 | |
77 | // UNQUAL-DAG: "operator new" |
78 | // UNQUAL-DAG: "operator new[]" |
79 | // UNQUAL-DAG: "operator delete" |
80 | // UNQUAL-DAG: "operator delete[]" |
81 | // UNQUAL-DAG: "operator+" |
82 | // QUAL-DAG: "OverloadedNewDelete::operator new" |
83 | // QUAL-DAG: "OverloadedNewDelete::operator new[]" |
84 | // QUAL-DAG: "OverloadedNewDelete::operator delete" |
85 | // QUAL-DAG: "OverloadedNewDelete::operator delete[]" |
86 | // QUAL-DAG: "OverloadedNewDelete::operator+" |
87 | |
88 | |
89 | template <typename T, void (*)(void)> |
90 | void fn_tmpl() {} |
91 | |
92 | template void fn_tmpl<int, freefunc>(); |
93 | // CHECK-DAG: "fn_tmpl<int,&freefunc>" |
94 | |
95 | template <typename A, typename B, typename C> struct ClassTemplate { A a; B b; C c; }; |
96 | ClassTemplate<char, short, ClassTemplate<int, int, int> > f; |
97 | // This will only show up in normal debug builds. |
98 | // UNQUAL-DAG: "ClassTemplate<char,short,ClassTemplate<int,int,int> >" |
99 | |