2016-04-24 05:08:27 +08:00
|
|
|
// RUN: %clang_cc1 -triple x86_64-none-linux-gnu -emit-llvm -debug-info-kind=limited %s -o - | FileCheck %s --check-prefix=CHECK --check-prefix=BOTH
|
|
|
|
// RUN: %clang_cc1 -triple i686-pc-windows-msvc -emit-llvm -debug-info-kind=limited %s -o - | FileCheck %s --check-prefix=MSVC --check-prefix=BOTH
|
|
|
|
|
2016-09-13 09:13:19 +08:00
|
|
|
// CHECK: @_ZN6pr96081xE = global [3 x i8]* null, align 8, !dbg [[X:![0-9]+]]
|
|
|
|
|
2016-04-24 05:08:27 +08:00
|
|
|
// CHECK: define void @_ZN7pr147634funcENS_3fooE
|
|
|
|
// CHECK: call void @llvm.dbg.declare({{.*}}, metadata ![[F:[0-9]+]], metadata ![[EXPR:[0-9]+]])
|
|
|
|
|
|
|
|
// !llvm.dbg.cu pulls in globals and their types first.
|
|
|
|
// CHECK-NOT: !DIGlobalVariable(name: "c"
|
2016-09-13 09:13:19 +08:00
|
|
|
// CHECK: [[X]] = distinct !DIGlobalVariable(name: "x", linkageName: "_ZN6pr96081xE"
|
2016-04-24 05:08:27 +08:00
|
|
|
// CHECK-SAME: type: [[INCARRAYPTR:![0-9]*]]
|
|
|
|
// CHECK: [[INCARRAYPTR]] = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: [[INCARRAY:![0-9]+]]
|
|
|
|
// CHECK: [[INCARRAY]] = !DICompositeType(tag: DW_TAG_array_type
|
|
|
|
// CHECK-NOT: line:
|
|
|
|
// CHECK-NOT: size:
|
|
|
|
// CHECK-NOT: align:
|
|
|
|
// CHECK-NOT: offset:
|
|
|
|
// CHECK-SAME: baseType: ![[INCTYPE:[0-9]+]]
|
|
|
|
|
|
|
|
// CHECK: ![[INCTYPE]] = !DICompositeType(tag: DW_TAG_structure_type, name: "incomplete"
|
|
|
|
// CHECK-SAME: DIFlagFwdDecl
|
2014-08-08 05:29:25 +08:00
|
|
|
|
2009-11-07 02:45:16 +08:00
|
|
|
template<typename T> struct Identity {
|
|
|
|
typedef T Type;
|
|
|
|
};
|
|
|
|
|
|
|
|
void f(Identity<int>::Type a) {}
|
2009-11-07 03:19:55 +08:00
|
|
|
void f(Identity<int> a) {}
|
|
|
|
void f(int& a) { }
|
2009-11-15 05:08:12 +08:00
|
|
|
|
|
|
|
template<typename T> struct A {
|
|
|
|
A<T> *next;
|
|
|
|
};
|
|
|
|
void f(A<int>) { }
|
2009-12-07 02:00:51 +08:00
|
|
|
|
|
|
|
struct B { };
|
|
|
|
|
|
|
|
void f() {
|
|
|
|
int B::*a = 0;
|
|
|
|
void (B::*b)() = 0;
|
|
|
|
}
|
2010-01-16 08:43:13 +08:00
|
|
|
|
|
|
|
namespace EmptyNameCrash {
|
|
|
|
struct A { A(); };
|
|
|
|
typedef struct { A x; } B;
|
|
|
|
B x;
|
|
|
|
}
|
2010-01-26 13:19:50 +08:00
|
|
|
|
|
|
|
// PR4890
|
|
|
|
namespace PR4890 {
|
|
|
|
struct X {
|
|
|
|
~X();
|
|
|
|
};
|
|
|
|
|
|
|
|
X::~X() { }
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace VirtualDtor {
|
|
|
|
struct Y {
|
|
|
|
virtual ~Y();
|
|
|
|
};
|
|
|
|
|
|
|
|
Y::~Y() { }
|
|
|
|
}
|
2010-01-26 13:26:39 +08:00
|
|
|
|
|
|
|
namespace VirtualBase {
|
2014-08-08 05:29:25 +08:00
|
|
|
struct A { int a; };
|
|
|
|
struct B : virtual A { int b; };
|
2016-04-24 05:08:27 +08:00
|
|
|
// BOTH: ![[VBASE_B:[0-9]+]] ={{.*}}!DICompositeType(tag: DW_TAG_structure_type, name: "B",{{.*}} line: [[@LINE-1]],
|
2016-10-20 08:13:19 +08:00
|
|
|
// MSVC-SAME: size: 96
|
|
|
|
// CHECK-SAME: size: 128,
|
2016-04-24 05:08:27 +08:00
|
|
|
// BOTH-NOT: offset:
|
|
|
|
// BOTH-NOT: DIFlagFwdDecl
|
|
|
|
// BOTH-SAME: elements: [[VBASE_B_DEF:![0-9]+]]
|
|
|
|
// BOTH: [[VBASE_B_DEF]] = !{[[VBASE_A_IN_B:![0-9]+]],
|
|
|
|
//
|
|
|
|
// Look for the vbtable offset of A, which should be 4 for MSVC, 24 otherwise.
|
|
|
|
// BOTH: [[VBASE_A_IN_B]] = !DIDerivedType(tag: DW_TAG_inheritance, scope: ![[VBASE_B]],
|
|
|
|
// BOTH-SAME: baseType: ![[VBASE_A:[0-9]+]],
|
|
|
|
// MSVC-SAME: offset: 4,
|
|
|
|
// CHECK-SAME: offset: 24,
|
|
|
|
//
|
|
|
|
// BOTH: ![[VBASE_A]] ={{.*}}!DICompositeType(tag: DW_TAG_structure_type, name: "A",
|
2010-01-26 13:26:39 +08:00
|
|
|
|
|
|
|
void f() {
|
|
|
|
B b;
|
|
|
|
}
|
|
|
|
}
|
2010-08-24 02:26:10 +08:00
|
|
|
|
2011-09-02 05:49:51 +08:00
|
|
|
namespace b5249287 {
|
|
|
|
template <typename T> class A {
|
|
|
|
struct B;
|
|
|
|
};
|
|
|
|
|
|
|
|
class Cls {
|
|
|
|
template <typename T> friend class A<T>::B;
|
|
|
|
};
|
|
|
|
|
|
|
|
Cls obj;
|
|
|
|
}
|
2013-05-10 05:32:04 +08:00
|
|
|
|
2016-04-24 05:08:27 +08:00
|
|
|
// CHECK: [[FUNC:[0-9]+]] = distinct !DISubprogram(name: "func", linkageName: "_ZN7pr147634funcENS_3fooE"
|
|
|
|
// CHECK-SAME: type: {{![0-9]+}}
|
|
|
|
// CHECK-SAME: isDefinition: true
|
|
|
|
|
|
|
|
// CHECK: [[PR14763:![0-9]+]] = !DINamespace(name: "pr14763"
|
2013-06-06 02:30:31 +08:00
|
|
|
namespace pr14763 {
|
|
|
|
struct foo {
|
2016-04-24 05:08:27 +08:00
|
|
|
// CHECK: ![[FOO:[0-9]+]] ={{.*}}!DICompositeType(tag: DW_TAG_structure_type, name: "foo"
|
|
|
|
// CHECK-SAME: scope: [[PR14763]]
|
|
|
|
// CHECK-SAME: identifier:
|
2013-06-06 02:30:31 +08:00
|
|
|
foo(const foo&);
|
|
|
|
};
|
|
|
|
|
2016-04-24 05:08:27 +08:00
|
|
|
// For some reason function arguments ended up down here
|
|
|
|
// CHECK: ![[F]] = !DILocalVariable(name: "f", arg: 1, scope: ![[FUNC]]
|
|
|
|
// CHECK-SAME: type: ![[FOO]]
|
|
|
|
// CHECK: ![[EXPR]] = !DIExpression(DW_OP_deref)
|
2013-06-06 02:30:31 +08:00
|
|
|
foo func(foo f) {
|
|
|
|
return f; // reference 'f' for now because otherwise we hit another bug
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2014-04-05 04:56:17 +08:00
|
|
|
void foo() {
|
2016-04-24 05:08:27 +08:00
|
|
|
// CHECK: !DILocalVariable(name: "c"
|
|
|
|
// CHECK-NOT: arg:
|
|
|
|
// CHECK-SAME: )
|
2014-04-05 04:56:17 +08:00
|
|
|
const wchar_t c = L'x';
|
2014-04-05 11:39:29 +08:00
|
|
|
wchar_t d = c;
|
2014-04-05 04:56:17 +08:00
|
|
|
}
|
|
|
|
|
2013-05-10 05:32:04 +08:00
|
|
|
namespace pr9608 { // also pr9600
|
|
|
|
struct incomplete;
|
|
|
|
incomplete (*x)[3];
|
|
|
|
}
|
2013-06-05 13:32:23 +08:00
|
|
|
|
|
|
|
namespace pr16214 {
|
2016-04-24 05:08:27 +08:00
|
|
|
// CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "a"
|
|
|
|
// CHECK-SAME: elements: [[A_MEM:![0-9]+]]
|
|
|
|
// CHECK-SAME: identifier: "_ZTSN7pr162141aE"
|
|
|
|
// CHECK: [[A_MEM]] = !{[[A_I:![0-9]*]]}
|
2013-06-05 13:32:23 +08:00
|
|
|
struct a {
|
2016-04-24 05:08:27 +08:00
|
|
|
// CHECK: [[A_I]] = !DIDerivedType(tag: DW_TAG_member, name: "i"
|
2013-06-05 13:32:23 +08:00
|
|
|
int i;
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef a at;
|
|
|
|
|
2016-04-24 05:08:27 +08:00
|
|
|
// CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "b"
|
|
|
|
// CHECK-SAME: DIFlagFwdDecl
|
2013-06-05 13:32:23 +08:00
|
|
|
struct b {
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef b bt;
|
|
|
|
|
|
|
|
void func() {
|
|
|
|
at a_inst;
|
|
|
|
bt *b_ptr_inst;
|
|
|
|
const bt *b_cnst_ptr_inst;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|