]> granicus.if.org Git - clang/commitdiff
simplify EmitAggMemberInitializer a bit and make it work in 32-bit mode,
authorChris Lattner <sabre@nondot.org>
Thu, 6 May 2010 06:35:23 +0000 (06:35 +0000)
committerChris Lattner <sabre@nondot.org>
Thu, 6 May 2010 06:35:23 +0000 (06:35 +0000)
fixing PR7063.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103171 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGClass.cpp
test/CodeGenCXX/array-value-initialize.cpp

index f3f4d424789b58da2dd9a81d961c193838726e05..72d95b8556c9ec266bb220e3f419dc603b74a97f 100644 (file)
@@ -397,10 +397,9 @@ static void EmitAggMemberInitializer(CodeGenFunction &CGF,
   // Generate: if (loop-index < number-of-elements) fall to the loop body,
   // otherwise, go to the block after the for-loop.
   uint64_t NumElements = Array->getSize().getZExtValue();
-  llvm::Value * NumElementsPtr =
-    llvm::ConstantInt::get(llvm::Type::getInt64Ty(CGF.getLLVMContext()),
-                                                  NumElements);
   llvm::Value *Counter = CGF.Builder.CreateLoad(IndexVar);
+  llvm::Value *NumElementsPtr =
+    llvm::ConstantInt::get(Counter->getType(), NumElements);
   llvm::Value *IsLess = CGF.Builder.CreateICmpULT(Counter, NumElementsPtr,
                                                   "isless");
                                    
index 5fe6c2022d8f0d40a6f5c01790c2b0c3f2165bb7..8a3d5ff8b6f530d237447247ad2063bd99b62bb1 100644 (file)
@@ -1,4 +1,5 @@
-// RUN: %clang_cc1 -emit-llvm -o - %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin -emit-llvm -o - %s
+// RUN: %clang_cc1 -triple i386-apple-darwin -emit-llvm -o - %s
 
 // PR5463
 extern "C" int printf(...);
@@ -21,8 +22,31 @@ struct Foo {
         S sbar_[5];
 };
 
-int main(void)
-{
+int test1(void) {
         Foo a;
 }
 
+// PR7063
+
+
+struct Unit
+{
+  Unit() {}
+  Unit(const Unit& v)  {}
+};
+
+
+struct Stuff
+{
+  Unit leafPos[1];
+};
+
+
+int main()
+{
+  
+  Stuff a;
+  Stuff b = a;
+  
+  return 0;
+}
\ No newline at end of file