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' | 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
freefunc()10 void freefunc() { }
11 // CHECK-DAG: "freefunc"
12
13 namespace N {
b()14 int b() { return 0; }
15 // UNQUAL-DAG: "b"
16 // QUAL-DAG: "N::b"
func()17 namespace { void func() { } }
18 // UNQUAL-DAG: "func"
19 // QUAL-DAG: "N::`anonymous namespace'::func"
20 }
21
_c(void)22 void _c(void) {
23 N::func();
24 }
25 // CHECK-DAG: "_c"
26
27 struct foo {
28 int operator+(int);
foofoo29 foo(){}
30 // UNQUAL-DAG: "foo"
31 // QUAL-DAG: "foo::foo"
32
~foofoo33 ~foo(){}
34 // UNQUAL-DAG: "~foo"
35 // QUAL-DAG: "foo::~foo"
36
foofoo37 foo(int i){}
38 // UNQUAL-DAG: "foo"
39 // QUAL-DAG: "foo::foo"
40
foofoo41 foo(char *q){}
42 // UNQUAL-DAG: "foo"
43 // QUAL-DAG: "foo::foo"
44
static_methodfoo45 static foo* static_method() { return 0; }
46 // UNQUAL-DAG: "static_method"
47 // QUAL-DAG: "foo::static_method"
48
49 };
50
use_foo()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+"
operator +(int a)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
operator new(__SIZE_TYPE__ s)71 void *OverloadedNewDelete::operator new(__SIZE_TYPE__ s) { return 0; }
operator new[](__SIZE_TYPE__ s)72 void *OverloadedNewDelete::operator new[](__SIZE_TYPE__ s) { return 0; }
operator delete(void *)73 void OverloadedNewDelete::operator delete(void *) { }
operator delete[](void *)74 void OverloadedNewDelete::operator delete[](void *) { }
operator +(int x)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)>
fn_tmpl()90 void fn_tmpl() {}
91
92 template void fn_tmpl<int, freefunc>();
93 // CHECK-DAG: "fn_tmpl<int,&freefunc>"
94