From: Rafael Espindola Date: Mon, 15 Sep 2014 19:43:47 +0000 (+0000) Subject: Reduce code duplication a bit more. NFC. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7e1d05fd1c6c4ac1be6c71e2f2e89d524e26324e;p=clang Reduce code duplication a bit more. NFC. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217813 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/ItaniumCXXABI.cpp b/lib/CodeGen/ItaniumCXXABI.cpp index 22839cd0fa..91e9d4d7a0 100644 --- a/lib/CodeGen/ItaniumCXXABI.cpp +++ b/lib/CodeGen/ItaniumCXXABI.cpp @@ -3038,18 +3038,7 @@ static void emitCXXDestructor(CodeGenModule &CGM, const CXXDestructorDecl *dtor, if (dtorType == StructorType::Base && !CGM.TryEmitBaseDestructorAsAlias(dtor)) return; - const CGFunctionInfo &fnInfo = - CGM.getTypes().arrangeCXXStructorDeclaration(dtor, dtorType); - - auto *fn = cast( - CGM.getAddrOfCXXStructor(dtor, dtorType, &fnInfo, nullptr, true)); - - GlobalDecl GD(dtor, toCXXDtorType(dtorType)); - CGM.setFunctionLinkage(GD, fn); - CodeGenFunction(CGM).GenerateCode(GD, fn, fnInfo); - - CGM.setFunctionDefinitionAttributes(dtor, fn); - CGM.SetLLVMFunctionAttributesForDefinition(dtor, fn); + CGM.codegenCXXStructor(dtor, dtorType); } void ItaniumCXXABI::emitCXXStructor(const CXXMethodDecl *MD, diff --git a/lib/CodeGen/MicrosoftCXXABI.cpp b/lib/CodeGen/MicrosoftCXXABI.cpp index 42cb29c8b4..36392bc5ed 100644 --- a/lib/CodeGen/MicrosoftCXXABI.cpp +++ b/lib/CodeGen/MicrosoftCXXABI.cpp @@ -2903,18 +2903,7 @@ static void emitCXXDestructor(CodeGenModule &CGM, const CXXDestructorDecl *dtor, if (dtorType == StructorType::Base && !CGM.TryEmitBaseDestructorAsAlias(dtor)) return; - const CGFunctionInfo &fnInfo = - CGM.getTypes().arrangeCXXStructorDeclaration(dtor, dtorType); - - auto *fn = cast( - CGM.getAddrOfCXXStructor(dtor, dtorType, &fnInfo, nullptr, true)); - - GlobalDecl GD(dtor, toCXXDtorType(dtorType)); - CGM.setFunctionLinkage(GD, fn); - CodeGenFunction(CGM).GenerateCode(GD, fn, fnInfo); - - CGM.setFunctionDefinitionAttributes(dtor, fn); - CGM.SetLLVMFunctionAttributesForDefinition(dtor, fn); + CGM.codegenCXXStructor(dtor, dtorType); } void MicrosoftCXXABI::emitCXXStructor(const CXXMethodDecl *MD,