[cfe-commits] r78489 - in /cfe/trunk/lib/CodeGen: CGCXX.cpp CodeGenFunction.cpp CodeGenFunction.h
Fariborz Jahanian
fjahanian at apple.com
Sat Aug 8 12:31:03 PDT 2009
Author: fjahanian
Date: Sat Aug 8 14:31:03 2009
New Revision: 78489
URL: http://llvm.org/viewvc/llvm-project?rev=78489&view=rev
Log:
Refactoring of copy ctor ir-gen. No change in functionality.
Modified:
cfe/trunk/lib/CodeGen/CGCXX.cpp
cfe/trunk/lib/CodeGen/CodeGenFunction.cpp
cfe/trunk/lib/CodeGen/CodeGenFunction.h
Modified: cfe/trunk/lib/CodeGen/CGCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCXX.cpp?rev=78489&r1=78488&r2=78489&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGCXX.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGCXX.cpp Sat Aug 8 14:31:03 2009
@@ -699,7 +699,7 @@
}
}
-/// EmitCopyCtorBody - This routine implicitly defines body of a copy
+/// SynthesizeCXXCopyConstructor - This routine implicitly defines body of a copy
/// constructor, in accordance with section 12.8 (p7 and p8) of C++03
/// The implicitly-defined copy constructor for class X performs a memberwise
/// copy of its subobjects. The order of copying is the same as the order
@@ -714,11 +714,14 @@
/// Virtual base class subobjects shall be copied only once by the
/// implicitly-defined copy constructor
-void CodeGenFunction::EmitCopyCtorBody(const CXXConstructorDecl *CD,
+void CodeGenFunction::SynthesizeCXXCopyConstructor(const CXXConstructorDecl *CD,
+ const FunctionDecl *FD,
+ llvm::Function *Fn,
const FunctionArgList &Args) {
const CXXRecordDecl *ClassDecl = cast<CXXRecordDecl>(CD->getDeclContext());
assert(!ClassDecl->hasUserDeclaredCopyConstructor() &&
- "EmitCopyCtorBody - copy constructor has definition already");
+ "SynthesizeCXXCopyConstructor - copy constructor has definition already");
+ StartFunction(FD, FD->getResultType(), Fn, Args, SourceLocation());
FunctionArgList::const_iterator i = Args.begin();
const VarDecl *ThisArg = i->first;
@@ -759,6 +762,7 @@
}
// FIXME. Do a built-in assignment of scalar data members.
}
+ FinishFunction();
}
Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.cpp?rev=78489&r1=78488&r2=78489&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenFunction.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenFunction.cpp Sat Aug 8 14:31:03 2009
@@ -246,9 +246,7 @@
if (CD->isCopyConstructor(getContext())) {
assert(!ClassDecl->hasUserDeclaredCopyConstructor() &&
"bogus constructor is being synthesize");
- StartFunction(FD, FD->getResultType(), Fn, Args, SourceLocation());
- EmitCopyCtorBody(CD, Args);
- FinishFunction();
+ SynthesizeCXXCopyConstructor(CD, FD, Fn, Args);
}
else {
assert(!ClassDecl->hasUserDeclaredConstructor() &&
Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.h?rev=78489&r1=78488&r2=78489&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenFunction.h (original)
+++ cfe/trunk/lib/CodeGen/CodeGenFunction.h Sat Aug 8 14:31:03 2009
@@ -369,8 +369,10 @@
void EmitCtorPrologue(const CXXConstructorDecl *CD);
- void EmitCopyCtorBody(const CXXConstructorDecl *CD,
- const FunctionArgList &Args);
+ void SynthesizeCXXCopyConstructor(const CXXConstructorDecl *CD,
+ const FunctionDecl *FD,
+ llvm::Function *Fn,
+ const FunctionArgList &Args);
/// EmitDtorEpilogue - Emit all code that comes at the end of class's
/// destructor. This is to call destructors on members and base classes
More information about the cfe-commits
mailing list