1 commit 96365aef99ec463375dfdaf6eb260823e0477b6a
2 Author: Adrian Prantl <aprantl@apple.com>
3 Date: Tue Apr 1 17:52:06 2014 +0000
5 Debug info: fix a crash when emitting IndirectFieldDecls, which were
6 previously not handled at all.
7 rdar://problem/16348575
9 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@205331 91177308-0d34-0410-b5e6-96231b3b80d8
11 diff --git a/lib/CodeGen/CGDebugInfo.cpp b/lib/CodeGen/CGDebugInfo.cpp
12 index 82db942..2556cf9 100644
13 --- tools/clang/lib/CodeGen/CGDebugInfo.cpp
14 +++ tools/clangb/lib/CodeGen/CGDebugInfo.cpp
15 @@ -1252,7 +1252,7 @@ CollectTemplateParams(const TemplateParameterList *TPList,
16 V = CGM.GetAddrOfFunction(FD);
17 // Member data pointers have special handling too to compute the fixed
18 // offset within the object.
19 - if (isa<FieldDecl>(D)) {
20 + if (isa<FieldDecl>(D) || isa<IndirectFieldDecl>(D)) {
21 // These five lines (& possibly the above member function pointer
22 // handling) might be able to be refactored to use similar code in
23 // CodeGenModule::getMemberPointerConstant
24 diff --git a/test/CodeGenCXX/debug-info-indirect-field-decl.cpp b/test/CodeGenCXX/debug-info-indirect-field-decl.cpp
26 index 0000000..131ceba
28 +++ tools/clang/test/CodeGenCXX/debug-info-indirect-field-decl.cpp
30 +// RUN: %clang_cc1 -emit-llvm -g -triple x86_64-apple-darwin %s -o - | FileCheck %s
32 +// Test that indirect field decls are handled gracefully.
33 +// rdar://problem/16348575
35 +template <class T, int T::*ptr> class Foo { };
39 + // CHECK: [ DW_TAG_member ] [line [[@LINE+1]], size 32, align 32, offset 32] [from _ZTSN3BarUt_E]
41 + // CHECK: [ DW_TAG_member ] [i2] [line [[@LINE+1]], size 32, align 32, offset 0] [from int]
46 +Foo<Bar, &Bar::i2> the_foo;