[cfe-dev] [cfe-commits] [Patch] visit order of InitListExpr

Jin Gu Kang jaykang10 at imrc.kist.re.kr
Wed Sep 5 01:40:17 PDT 2012


Thanks for your reviewing.

Sincerely,
Jin-Gu Kang
________________________________
From: Sebastian Redl [sebastian.redl at getdesigned.at]
Sent: Wednesday, September 05, 2012 4:41 PM
To: Jin Gu Kang
Cc: cfe-dev at cs.uiuc.edu
Subject: Re: [cfe-dev] [cfe-commits] [Patch] visit order of InitListExpr


On 04.09.2012, at 08:43, Jin Gu Kang wrote:

Hi all,

I checked "VisitInitListExpr(InitListExpr *ILE)" function and found strange type checking order. Current type checking order is as following.

 829   llvm::Constant *VisitInitListExpr(InitListExpr *ILE) {
 830     if (ILE->getType()->isArrayType())
 831       return EmitArrayInitialization(ILE);
 832
 833     if (ILE->getType()->isRecordType())
 834       return EmitUnionInitialization(ILE);
 835
 836     if (ILE->getType()->isUnionType())
 837       return EmitStructInitialization(ILE);
If RecodeType is checked eariler, UnionType will not be check because UnionType is checked from Decl's field and Type is also RecordType. Although EmitStructInitialization() and EmitUnionInitialization() call the same ConstStructBuilder::BuildStruct() function, It looks like wrong. I think UnionType should be checked eariler than RecordType.

What do you think about this?

I attach a simple patch to fix it.

Looks good, go ahead.

Sebastian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20120905/c499c7ad/attachment.html>


More information about the cfe-dev mailing list