]> granicus.if.org Git - clang/commitdiff
Further simplify r200797 and add an explanatory comment.
authorDavid Blaikie <dblaikie@gmail.com>
Tue, 4 Feb 2014 23:46:16 +0000 (23:46 +0000)
committerDavid Blaikie <dblaikie@gmail.com>
Tue, 4 Feb 2014 23:46:16 +0000 (23:46 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@200805 91177308-0d34-0410-b5e6-96231b3b80d8

test/CodeGenCXX/debug-info-template-fwd.cpp

index 638b96a69638bfad0cf89cb774de4ca956556fec..b2b70730efdfdbc92cc33317df511004e20052eb 100644 (file)
@@ -1,33 +1,27 @@
 // RUN: %clang_cc1 %s -triple=x86_64-apple-darwin -g -emit-llvm -o - | FileCheck %s
-// This test is for a crash when emitting debug info for not-yet-completed types.
+// This test is for a crash when emitting debug info for not-yet-completed
+// types.
 // Test that we don't actually emit a forward decl for the offending class:
-// CHECK:  [ DW_TAG_class_type ] [Derived<Foo>] {{.*}} [def]
+// CHECK:  [ DW_TAG_structure_type ] [Derived<int>] {{.*}} [def]
 // rdar://problem/15931354
-template <class R> class Returner {};
 template <class A> class Derived;
 
-template <class A>
-class Base
-{
-  static Derived<A>* create();
+template <class A> class Base {
+  static Derived<A> *create();
 };
 
-template <class A>
-class Derived : public Base<A> {
-public:
-  static void foo();
+template <class A> struct Derived : Base<A> {
 };
 
-class Foo
-{
-  Foo();
-  static Returner<Base<Foo> > all();
-};
-
-Foo::Foo(){}
+Base<int> *f;
 
-Returner<Base<Foo> > Foo::all()
-{
-  Derived<Foo>::foo();
-  return Foo::all();
-}
+// 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;