[cfe-commits] [Patch] visit order of InitListExpr
Jin Gu Kang
jaykang10 at imrc.kist.re.kr
Mon Sep 3 22:23:17 PDT 2012
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.
Regards,
Jin-Gu Kang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120904/6a6264ea/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: clang.patch
Type: application/octet-stream
Size: 599 bytes
Desc: clang.patch
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120904/6a6264ea/attachment.obj>
More information about the cfe-commits
mailing list