summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGExprAgg.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-12-02 22:52:04 +0000
committerChris Lattner <sabre@nondot.org>2010-12-02 22:52:04 +0000
commit5cd8475564aed3e224f527b3063423b03ec92689 (patch)
treea2897b5f06d8c8d2287bac8372216697c4479160 /clang/lib/CodeGen/CGExprAgg.cpp
parent7528af2f863a79a914f2f77cf4f4c43c915073b8 (diff)
downloadbcm5719-llvm-5cd8475564aed3e224f527b3063423b03ec92689.tar.gz
bcm5719-llvm-5cd8475564aed3e224f527b3063423b03ec92689.zip
Reflow to a style doug prefers, increasing indentation :-)
llvm-svn: 120746
Diffstat (limited to 'clang/lib/CodeGen/CGExprAgg.cpp')
-rw-r--r--clang/lib/CodeGen/CGExprAgg.cpp48
1 files changed, 24 insertions, 24 deletions
diff --git a/clang/lib/CodeGen/CGExprAgg.cpp b/clang/lib/CodeGen/CGExprAgg.cpp
index 97aabd8bf45..79ba32f0761 100644
--- a/clang/lib/CodeGen/CGExprAgg.cpp
+++ b/clang/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<RecordType>()->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<RecordType>()) {
+ if (!RT->isUnionType()) {
+ RecordDecl *SD = E->getType()->getAs<RecordType>()->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;
}
OpenPOWER on IntegriCloud