From 6fb0ccfa0f9d47e8ca025ef68c38da9cb0116d57 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Fri, 15 Jul 2011 05:16:14 +0000 Subject: Enhance the IR type lowering code to be much smarter about recursively lowering types. Fore xample, we used to lower: struct bar { int a; }; struct foo { void (*FP)(struct bar); } G; to: %struct.foo = type { {}* } since the function pointer would cause recursive translation of bar and we didn't know if that would get us into trouble. We are now smart enough to know that it is fine, so we get this type instead: %struct.foo = type { void (i32)* } Codegen still needs to be prepared for uncooperative types at any place, which is why I let the maximally uncooperative code sit around for awhile to help shake out the bugs. llvm-svn: 135244 --- clang/test/CodeGen/struct-init.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'clang/test/CodeGen/struct-init.c') diff --git a/clang/test/CodeGen/struct-init.c b/clang/test/CodeGen/struct-init.c index 861c41e59cc..8a605c1b67c 100644 --- a/clang/test/CodeGen/struct-init.c +++ b/clang/test/CodeGen/struct-init.c @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 %s -emit-llvm-only +// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s typedef struct _zend_ini_entry zend_ini_entry; struct _zend_ini_entry { @@ -29,3 +29,11 @@ typedef struct __simd64_uint32_t { void foo() { const uint32x2_t signBit = { (uint2) 0x80000000 }; } + +// CHECK: %struct.fp_struct_foo = type { void (i32)* } +struct fp_struct_bar { int a; }; + +struct fp_struct_foo { + void (*FP)(struct fp_struct_bar); +} G; + -- cgit v1.2.3