I misunderstood something about ABI converting.

> struct S1 { int x; };
> struct S2 { struct S1 (*g)(void); };
> struct S2 g;

Above example, struct S1 is changed to shadow parameter as following.

%struct.S2 = type { void (%struct.S1*)* }
%struct.S1 = type { i32 }
@g = common global %struct.S2 zeroinitializer, align 4

I think ABI converter is based on AST node so incomplete function type is not 
problem. My previous patch seemed to include several problems and I modified 
patch. Clang of trunk with modified patch didn't generate error on above 
example. Please review this patch.

Thanks,
Jin-Gu Kang
________________________________________
From: Eli Friedman [[email protected]]
Sent: Saturday, November 10, 2012 7:22 AM
To: Jin Gu Kang
Cc: [email protected]
Subject: Re: [cfe-commits] [cfe-dev][patch] Strange LLVM IR result on recursive 
type

On Fri, Nov 9, 2012 at 1:05 AM, Jin Gu Kang <[email protected]> wrote:
> Hi Eli,
>
> Thanks for your comment.
>
> I and my colleague tried to cut the cycle at struct type without returning 
> null on ConvertType. This patch cuts cycle on just struct type with checking 
> functions being processed. This method defers these struct types. I also send 
> test case for this situation. I didn't have experience to make test case. 
> Please check this test case and reivew the patch file. If there are something 
> wrong, please let me know about that.

Your patch makes clang crash on the following:

struct S1 { int x; };
struct S2 { struct S1 (*g)(void); };
struct S2 g;

-Eli

Attachment: Recursive_type.patch
Description: Recursive_type.patch

_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to