1// RUN: %clang_cc1 -fblocks -debug-info-kind=limited -gcodeview -emit-llvm %s -o - -triple=x86_64-pc-win32 -std=c++98 | \
2// RUN:  grep 'DISubprogram' | sed -e 's/.*name: "\([^"]*\)".*/"\1"/' | FileCheck %s
3
4void freefunc() { }
5// CHECK-DAG: "freefunc"
6
7namespace N {
8  int b() { return 0; }
9// CHECK-DAG: "N::b"
10  namespace { void func() { } }
11// CHECK-DAG: "N::`anonymous namespace'::func
12}
13
14void _c(void) {
15  N::func();
16}
17// CHECK-DAG: "_c"
18
19struct foo {
20  int operator+(int);
21  foo(){}
22// CHECK-DAG: "foo::foo"
23
24  ~foo(){}
25// CHECK-DAG: "foo::~foo"
26
27  foo(int i){}
28// CHECK-DAG: "foo::foo"
29
30  foo(char *q){}
31// CHECK-DAG: "foo::foo"
32
33  static foo* static_method() { return 0; }
34// CHECK-DAG: "foo::static_method"
35
36};
37
38void use_foo() {
39  foo f1, f2(1), f3((char*)0);
40  foo::static_method();
41}
42
43// CHECK-DAG: "foo::operator+"
44int foo::operator+(int a) { return a; }
45
46// PR17371
47struct OverloadedNewDelete {
48  // __cdecl
49  void *operator new(__SIZE_TYPE__);
50  void *operator new[](__SIZE_TYPE__);
51  void operator delete(void *);
52  void operator delete[](void *);
53  // __thiscall
54  int operator+(int);
55};
56
57void *OverloadedNewDelete::operator new(__SIZE_TYPE__ s) { return 0; }
58void *OverloadedNewDelete::operator new[](__SIZE_TYPE__ s) { return 0; }
59void OverloadedNewDelete::operator delete(void *) { }
60void OverloadedNewDelete::operator delete[](void *) { }
61int OverloadedNewDelete::operator+(int x) { return x; };
62
63// CHECK-DAG: "OverloadedNewDelete::operator new"
64// CHECK-DAG: "OverloadedNewDelete::operator new[]"
65// CHECK-DAG: "OverloadedNewDelete::operator delete"
66// CHECK-DAG: "OverloadedNewDelete::operator delete[]"
67// CHECK-DAG: "OverloadedNewDelete::operator+"
68
69template <void (*)(void)>
70void fn_tmpl() {}
71
72template void fn_tmpl<freefunc>();
73// CHECK-DAG: "fn_tmpl"
74