aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGCXX.cpp
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2009-08-12 21:14:35 +0000
committerFariborz Jahanian <fjahanian@apple.com>2009-08-12 21:14:35 +0000
commit2198ba12b73a8e6801d13f25de38031da6df46b6 (patch)
treedd1dda4d0ba2fcf167bfd880c922c5deb32998da /lib/CodeGen/CGCXX.cpp
parent34fae9cf27b19664f1f4526e195aff2299de2c40 (diff)
Patch for synthesizing copy assignment operator.
WIP. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@78841 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGCXX.cpp')
-rw-r--r--lib/CodeGen/CGCXX.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/lib/CodeGen/CGCXX.cpp b/lib/CodeGen/CGCXX.cpp
index f161f9f68e..b65c6b32db 100644
--- a/lib/CodeGen/CGCXX.cpp
+++ b/lib/CodeGen/CGCXX.cpp
@@ -902,6 +902,32 @@ void CodeGenFunction::SynthesizeCXXCopyConstructor(const CXXConstructorDecl *CD,
FinishFunction();
}
+/// SynthesizeCXXCopyAssignment - Implicitly define copy assignment operator.
+/// Before the implicitly-declared copy assignment operator for a class is
+/// implicitly defined, all implicitly- declared copy assignment operators for
+/// its direct base classes and its nonstatic data members shall have been
+/// implicitly defined. [12.8-p12]
+/// The implicitly-defined copy assignment operator for class X performs
+/// memberwise assignment of its subob- jects. The direct base classes of X are
+/// assigned first, in the order of their declaration in
+/// the base-specifier-list, and then the immediate nonstatic data members of X
+/// are assigned, in the order in which they were declared in the class
+/// definition.Each subobject is assigned in the manner appropriate to its type:
+/// — if the subobject is of class type, the copy assignment operator for the
+/// class is used (as if by explicit qual- ification; that is, ignoring any
+/// possible virtual overriding functions in more derived classes);
+/// — if the subobject is an array, each element is assigned, in the manner
+/// appropriate to the element type;
+/// — if the subobject is of scalar type, the built-in assignment operator is
+/// used.
+void CodeGenFunction::SynthesizeCXXCopyAssignment(const CXXMethodDecl *CD,
+ const FunctionDecl *FD,
+ llvm::Function *Fn,
+ const FunctionArgList &Args) {
+ StartFunction(FD, FD->getResultType(), Fn, Args, SourceLocation());
+
+ FinishFunction();
+}
/// EmitCtorPrologue - This routine generates necessary code to initialize
/// base classes and non-static data members belonging to this constructor.