1 Pull in r205331 from upstream clang trunk (by Adrian Prantl):
3 Debug info: fix a crash when emitting IndirectFieldDecls, which were
4 previously not handled at all.
5 rdar://problem/16348575
7 Introduced here: http://svnweb.freebsd.org/changeset/base/271432
9 Index: tools/clang/lib/CodeGen/CGDebugInfo.cpp
10 ===================================================================
11 --- tools/clang/lib/CodeGen/CGDebugInfo.cpp (revision 205330)
12 +++ tools/clang/lib/CodeGen/CGDebugInfo.cpp (revision 205331)
13 @@ -1252,7 +1252,7 @@ CollectTemplateParams(const TemplateParameterList
14 V = CGM.GetAddrOfFunction(FD);
15 // Member data pointers have special handling too to compute the fixed
16 // offset within the object.
17 - if (isa<FieldDecl>(D)) {
18 + if (isa<FieldDecl>(D) || isa<IndirectFieldDecl>(D)) {
19 // These five lines (& possibly the above member function pointer
20 // handling) might be able to be refactored to use similar code in
21 // CodeGenModule::getMemberPointerConstant
22 Index: tools/clang/test/CodeGenCXX/debug-info-indirect-field-decl.cpp
23 ===================================================================
24 --- tools/clang/test/CodeGenCXX/debug-info-indirect-field-decl.cpp (revision 0)
25 +++ tools/clang/test/CodeGenCXX/debug-info-indirect-field-decl.cpp (revision 205331)
27 +// RUN: %clang_cc1 -emit-llvm -g -triple x86_64-apple-darwin %s -o - | FileCheck %s
29 +// Test that indirect field decls are handled gracefully.
30 +// rdar://problem/16348575
32 +template <class T, int T::*ptr> class Foo { };
36 + // CHECK: [ DW_TAG_member ] [line [[@LINE+1]], size 32, align 32, offset 32] [from _ZTSN3BarUt_E]
38 + // CHECK: [ DW_TAG_member ] [i2] [line [[@LINE+1]], size 32, align 32, offset 0] [from int]
43 +Foo<Bar, &Bar::i2> the_foo;