[cfe-commits] r151456 - /cfe/trunk/lib/CodeGen/CGExprAgg.cpp

Sebastian Redl sebastian.redl at getdesigned.at
Sat Feb 25 12:51:13 PST 2012


Author: cornedbee
Date: Sat Feb 25 14:51:13 2012
New Revision: 151456

URL: http://llvm.org/viewvc/llvm-project?rev=151456&view=rev
Log:
Fix crashers on unexpected std::initializer_list layouts. Found by inspection.

Modified:
    cfe/trunk/lib/CodeGen/CGExprAgg.cpp

Modified: cfe/trunk/lib/CodeGen/CGExprAgg.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprAgg.cpp?rev=151456&r1=151455&r2=151456&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExprAgg.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprAgg.cpp Sat Feb 25 14:51:13 2012
@@ -324,6 +324,7 @@
   RecordDecl::field_iterator field = record->field_begin();
   if (field == record->field_end()) {
     CGF.ErrorUnsupported(initList, "weird std::initializer_list");
+    return;
   }
 
   QualType elementPtr = ctx.getPointerType(element.withConst());
@@ -331,6 +332,7 @@
   // Start pointer.
   if (!ctx.hasSameType(field->getType(), elementPtr)) {
     CGF.ErrorUnsupported(initList, "weird std::initializer_list");
+    return;
   }
   LValue start = CGF.EmitLValueForFieldInitialization(destPtr, *field, 0);
   llvm::Value *arrayStart = Builder.CreateStructGEP(alloc, 0, "arraystart");
@@ -339,6 +341,7 @@
 
   if (field == record->field_end()) {
     CGF.ErrorUnsupported(initList, "weird std::initializer_list");
+    return;
   }
   LValue endOrLength = CGF.EmitLValueForFieldInitialization(destPtr, *field, 0);
   if (ctx.hasSameType(field->getType(), elementPtr)) {
@@ -350,6 +353,7 @@
     CGF.EmitStoreThroughLValue(RValue::get(Builder.getInt(size)), endOrLength);
   } else {
     CGF.ErrorUnsupported(initList, "weird std::initializer_list");
+    return;
   }
 
   if (!Dest.isExternallyDestructed())





More information about the cfe-commits mailing list