From: Fariborz Jahanian Date: Mon, 10 Aug 2009 18:46:38 +0000 (+0000) Subject: minor refactoring. No change otherwise. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=06f598aa45b651f9f3be0b916d43876eae747af0;p=clang minor refactoring. No change otherwise. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@78582 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/CGCXX.cpp b/lib/CodeGen/CGCXX.cpp index 8f6cfc05dd..417dcf748c 100644 --- a/lib/CodeGen/CGCXX.cpp +++ b/lib/CodeGen/CGCXX.cpp @@ -791,7 +791,18 @@ void CodeGenFunction::EmitClassMemberwiseCopy( Callee, CallArgs, BaseCopyCtor); } } - + +/// SynthesizeDefaultConstructor - synthesize a default constructor +void +CodeGenFunction::SynthesizeDefaultConstructor(const CXXConstructorDecl *CD, + const FunctionDecl *FD, + llvm::Function *Fn, + const FunctionArgList &Args) { + StartFunction(FD, FD->getResultType(), Fn, Args, SourceLocation()); + EmitCtorPrologue(CD); + FinishFunction(); +} + /// 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 diff --git a/lib/CodeGen/CodeGenFunction.cpp b/lib/CodeGen/CodeGenFunction.cpp index 6135f65513..309c76bea5 100644 --- a/lib/CodeGen/CodeGenFunction.cpp +++ b/lib/CodeGen/CodeGenFunction.cpp @@ -251,9 +251,7 @@ void CodeGenFunction::GenerateCode(const FunctionDecl *FD, else { assert(!ClassDecl->hasUserDeclaredConstructor() && "bogus constructor is being synthesize"); - StartFunction(FD, FD->getResultType(), Fn, Args, SourceLocation()); - EmitCtorPrologue(CD); - FinishFunction(); + SynthesizeDefaultConstructor(CD, FD, Fn, Args); } } diff --git a/lib/CodeGen/CodeGenFunction.h b/lib/CodeGen/CodeGenFunction.h index 5b6826f57f..d3571e593b 100644 --- a/lib/CodeGen/CodeGenFunction.h +++ b/lib/CodeGen/CodeGenFunction.h @@ -373,6 +373,10 @@ public: const FunctionDecl *FD, llvm::Function *Fn, const FunctionArgList &Args); + void SynthesizeDefaultConstructor(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