From: Chris Lattner Date: Thu, 2 Dec 2010 22:52:04 +0000 (+0000) Subject: Reflow to a style doug prefers, increasing indentation :-) X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8c00ad1e3897e8a00f41bbd52135be8390d5c15c;p=clang Reflow to a style doug prefers, increasing indentation :-) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120746 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/CGExprAgg.cpp b/lib/CodeGen/CGExprAgg.cpp index 97aabd8bf4..79ba32f076 100644 --- a/lib/CodeGen/CGExprAgg.cpp +++ b/lib/CodeGen/CGExprAgg.cpp @@ -741,33 +741,33 @@ static uint64_t GetNumNonZeroBytesInInit(const Expr *E, CodeGenFunction &CGF) { // InitListExprs for structs have to be handled carefully. If there are // reference members, we need to consider the size of the reference, not the // referencee. InitListExprs for unions and arrays can't have references. - if (!E->getType()->isUnionType() && !E->getType()->isArrayType()) { - RecordDecl *SD = E->getType()->getAs()->getDecl(); - uint64_t NumNonZeroBytes = 0; - - unsigned ILEElement = 0; - for (RecordDecl::field_iterator Field = SD->field_begin(), - FieldEnd = SD->field_end(); Field != FieldEnd; ++Field) { - // We're done once we hit the flexible array member or run out of - // InitListExpr elements. - if (Field->getType()->isIncompleteArrayType() || - ILEElement == ILE->getNumInits()) - break; - if (Field->isUnnamedBitfield()) - continue; - - const Expr *E = ILE->getInit(ILEElement++); + if (const RecordType *RT = E->getType()->getAs()) { + if (!RT->isUnionType()) { + RecordDecl *SD = E->getType()->getAs()->getDecl(); + uint64_t NumNonZeroBytes = 0; - // Reference values are always non-null and have the width of a pointer. - if (Field->getType()->isReferenceType()) { - NumNonZeroBytes += CGF.getContext().Target.getPointerWidth(0); - continue; - } + unsigned ILEElement = 0; + for (RecordDecl::field_iterator Field = SD->field_begin(), + FieldEnd = SD->field_end(); Field != FieldEnd; ++Field) { + // We're done once we hit the flexible array member or run out of + // InitListExpr elements. + if (Field->getType()->isIncompleteArrayType() || + ILEElement == ILE->getNumInits()) + break; + if (Field->isUnnamedBitfield()) + continue; + + const Expr *E = ILE->getInit(ILEElement++); + + // Reference values are always non-null and have the width of a pointer. + if (Field->getType()->isReferenceType()) + NumNonZeroBytes += CGF.getContext().Target.getPointerWidth(0); + else + NumNonZeroBytes += GetNumNonZeroBytesInInit(E, CGF); + } - NumNonZeroBytes += GetNumNonZeroBytesInInit(E, CGF); + return NumNonZeroBytes; } - - return NumNonZeroBytes; }