[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / CodeGenCXX / debug-info-codeview-display-name.cpp
blob8200a65977dad071c1a77c97c90bff19593b0e0c
1 // RUN: %clang_cc1 -fblocks -debug-info-kind=limited -gcodeview -emit-llvm %s \
2 // RUN: -o - -triple=x86_64-pc-win32 -Wno-new-returns-null -std=c++98 | \
3 // RUN: grep -E 'DISubprogram|DICompositeType' | sed -e 's/.*name: "\(ptr\)".*/"\1"/' | \
4 // RUN: FileCheck %s --check-prefixes=CHECK,UNQUAL
5 // RUN: %clang_cc1 -fblocks -debug-info-kind=line-tables-only -gcodeview -emit-llvm %s \
6 // RUN: -o - -triple=x86_64-pc-win32 -Wno-new-returns-null -std=c++98 | \
7 // RUN: grep 'DISubprogram' | sed -e 's/.*name: "\(ptr\)".*/"\1"/' | \
8 // RUN: FileCheck %s
9 // RUN: %clang_cc1 -fblocks -debug-info-kind=limited -gcodeview -emit-llvm %s \
10 // RUN: -o - -triple=x86_64-pc-win32 -Wno-new-returns-null -std=c++11 | \
11 // RUN: grep -E 'DISubprogram|DICompositeType' | sed -e 's/.*name: "\(ptr\)".*/"\1"/' | \
12 // RUN: FileCheck %s --check-prefixes=CHECK,UNQUAL
13 // RUN: %clang_cc1 -fblocks -debug-info-kind=limited -gcodeview -emit-llvm %s \
14 // RUN: -o - -triple=x86_64-pc-win32 -Wno-new-returns-null | \
15 // RUN: grep -E 'DISubprogram|DICompositeType' | sed -e 's/.*name: "\(ptr\)".*/"\1"/' | \
16 // RUN: FileCheck %s --check-prefixes=CHECK,UNQUAL
18 void freefunc() { }
19 // CHECK-DAG: "freefunc"
21 namespace N {
22 int b() { return 0; }
23 // CHECK-DAG: "b"
24 namespace { void func() { } }
25 // CHECK-DAG: "func"
28 void _c(void) {
29 N::func();
31 // CHECK-DAG: "_c"
33 struct foo {
34 int operator+(int);
35 foo(){}
36 // CHECK-DAG: "foo"
38 ~foo(){}
39 // CHECK-DAG: "~foo"
41 foo(int i){}
42 // CHECK-DAG: "foo"
44 foo(char *q){}
45 // CHECK-DAG: "foo"
47 static foo* static_method() { return 0; }
48 // CHECK-DAG: "static_method"
52 void use_foo() {
53 foo f1, f2(1), f3((char*)0);
54 foo::static_method();
57 // CHECK-DAG: "operator+"
58 int foo::operator+(int a) { return a; }
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);
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; };
77 // CHECK-DAG: "operator new"
78 // CHECK-DAG: "operator new[]"
79 // CHECK-DAG: "operator delete"
80 // CHECK-DAG: "operator delete[]"
81 // CHECK-DAG: "operator+"
83 template <typename T, void (*)(void)>
84 void fn_tmpl() {}
86 template void fn_tmpl<int, freefunc>();
87 // CHECK-DAG: "fn_tmpl<int,&freefunc>"
89 template <typename T, void (*)(void)>
90 void fn_tmpl_typecheck() {}
92 template void fn_tmpl_typecheck<int, &freefunc>();
93 // CHECK-DAG: "fn_tmpl_typecheck<int,&freefunc>"
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. The space in `> >` is
98 // important for compatibility with Windows debuggers, so it should always be
99 // there when generating CodeView.
100 // UNQUAL-DAG: "ClassTemplate<char,short,ClassTemplate<int,int,int> >"