2013-08-29 02:31:02 +08:00
|
|
|
// RUN: %clang -S -emit-llvm -target x86_64-unknown_unknown -g %s -o - -std=c++11 | FileCheck %s
|
2011-02-03 05:38:49 +08:00
|
|
|
|
2015-03-04 01:25:55 +08:00
|
|
|
// CHECK: !MDCompileUnit(
|
|
|
|
// CHECK-SAME: retainedTypes: [[RETAIN:![0-9]*]]
|
2014-12-16 03:10:08 +08:00
|
|
|
// CHECK: [[EMPTY:![0-9]*]] = !{}
|
|
|
|
// CHECK: [[RETAIN]] = !{!{{[0-9]]*}}, [[FOO:![0-9]*]],
|
2013-05-11 06:53:25 +08:00
|
|
|
|
|
|
|
|
2015-03-04 01:25:55 +08:00
|
|
|
// CHECK: [[TC:![0-9]*]] = !MDCompositeType(tag: DW_TAG_structure_type, name: "TC<unsigned int, 2, &glb, &foo::e, &foo::f, &foo::g, 1, 2, 3>"
|
|
|
|
// CHECK-SAME: templateParams: [[TCARGS:![0-9]*]]
|
2014-12-16 03:10:08 +08:00
|
|
|
// CHECK: [[TCARGS]] = !{[[TCARG1:![0-9]*]], [[TCARG2:![0-9]*]], [[TCARG3:![0-9]*]], [[TCARG4:![0-9]*]], [[TCARG5:![0-9]*]], [[TCARG6:![0-9]*]], [[TCARG7:![0-9]*]]}
|
2013-05-10 05:32:04 +08:00
|
|
|
//
|
2015-03-04 01:25:55 +08:00
|
|
|
// CHECK: [[TCARG1]] = !MDTemplateTypeParameter(name: "T", type: [[UINT:![0-9]*]])
|
|
|
|
// CHECK: [[UINT:![0-9]*]] = !MDBasicType(name: "unsigned int"
|
|
|
|
// CHECK: [[TCARG2]] = !MDTemplateValueParameter(type: [[UINT]], value: i32 2)
|
|
|
|
// CHECK: [[TCARG3]] = !MDTemplateValueParameter(name: "x", type: [[CINTPTR:![0-9]*]], value: i32* @glb)
|
|
|
|
// CHECK: [[CINTPTR]] = !MDDerivedType(tag: DW_TAG_pointer_type, {{.*}}baseType: [[CINT:![0-9]+]]
|
|
|
|
// CHECK: [[CINT]] = !MDDerivedType(tag: DW_TAG_const_type, {{.*}}baseType: [[INT:![0-9]+]]
|
|
|
|
// CHECK: [[INT]] = !MDBasicType(name: "int"
|
|
|
|
// CHECK: [[TCARG4]] = !MDTemplateValueParameter(name: "a", type: [[MEMINTPTR:![0-9]*]], value: i64 8)
|
|
|
|
// CHECK: [[MEMINTPTR]] = !MDDerivedType(tag: DW_TAG_ptr_to_member_type, {{.*}}baseType: [[INT]], {{.*}}extraData: !"_ZTS3foo")
|
2013-05-11 05:53:14 +08:00
|
|
|
//
|
|
|
|
// Currently Clang emits the pointer-to-member-function value, but LLVM doesn't
|
|
|
|
// use it (GCC doesn't emit a value for pointers to member functions either - so
|
|
|
|
// it's not clear what, if any, format would be acceptable to GDB)
|
|
|
|
//
|
2015-03-04 01:25:55 +08:00
|
|
|
// CHECK: [[TCARG5]] = !MDTemplateValueParameter(name: "b", type: [[MEMFUNPTR:![0-9]*]], value: { i64, i64 } { i64 ptrtoint (void (%struct.foo*)* @_ZN3foo1fEv to i64), i64 0 })
|
|
|
|
// CHECK: [[MEMFUNPTR]] = !MDDerivedType(tag: DW_TAG_ptr_to_member_type, {{.*}}baseType: [[FTYPE:![0-9]*]], {{.*}}extraData: !"_ZTS3foo")
|
|
|
|
// CHECK: [[FTYPE]] = !MDSubroutineType(types: [[FARGS:![0-9]*]])
|
2014-12-16 03:10:08 +08:00
|
|
|
// CHECK: [[FARGS]] = !{null, [[FARG1:![0-9]*]]}
|
2015-03-04 01:25:55 +08:00
|
|
|
// CHECK: [[FARG1]] = !MDDerivedType(tag: DW_TAG_pointer_type,
|
|
|
|
// CHECK-SAME: baseType: !"_ZTS3foo"
|
|
|
|
// CHECK-NOT: line:
|
|
|
|
// CHECK-SAME: size: 64, align: 64
|
|
|
|
// CHECK-NOT: offset: 0
|
|
|
|
// CHECK-SAME: DIFlagArtificial
|
2013-09-06 02:51:02 +08:00
|
|
|
//
|
2015-03-04 01:25:55 +08:00
|
|
|
// CHECK: [[TCARG6]] = !MDTemplateValueParameter(name: "f", type: [[FUNPTR:![0-9]*]], value: void ()* @_ZN3foo1gEv)
|
|
|
|
// CHECK: [[FUNPTR]] = !MDDerivedType(tag: DW_TAG_pointer_type, baseType: [[FUNTYPE:![0-9]*]]
|
|
|
|
// CHECK: [[FUNTYPE]] = !MDSubroutineType(types: [[FUNARGS:![0-9]*]])
|
2014-12-16 03:10:08 +08:00
|
|
|
// CHECK: [[FUNARGS]] = !{null}
|
2015-03-04 01:25:55 +08:00
|
|
|
// CHECK: [[TCARG7]] = !MDTemplateValueParameter(tag: DW_TAG_GNU_template_parameter_pack, name: "Is", value: [[TCARG7_VALS:![0-9]*]])
|
2014-12-16 03:10:08 +08:00
|
|
|
// CHECK: [[TCARG7_VALS]] = !{[[TCARG7_1:![0-9]*]], [[TCARG7_2:![0-9]*]], [[TCARG7_3:![0-9]*]]}
|
2015-03-04 01:25:55 +08:00
|
|
|
// CHECK: [[TCARG7_1]] = !MDTemplateValueParameter(type: [[INT]], value: i32 1)
|
|
|
|
// CHECK: [[TCARG7_2]] = !MDTemplateValueParameter(type: [[INT]], value: i32 2)
|
|
|
|
// CHECK: [[TCARG7_3]] = !MDTemplateValueParameter(type: [[INT]], value: i32 3)
|
2013-10-05 09:43:22 +08:00
|
|
|
//
|
|
|
|
// We could just emit a declaration of 'foo' here, rather than the entire
|
|
|
|
// definition (same goes for any time we emit a member (function or data)
|
|
|
|
// pointer type)
|
2015-03-04 01:25:55 +08:00
|
|
|
// CHECK: [[FOO]] = !MDCompositeType(tag: DW_TAG_structure_type, name: "foo", {{.*}}identifier: "_ZTS3foo")
|
|
|
|
// CHECK: !MDSubprogram(name: "f", linkageName: "_ZN3foo1fEv", {{.*}}type: [[FTYPE:![0-9]*]]
|
2013-10-05 09:43:22 +08:00
|
|
|
//
|
2013-05-11 05:53:14 +08:00
|
|
|
|
2015-03-04 01:25:55 +08:00
|
|
|
// CHECK: !MDCompositeType(tag: DW_TAG_structure_type, name: "nested",
|
|
|
|
// CHECK-SAME: scope: !"_ZTS2TCIjLj2EXadL_Z3glbEEXadL_ZN3foo1eEEEXadL_ZNS0_1fEvEEXadL_ZNS0_1gEvEEJLi1ELi2ELi3EEE"
|
|
|
|
// CHECK-SAME: identifier: "[[TCNESTED:.*]]")
|
|
|
|
// CHECK: !MDCompositeType(tag: DW_TAG_structure_type, name: "TC<int, -3, nullptr, nullptr, nullptr, nullptr>"
|
|
|
|
// CHECK-SAME: templateParams: [[TCNARGS:![0-9]*]]
|
|
|
|
// CHECK-SAME: identifier: "[[TCNT:.*]]")
|
2014-12-16 03:10:08 +08:00
|
|
|
// CHECK: [[TCNARGS]] = !{[[TCNARG1:![0-9]*]], [[TCNARG2:![0-9]*]], [[TCNARG3:![0-9]*]], [[TCNARG4:![0-9]*]], [[TCNARG5:![0-9]*]], [[TCNARG6:![0-9]*]], [[TCNARG7:![0-9]*]]}
|
2015-03-04 01:25:55 +08:00
|
|
|
// CHECK: [[TCNARG1]] = !MDTemplateTypeParameter(name: "T", type: [[INT]])
|
|
|
|
// CHECK: [[TCNARG2]] = !MDTemplateValueParameter(type: [[INT]], value: i32 -3)
|
|
|
|
// CHECK: [[TCNARG3]] = !MDTemplateValueParameter(name: "x", type: [[CINTPTR]], value: i8 0)
|
2013-05-11 05:53:14 +08:00
|
|
|
|
|
|
|
// The interesting null pointer: -1 for member data pointers (since they are
|
|
|
|
// just an offset in an object, they can be zero and non-null for the first
|
|
|
|
// member)
|
|
|
|
|
2015-03-04 01:25:55 +08:00
|
|
|
// CHECK: [[TCNARG4]] = !MDTemplateValueParameter(name: "a", type: [[MEMINTPTR]], value: i64 -1)
|
2013-05-11 05:53:14 +08:00
|
|
|
//
|
|
|
|
// In some future iteration we could possibly emit the value of a null member
|
|
|
|
// function pointer as '{ i64, i64 } zeroinitializer' as it may be handled
|
|
|
|
// naturally from the LLVM CodeGen side once we decide how to handle non-null
|
|
|
|
// member function pointers. For now, it's simpler just to emit the 'i8 0'.
|
|
|
|
//
|
2015-03-04 01:25:55 +08:00
|
|
|
// CHECK: [[TCNARG5]] = !MDTemplateValueParameter(name: "b", type: [[MEMFUNPTR]], value: i8 0)
|
|
|
|
// CHECK: [[TCNARG6]] = !MDTemplateValueParameter(name: "f", type: [[FUNPTR]], value: i8 0)
|
|
|
|
// CHECK: [[TCNARG7]] = !MDTemplateValueParameter(tag: DW_TAG_GNU_template_parameter_pack, name: "Is", value: [[EMPTY]])
|
2014-10-16 08:41:40 +08:00
|
|
|
|
2014-10-16 12:21:25 +08:00
|
|
|
// FIXME: these parameters should probably be rendered as 'glb' rather than
|
|
|
|
// '&glb', since they're references, not pointers.
|
2015-03-04 01:25:55 +08:00
|
|
|
// CHECK: !MDCompositeType(tag: DW_TAG_structure_type, name: "NN<tmpl_impl, &glb, &glb>",
|
|
|
|
// CHECK-SAME: templateParams: [[NNARGS:![0-9]*]]
|
|
|
|
// CHECK-SAME: identifier: "[[NNT:.*]]")
|
2014-12-16 03:10:08 +08:00
|
|
|
// CHECK: [[NNARGS]] = !{[[NNARG1:![0-9]*]], [[NNARG2:![0-9]*]], [[NNARG3:![0-9]*]]}
|
2015-03-04 01:25:55 +08:00
|
|
|
// CHECK: [[NNARG1]] = !MDTemplateValueParameter(tag: DW_TAG_GNU_template_template_param, name: "tmpl", value: !"tmpl_impl")
|
|
|
|
// CHECK: [[NNARG2]] = !MDTemplateValueParameter(name: "lvr", type: [[INTLVR:![0-9]*]], value: i32* @glb)
|
|
|
|
// CHECK: [[INTLVR]] = !MDDerivedType(tag: DW_TAG_reference_type, baseType: [[INT]]
|
|
|
|
// CHECK: [[NNARG3]] = !MDTemplateValueParameter(name: "rvr", type: [[INTRVR:![0-9]*]], value: i32* @glb)
|
|
|
|
// CHECK: [[INTRVR]] = !MDDerivedType(tag: DW_TAG_rvalue_reference_type, baseType: [[INT]]
|
|
|
|
|
|
|
|
// CHECK: !MDCompositeType(tag: DW_TAG_structure_type, name: "PaddingAtEndTemplate<&PaddedObj>"
|
|
|
|
// CHECK-SAME: templateParams: [[PTOARGS:![0-9]*]]
|
2014-12-16 03:10:08 +08:00
|
|
|
// CHECK: [[PTOARGS]] = !{[[PTOARG1:![0-9]*]]}
|
2015-03-04 01:25:55 +08:00
|
|
|
// CHECK: [[PTOARG1]] = !MDTemplateValueParameter(type: [[CONST_PADDINGATEND_PTR:![0-9]*]], value: %struct.PaddingAtEnd* @PaddedObj)
|
|
|
|
// CHECK: [[CONST_PADDINGATEND_PTR]] = !MDDerivedType(tag: DW_TAG_pointer_type, baseType: !"_ZTS12PaddingAtEnd", size: 64, align: 64)
|
2013-08-30 07:19:58 +08:00
|
|
|
|
2015-03-04 01:25:55 +08:00
|
|
|
// CHECK: !MDGlobalVariable(name: "tci",
|
|
|
|
// CHECK-SAME: type: !"[[TCNESTED]]"
|
|
|
|
// CHECK-SAME: variable: %"struct.TC<unsigned int, 2, &glb, &foo::e, &foo::f, &foo::g, 1, 2, 3>::nested"* @tci
|
2013-08-30 07:19:58 +08:00
|
|
|
|
2015-03-04 01:25:55 +08:00
|
|
|
// CHECK: !MDGlobalVariable(name: "tcn"
|
|
|
|
// CHECK-SAME: type: !"[[TCNT]]"
|
|
|
|
// CHECK-SAME: variable: %struct.TC* @tcn
|
2014-10-16 08:41:40 +08:00
|
|
|
|
2015-03-04 01:25:55 +08:00
|
|
|
// CHECK: !MDGlobalVariable(name: "nn"
|
|
|
|
// CHECK-SAME: type: !"[[NNT]]"
|
|
|
|
// CHECK-SAME: variable: %struct.NN* @nn
|
2013-05-10 06:43:45 +08:00
|
|
|
struct foo {
|
2013-05-11 05:53:14 +08:00
|
|
|
char pad[8]; // make the member pointer to 'e' a bit more interesting (nonzero)
|
2013-05-10 06:43:45 +08:00
|
|
|
int e;
|
|
|
|
void f();
|
2014-10-21 02:56:54 +08:00
|
|
|
static void g();
|
2013-05-10 06:43:45 +08:00
|
|
|
};
|
|
|
|
|
2014-10-18 10:21:26 +08:00
|
|
|
typedef int foo::*foo_mem;
|
|
|
|
|
|
|
|
template<typename T, T, const int *x, foo_mem a, void (foo::*b)(), void (*f)(), int ...Is>
|
2013-08-02 04:31:40 +08:00
|
|
|
struct TC {
|
|
|
|
struct nested {
|
|
|
|
};
|
2013-05-10 01:29:54 +08:00
|
|
|
};
|
2011-04-05 07:18:38 +08:00
|
|
|
|
2013-05-10 06:43:45 +08:00
|
|
|
int glb;
|
2013-05-13 14:57:50 +08:00
|
|
|
void func();
|
2013-05-10 06:43:45 +08:00
|
|
|
|
2014-10-21 02:56:54 +08:00
|
|
|
TC<unsigned, 2, &glb, &foo::e, &foo::f, &foo::g, 1, 2, 3>::nested tci;
|
2014-10-16 08:41:40 +08:00
|
|
|
TC<int, -3, nullptr, nullptr, nullptr, nullptr> tcn;
|
|
|
|
|
2013-06-23 02:59:18 +08:00
|
|
|
template<typename>
|
|
|
|
struct tmpl_impl {
|
|
|
|
};
|
2013-05-11 06:53:25 +08:00
|
|
|
|
2014-10-16 12:21:25 +08:00
|
|
|
template <template <typename> class tmpl, int &lvr, int &&rvr>
|
2014-10-16 08:41:40 +08:00
|
|
|
struct NN {
|
|
|
|
};
|
|
|
|
|
2014-10-16 12:21:25 +08:00
|
|
|
NN<tmpl_impl, glb, glb> nn;
|
2013-08-24 16:21:10 +08:00
|
|
|
|
2013-08-26 06:13:27 +08:00
|
|
|
struct PaddingAtEnd {
|
|
|
|
int i;
|
|
|
|
char c;
|
|
|
|
};
|
|
|
|
|
|
|
|
PaddingAtEnd PaddedObj = {};
|
|
|
|
|
2014-10-16 08:41:40 +08:00
|
|
|
template <PaddingAtEnd *>
|
2013-08-26 06:13:27 +08:00
|
|
|
struct PaddingAtEndTemplate {
|
|
|
|
};
|
|
|
|
|
|
|
|
PaddingAtEndTemplate<&PaddedObj> PaddedTemplateObj;
|