Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 18 Sep 2014 01:24:41 +0000 (UTC)
From:      Ed Maste <emaste@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r271729 - in stable/10/contrib/llvm: patches tools/clang/lib/CodeGen
Message-ID:  <201409180124.s8I1OfP3098013@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: emaste
Date: Thu Sep 18 01:24:40 2014
New Revision: 271729
URL: http://svnweb.freebsd.org/changeset/base/271729

Log:
  MFC Clang debuginfo crash fix
  
  r271432: Merge upstream Clang rev 205331 debuginfo crash fix:
  
        Debug info: fix a crash when emitting IndirectFieldDecls, which were
        previously not handled at all.
        rdar://problem/16348575
  
  r271433: Add clang patch corresponding to r271432
  
  Approved by:	re
  Sponsored by:	DARPA, AFRL

Added:
  stable/10/contrib/llvm/patches/patch-r271432-clang-r205331-debug-info-crash.diff
     - copied unchanged from r271433, head/contrib/llvm/patches/patch-r271432-clang-r205331-debug-info-crash.diff
Modified:
  stable/10/contrib/llvm/tools/clang/lib/CodeGen/CGDebugInfo.cpp
Directory Properties:
  stable/10/   (props changed)

Copied: stable/10/contrib/llvm/patches/patch-r271432-clang-r205331-debug-info-crash.diff (from r271433, head/contrib/llvm/patches/patch-r271432-clang-r205331-debug-info-crash.diff)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ stable/10/contrib/llvm/patches/patch-r271432-clang-r205331-debug-info-crash.diff	Thu Sep 18 01:24:40 2014	(r271729, copy of r271433, head/contrib/llvm/patches/patch-r271432-clang-r205331-debug-info-crash.diff)
@@ -0,0 +1,46 @@
+commit 96365aef99ec463375dfdaf6eb260823e0477b6a
+Author: Adrian Prantl <aprantl@apple.com>
+Date:   Tue Apr 1 17:52:06 2014 +0000
+
+    Debug info: fix a crash when emitting IndirectFieldDecls, which were
+    previously not handled at all.
+    rdar://problem/16348575
+    
+    git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@205331 91177308-0d34-0410-b5e6-96231b3b80d8
+
+diff --git a/lib/CodeGen/CGDebugInfo.cpp b/lib/CodeGen/CGDebugInfo.cpp
+index 82db942..2556cf9 100644
+--- tools/clang/lib/CodeGen/CGDebugInfo.cpp
++++ tools/clangb/lib/CodeGen/CGDebugInfo.cpp
+@@ -1252,7 +1252,7 @@ CollectTemplateParams(const TemplateParameterList *TPList,
+         V = CGM.GetAddrOfFunction(FD);
+       // Member data pointers have special handling too to compute the fixed
+       // offset within the object.
+-      if (isa<FieldDecl>(D)) {
++      if (isa<FieldDecl>(D) || isa<IndirectFieldDecl>(D)) {
+         // These five lines (& possibly the above member function pointer
+         // handling) might be able to be refactored to use similar code in
+         // CodeGenModule::getMemberPointerConstant
+diff --git a/test/CodeGenCXX/debug-info-indirect-field-decl.cpp b/test/CodeGenCXX/debug-info-indirect-field-decl.cpp
+new file mode 100644
+index 0000000..131ceba
+--- /dev/null
++++ tools/clang/test/CodeGenCXX/debug-info-indirect-field-decl.cpp
+@@ -0,0 +1,17 @@
++// RUN: %clang_cc1 -emit-llvm -g -triple x86_64-apple-darwin %s -o - | FileCheck %s
++//
++// Test that indirect field decls are handled gracefully.
++// rdar://problem/16348575
++//
++template <class T, int T::*ptr> class Foo {  };
++
++struct Bar {
++  int i1;
++  // CHECK: [ DW_TAG_member ] [line [[@LINE+1]], size 32, align 32, offset 32] [from _ZTSN3BarUt_E]
++  union {
++    // CHECK: [ DW_TAG_member ] [i2] [line [[@LINE+1]], size 32, align 32, offset 0] [from int]
++    int i2;
++  };
++};
++
++Foo<Bar, &Bar::i2> the_foo;

Modified: stable/10/contrib/llvm/tools/clang/lib/CodeGen/CGDebugInfo.cpp
==============================================================================
--- stable/10/contrib/llvm/tools/clang/lib/CodeGen/CGDebugInfo.cpp	Wed Sep 17 22:49:29 2014	(r271728)
+++ stable/10/contrib/llvm/tools/clang/lib/CodeGen/CGDebugInfo.cpp	Thu Sep 18 01:24:40 2014	(r271729)
@@ -1241,7 +1241,7 @@ CollectTemplateParams(const TemplatePara
         V = CGM.GetAddrOfFunction(FD);
       // Member data pointers have special handling too to compute the fixed
       // offset within the object.
-      if (isa<FieldDecl>(D)) {
+      if (isa<FieldDecl>(D) || isa<IndirectFieldDecl>(D)) {
         // These five lines (& possibly the above member function pointer
         // handling) might be able to be refactored to use similar code in
         // CodeGenModule::getMemberPointerConstant



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201409180124.s8I1OfP3098013>