1Pull in r205331 from upstream clang trunk (by Adrian Prantl): 2 3 Debug info: fix a crash when emitting IndirectFieldDecls, which were 4 previously not handled at all. 5 rdar://problem/16348575 6 7Introduced here: http://svnweb.freebsd.org/changeset/base/271432 8 9Index: 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 22Index: 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) 26@@ -0,0 +1,17 @@ 27+// RUN: %clang_cc1 -emit-llvm -g -triple x86_64-apple-darwin %s -o - | FileCheck %s 28+// 29+// Test that indirect field decls are handled gracefully. 30+// rdar://problem/16348575 31+// 32+template <class T, int T::*ptr> class Foo { }; 33+ 34+struct Bar { 35+ int i1; 36+ // CHECK: [ DW_TAG_member ] [line [[@LINE+1]], size 32, align 32, offset 32] [from _ZTSN3BarUt_E] 37+ union { 38+ // CHECK: [ DW_TAG_member ] [i2] [line [[@LINE+1]], size 32, align 32, offset 0] [from int] 39+ int i2; 40+ }; 41+}; 42+ 43+Foo<Bar, &Bar::i2> the_foo; 44