[cfe-commits] r81759 - in /cfe/trunk/lib/CodeGen: CGCXX.cpp CodeGenFunction.cpp CodeGenFunction.h
Anders Carlsson
andersca at mac.com
Sun Sep 13 22:32:02 PDT 2009
Author: andersca
Date: Mon Sep 14 00:32:02 2009
New Revision: 81759
URL: http://llvm.org/viewvc/llvm-project?rev=81759&view=rev
Log:
Remove an unnecessary FunctionDecl parameter to the synthesizing functions.
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=81759&r1=81758&r2=81759&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGCXX.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGCXX.cpp Mon Sep 14 00:32:02 2009
@@ -1578,14 +1578,13 @@
/// SynthesizeDefaultConstructor - synthesize a default constructor
void
-CodeGenFunction::SynthesizeDefaultConstructor(GlobalDecl GD,
- const FunctionDecl *FD,
+CodeGenFunction::SynthesizeDefaultConstructor(const CXXConstructorDecl *Ctor,
+ CXXCtorType Type,
llvm::Function *Fn,
const FunctionArgList &Args) {
- const CXXConstructorDecl *Ctor = cast<CXXConstructorDecl>(GD.getDecl());
-
- StartFunction(GD, FD->getResultType(), Fn, Args, SourceLocation());
- EmitCtorPrologue(Ctor);
+ StartFunction(GlobalDecl(Ctor, Type), Ctor->getResultType(), Fn, Args,
+ SourceLocation());
+ EmitCtorPrologue(Ctor, Type);
FinishFunction();
}
@@ -1604,15 +1603,16 @@
/// Virtual base class subobjects shall be copied only once by the
/// implicitly-defined copy constructor
-void CodeGenFunction::SynthesizeCXXCopyConstructor(GlobalDecl GD,
- const FunctionDecl *FD,
- llvm::Function *Fn,
- const FunctionArgList &Args) {
- const CXXConstructorDecl *Ctor = cast<CXXConstructorDecl>(GD.getDecl());
+void
+CodeGenFunction::SynthesizeCXXCopyConstructor(const CXXConstructorDecl *Ctor,
+ CXXCtorType Type,
+ llvm::Function *Fn,
+ const FunctionArgList &Args) {
const CXXRecordDecl *ClassDecl = Ctor->getParent();
assert(!ClassDecl->hasUserDeclaredCopyConstructor() &&
"SynthesizeCXXCopyConstructor - copy constructor has definition already");
- StartFunction(GD, Ctor->getResultType(), Fn, Args, SourceLocation());
+ StartFunction(GlobalDecl(Ctor, Type), Ctor->getResultType(), Fn, Args,
+ SourceLocation());
FunctionArgList::const_iterator i = Args.begin();
const VarDecl *ThisArg = i->first;
@@ -1693,14 +1693,13 @@
/// 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) {
const CXXRecordDecl *ClassDecl = cast<CXXRecordDecl>(CD->getDeclContext());
assert(!ClassDecl->hasUserDeclaredCopyAssignment() &&
"SynthesizeCXXCopyAssignment - copy assignment has user declaration");
- StartFunction(FD, FD->getResultType(), Fn, Args, SourceLocation());
+ StartFunction(CD, CD->getResultType(), Fn, Args, SourceLocation());
FunctionArgList::const_iterator i = Args.begin();
const VarDecl *ThisArg = i->first;
@@ -1767,7 +1766,8 @@
/// EmitCtorPrologue - This routine generates necessary code to initialize
/// base classes and non-static data members belonging to this constructor.
/// FIXME: This needs to take a CXXCtorType.
-void CodeGenFunction::EmitCtorPrologue(const CXXConstructorDecl *CD) {
+void CodeGenFunction::EmitCtorPrologue(const CXXConstructorDecl *CD,
+ CXXCtorType CtorType) {
const CXXRecordDecl *ClassDecl = cast<CXXRecordDecl>(CD->getDeclContext());
// FIXME: Add vbase initialization
llvm::Value *LoadOfThis = 0;
@@ -1785,7 +1785,7 @@
BaseClassDecl,
/*NullCheckValue=*/false);
EmitCXXConstructorCall(Member->getConstructor(),
- Ctor_Complete, V,
+ CtorType, V,
Member->const_arg_begin(),
Member->const_arg_end());
} else {
@@ -1924,7 +1924,8 @@
/// destructor. This is to call destructors on members and base classes
/// in reverse order of their construction.
/// FIXME: This needs to take a CXXDtorType.
-void CodeGenFunction::EmitDtorEpilogue(const CXXDestructorDecl *DD) {
+void CodeGenFunction::EmitDtorEpilogue(const CXXDestructorDecl *DD,
+ CXXDtorType DtorType) {
const CXXRecordDecl *ClassDecl = cast<CXXRecordDecl>(DD->getDeclContext());
assert(!ClassDecl->getNumVBases() &&
"FIXME: Destruction of virtual bases not supported");
@@ -1967,7 +1968,7 @@
ClassDecl, BaseClassDecl,
/*NullCheckValue=*/false);
EmitCXXDestructorCall(BaseClassDecl->getDestructor(getContext()),
- Dtor_Complete, V);
+ DtorType, V);
}
}
if (DD->getNumBaseOrMemberDestructions() || DD->isTrivial())
@@ -2040,19 +2041,18 @@
}
}
-void CodeGenFunction::SynthesizeDefaultDestructor(GlobalDecl GD,
- const FunctionDecl *FD,
+void CodeGenFunction::SynthesizeDefaultDestructor(const CXXDestructorDecl *Dtor,
+ CXXDtorType DtorType,
llvm::Function *Fn,
const FunctionArgList &Args) {
- const CXXDestructorDecl *Dtor = cast<CXXDestructorDecl>(GD.getDecl());
-
const CXXRecordDecl *ClassDecl = Dtor->getParent();
assert(!ClassDecl->hasUserDeclaredDestructor() &&
"SynthesizeDefaultDestructor - destructor has user declaration");
(void) ClassDecl;
- StartFunction(GD, Dtor->getResultType(), Fn, Args, SourceLocation());
- EmitDtorEpilogue(Dtor);
+ StartFunction(GlobalDecl(Dtor, DtorType), Dtor->getResultType(), Fn, Args,
+ SourceLocation());
+ EmitDtorEpilogue(Dtor, DtorType);
FinishFunction();
}
Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.cpp?rev=81759&r1=81758&r2=81759&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenFunction.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenFunction.cpp Mon Sep 14 00:32:02 2009
@@ -236,10 +236,10 @@
if (const CompoundStmt *S = FD->getCompoundBody()) {
StartFunction(GD, FD->getResultType(), Fn, Args, S->getLBracLoc());
if (const CXXConstructorDecl *CD = dyn_cast<CXXConstructorDecl>(FD))
- EmitCtorPrologue(CD);
+ EmitCtorPrologue(CD, GD.getCtorType());
EmitStmt(S);
if (const CXXDestructorDecl *DD = dyn_cast<CXXDestructorDecl>(FD))
- EmitDtorEpilogue(DD);
+ EmitDtorEpilogue(DD, GD.getDtorType());
FinishFunction(S->getRBracLoc());
}
else
@@ -250,19 +250,19 @@
if (CD->isCopyConstructor(getContext())) {
assert(!ClassDecl->hasUserDeclaredCopyConstructor() &&
"bogus constructor is being synthesize");
- SynthesizeCXXCopyConstructor(GD, FD, Fn, Args);
+ SynthesizeCXXCopyConstructor(CD, GD.getCtorType(), Fn, Args);
}
else {
assert(!ClassDecl->hasUserDeclaredConstructor() &&
"bogus constructor is being synthesize");
- SynthesizeDefaultConstructor(GD, FD, Fn, Args);
+ SynthesizeDefaultConstructor(CD, GD.getCtorType(), Fn, Args);
}
}
- else if (isa<CXXDestructorDecl>(FD))
- SynthesizeDefaultDestructor(GD, FD, Fn, Args);
+ else if (const CXXDestructorDecl *CD = dyn_cast<CXXDestructorDecl>(FD))
+ SynthesizeDefaultDestructor(CD, GD.getDtorType(), Fn, Args);
else if (const CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(FD)) {
if (MD->isCopyAssignment())
- SynthesizeCXXCopyAssignment(MD, FD, Fn, Args);
+ SynthesizeCXXCopyAssignment(MD, Fn, Args);
}
// Destroy the 'this' declaration.
Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.h?rev=81759&r1=81758&r2=81759&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenFunction.h (original)
+++ cfe/trunk/lib/CodeGen/CodeGenFunction.h Mon Sep 14 00:32:02 2009
@@ -380,32 +380,32 @@
int64_t nv_t, int64_t v_t,
int64_t nv_r, int64_t v_r);
- void EmitCtorPrologue(const CXXConstructorDecl *CD);
+ void EmitCtorPrologue(const CXXConstructorDecl *CD, CXXCtorType Type);
- void SynthesizeCXXCopyConstructor(GlobalDecl GD,
- const FunctionDecl *FD,
+ void SynthesizeCXXCopyConstructor(const CXXConstructorDecl *Ctor,
+ CXXCtorType Type,
llvm::Function *Fn,
const FunctionArgList &Args);
void SynthesizeCXXCopyAssignment(const CXXMethodDecl *CD,
- const FunctionDecl *FD,
llvm::Function *Fn,
const FunctionArgList &Args);
- void SynthesizeDefaultConstructor(GlobalDecl GD,
- const FunctionDecl *FD,
+ void SynthesizeDefaultConstructor(const CXXConstructorDecl *Ctor,
+ CXXCtorType Type,
llvm::Function *Fn,
const FunctionArgList &Args);
- void SynthesizeDefaultDestructor(GlobalDecl GD,
- const FunctionDecl *FD,
- llvm::Function *Fn,
- const FunctionArgList &Args);
+ void SynthesizeDefaultDestructor(const CXXDestructorDecl *Dtor,
+ CXXDtorType Type,
+ 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
/// in reverse order of their construction.
- void EmitDtorEpilogue(const CXXDestructorDecl *DD);
+ void EmitDtorEpilogue(const CXXDestructorDecl *Dtor,
+ CXXDtorType Type);
/// EmitFunctionProlog - Emit the target specific LLVM code to load the
/// arguments for the given function. This is also responsible for naming the
More information about the cfe-commits
mailing list