[cfe-commits] r103171 - in /cfe/trunk: lib/CodeGen/CGClass.cpp test/CodeGenCXX/array-value-initialize.cpp
Chris Lattner
sabre at nondot.org
Wed May 5 23:35:23 PDT 2010
Author: lattner
Date: Thu May 6 01:35:23 2010
New Revision: 103171
URL: http://llvm.org/viewvc/llvm-project?rev=103171&view=rev
Log:
simplify EmitAggMemberInitializer a bit and make it work in 32-bit mode,
fixing PR7063.
Modified:
cfe/trunk/lib/CodeGen/CGClass.cpp
cfe/trunk/test/CodeGenCXX/array-value-initialize.cpp
Modified: cfe/trunk/lib/CodeGen/CGClass.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGClass.cpp?rev=103171&r1=103170&r2=103171&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGClass.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGClass.cpp Thu May 6 01:35:23 2010
@@ -397,10 +397,9 @@
// 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");
Modified: cfe/trunk/test/CodeGenCXX/array-value-initialize.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/array-value-initialize.cpp?rev=103171&r1=103170&r2=103171&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/array-value-initialize.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/array-value-initialize.cpp Thu May 6 01:35:23 2010
@@ -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 @@
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
More information about the cfe-commits
mailing list