2015-10-08 12:24:12 +08:00
|
|
|
// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin -debug-info-kind=limited -emit-llvm -o - | FileCheck %s
|
2014-02-05 07:46:16 +08:00
|
|
|
// This test is for a crash when emitting debug info for not-yet-completed
|
|
|
|
// types.
|
2014-02-05 05:29:50 +08:00
|
|
|
// Test that we don't actually emit a forward decl for the offending class:
|
2015-04-30 00:40:08 +08:00
|
|
|
// CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "Derived<int>"
|
2015-03-04 01:25:55 +08:00
|
|
|
// CHECK-NOT: DIFlagFwdDecl
|
|
|
|
// CHECK-SAME: ){{$}}
|
2014-02-05 05:29:50 +08:00
|
|
|
// rdar://problem/15931354
|
2014-02-05 05:50:56 +08:00
|
|
|
template <class A> class Derived;
|
2014-02-05 05:29:50 +08:00
|
|
|
|
2014-02-05 07:46:16 +08:00
|
|
|
template <class A> class Base {
|
|
|
|
static Derived<A> *create();
|
2014-02-05 05:29:50 +08:00
|
|
|
};
|
|
|
|
|
2014-02-05 07:46:16 +08:00
|
|
|
template <class A> struct Derived : Base<A> {
|
2014-02-05 05:29:50 +08:00
|
|
|
};
|
|
|
|
|
2014-02-05 07:46:16 +08:00
|
|
|
Base<int> *f;
|
2014-02-05 05:29:50 +08:00
|
|
|
|
2014-02-05 07:46:16 +08:00
|
|
|
// During the instantiation of Derived<int>, Base<int> becomes required to be
|
|
|
|
// complete - since the declaration has already been emitted (due to 'f',
|
|
|
|
// above), we immediately try to build debug info for Base<int> which then
|
|
|
|
// requires the (incomplete definition) of Derived<int> which is problematic.
|
|
|
|
//
|
|
|
|
// (if 'f' is not present, the point at which Base<int> becomes required to be
|
|
|
|
// complete during the instantiation of Derived<int> is a no-op because
|
|
|
|
// Base<int> was never emitted so we ignore it and carry on until we
|
|
|
|
// wire up the base class of Derived<int> in the debug info later on)
|
|
|
|
Derived<int> d;
|