brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.1 KiB · 8200a65 Raw
101 lines · cpp
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,UNQUAL5// 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 %s9// 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,UNQUAL13// 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,UNQUAL17 18void freefunc() { }19// CHECK-DAG: "freefunc"20 21namespace N {22  int b() { return 0; }23// CHECK-DAG: "b"24  namespace { void func() { } }25// CHECK-DAG: "func"26}27 28void _c(void) {29  N::func();30}31// CHECK-DAG: "_c"32 33struct foo {34  int operator+(int);35  foo(){}36// CHECK-DAG: "foo"37 38  ~foo(){}39// CHECK-DAG: "~foo"40 41  foo(int i){}42// CHECK-DAG: "foo"43 44  foo(char *q){}45// CHECK-DAG: "foo"46 47  static foo* static_method() { return 0; }48// CHECK-DAG: "static_method"49 50};51 52void use_foo() {53  foo f1, f2(1), f3((char*)0);54  foo::static_method();55}56 57// CHECK-DAG: "operator+"58int foo::operator+(int a) { return a; }59 60// PR1737161struct OverloadedNewDelete {62  // __cdecl63  void *operator new(__SIZE_TYPE__);64  void *operator new[](__SIZE_TYPE__);65  void operator delete(void *);66  void operator delete[](void *);67  // __thiscall68  int operator+(int);69};70 71void *OverloadedNewDelete::operator new(__SIZE_TYPE__ s) { return 0; }72void *OverloadedNewDelete::operator new[](__SIZE_TYPE__ s) { return 0; }73void OverloadedNewDelete::operator delete(void *) { }74void OverloadedNewDelete::operator delete[](void *) { }75int OverloadedNewDelete::operator+(int x) { return x; };76 77// CHECK-DAG: "operator new"78// CHECK-DAG: "operator new[]"79// CHECK-DAG: "operator delete"80// CHECK-DAG: "operator delete[]"81// CHECK-DAG: "operator+"82 83template <typename T, void (*)(void)>84void fn_tmpl() {}85 86template void fn_tmpl<int, freefunc>();87// CHECK-DAG: "fn_tmpl<int,&freefunc>"88 89template <typename T, void (*)(void)>90void fn_tmpl_typecheck() {}91 92template void fn_tmpl_typecheck<int, &freefunc>();93// CHECK-DAG: "fn_tmpl_typecheck<int,&freefunc>"94 95template <typename A, typename B, typename C> struct ClassTemplate { A a; B b; C c; };96ClassTemplate<char, short, ClassTemplate<int, int, int> > f;97// This will only show up in normal debug builds.  The space in `> >` is98// important for compatibility with Windows debuggers, so it should always be99// there when generating CodeView.100// UNQUAL-DAG: "ClassTemplate<char,short,ClassTemplate<int,int,int> >"101