llvm/clang/test/CodeGenCXX/debug-info-template-fwd.cpp
Douglas Katzman 3459ce2e5e Stop messing with the 'g' group of options in CompilerInvocation.
With this change, most 'g' options are rejected by CompilerInvocation.
They remain only as Driver options. The new way to request debug info
from cc1 is with "-debug-info-kind={line-tables-only|limited|standalone}"
and "-dwarf-version={2|3|4}". In the absence of a command-line option
to specify Dwarf version, the Toolchain decides it, rather than placing
Toolchain-specific logic in CompilerInvocation.

Also fix a bug in the Windows compatibility argument parsing
in which the "rightmost argument wins" principle failed.

Differential Revision: http://reviews.llvm.org/D13221

llvm-svn: 249655
2015-10-08 04:24:12 +00:00

30 lines
1.2 KiB
C++

// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin -debug-info-kind=limited -emit-llvm -o - | FileCheck %s
// 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: !DICompositeType(tag: DW_TAG_structure_type, name: "Derived<int>"
// CHECK-NOT: DIFlagFwdDecl
// CHECK-SAME: ){{$}}
// rdar://problem/15931354
template <class A> class Derived;
template <class A> class Base {
static Derived<A> *create();
};
template <class A> struct Derived : Base<A> {
};
Base<int> *f;
// 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;