1278716SdimPull in r205331 from upstream clang trunk (by Adrian Prantl): 2271433Semaste 3278716Sdim Debug info: fix a crash when emitting IndirectFieldDecls, which were 4278716Sdim previously not handled at all. 5278716Sdim rdar://problem/16348575 6271433Semaste 7278716SdimIntroduced here: http://svnweb.freebsd.org/changeset/base/271432 8278716Sdim 9278716SdimIndex: tools/clang/lib/CodeGen/CGDebugInfo.cpp 10278716Sdim=================================================================== 11278716Sdim--- tools/clang/lib/CodeGen/CGDebugInfo.cpp (revision 205330) 12278716Sdim+++ tools/clang/lib/CodeGen/CGDebugInfo.cpp (revision 205331) 13278716Sdim@@ -1252,7 +1252,7 @@ CollectTemplateParams(const TemplateParameterList 14271433Semaste V = CGM.GetAddrOfFunction(FD); 15271433Semaste // Member data pointers have special handling too to compute the fixed 16271433Semaste // offset within the object. 17271433Semaste- if (isa<FieldDecl>(D)) { 18271433Semaste+ if (isa<FieldDecl>(D) || isa<IndirectFieldDecl>(D)) { 19271433Semaste // These five lines (& possibly the above member function pointer 20271433Semaste // handling) might be able to be refactored to use similar code in 21271433Semaste // CodeGenModule::getMemberPointerConstant 22278716SdimIndex: tools/clang/test/CodeGenCXX/debug-info-indirect-field-decl.cpp 23278716Sdim=================================================================== 24278716Sdim--- tools/clang/test/CodeGenCXX/debug-info-indirect-field-decl.cpp (revision 0) 25278716Sdim+++ tools/clang/test/CodeGenCXX/debug-info-indirect-field-decl.cpp (revision 205331) 26271433Semaste@@ -0,0 +1,17 @@ 27271433Semaste+// RUN: %clang_cc1 -emit-llvm -g -triple x86_64-apple-darwin %s -o - | FileCheck %s 28271433Semaste+// 29271433Semaste+// Test that indirect field decls are handled gracefully. 30271433Semaste+// rdar://problem/16348575 31271433Semaste+// 32271433Semaste+template <class T, int T::*ptr> class Foo { }; 33271433Semaste+ 34271433Semaste+struct Bar { 35271433Semaste+ int i1; 36271433Semaste+ // CHECK: [ DW_TAG_member ] [line [[@LINE+1]], size 32, align 32, offset 32] [from _ZTSN3BarUt_E] 37271433Semaste+ union { 38271433Semaste+ // CHECK: [ DW_TAG_member ] [i2] [line [[@LINE+1]], size 32, align 32, offset 0] [from int] 39271433Semaste+ int i2; 40271433Semaste+ }; 41271433Semaste+}; 42271433Semaste+ 43271433Semaste+Foo<Bar, &Bar::i2> the_foo; 44