[cfe-commits] r78580 - in /cfe/trunk: lib/CodeGen/CGCXX.cpp test/CodeGenCXX/copy-constructor-synthesis.cpp
Fariborz Jahanian
fjahanian at apple.com
Mon Aug 10 11:34:26 PDT 2009
Author: fjahanian
Date: Mon Aug 10 13:34:26 2009
New Revision: 78580
URL: http://llvm.org/viewvc/llvm-project?rev=78580&view=rev
Log:
ir-gen for generating copying of scalar data members in
a synthesized copy constructor.
Modified:
cfe/trunk/lib/CodeGen/CGCXX.cpp
cfe/trunk/test/CodeGenCXX/copy-constructor-synthesis.cpp
Modified: cfe/trunk/lib/CodeGen/CGCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCXX.cpp?rev=78580&r1=78579&r2=78580&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGCXX.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGCXX.cpp Mon Aug 10 13:34:26 2009
@@ -855,7 +855,11 @@
0 /*ClassDecl*/, FieldClassDecl, FieldType);
continue;
}
- // FIXME. Do a built-in assignment of scalar data members.
+ // Do a built-in assignment of scalar data members.
+ LValue LHS = EmitLValueForField(LoadOfThis, *Field, false, 0);
+ LValue RHS = EmitLValueForField(LoadOfSrc, *Field, false, 0);
+ RValue RVRHS = EmitLoadOfLValue(RHS, FieldType);
+ EmitStoreThroughLValue(RVRHS, LHS, FieldType);
}
FinishFunction();
}
Modified: cfe/trunk/test/CodeGenCXX/copy-constructor-synthesis.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/copy-constructor-synthesis.cpp?rev=78580&r1=78579&r2=78580&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/copy-constructor-synthesis.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/copy-constructor-synthesis.cpp Mon Aug 10 13:34:26 2009
@@ -26,12 +26,21 @@
struct X : M, N, P { // ...
- X(){}
+ X() : f1(1.0), d1(2.0), i1(3), name("HELLO"), bf1(0xff), bf2(0xabcd) {}
P p0;
void pr() { printf("iM = %d iN = %d, m1.iM = %d\n", iM, iN, m1.iM);
- printf("im = %d p0.iP = %d, p1.iP = %d\n", iP, p0.iP, p1.iP); }
+ printf("im = %d p0.iP = %d, p1.iP = %d\n", iP, p0.iP, p1.iP);
+ printf("f1 = %f d1 = %f i1 = %d name(%s) \n", f1, d1, i1, name);
+ printf("bf1 = %x bf2 = %x\n", bf1, bf2);
+ }
M m1;
P p1;
+ float f1;
+ double d1;
+ int i1;
+ const char *name;
+ unsigned bf1 : 8;
+ unsigned bf2 : 16;
};
int main()
More information about the cfe-commits
mailing list