r217813 - Reduce code duplication a bit more. NFC.

Rafael Espindola rafael.espindola at gmail.com
Mon Sep 15 12:43:47 PDT 2014


Author: rafael
Date: Mon Sep 15 14:43:47 2014
New Revision: 217813

URL: http://llvm.org/viewvc/llvm-project?rev=217813&view=rev
Log:
Reduce code duplication a bit more. NFC.

Modified:
    cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp
    cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp

Modified: cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp?rev=217813&r1=217812&r2=217813&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp (original)
+++ cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp Mon Sep 15 14:43:47 2014
@@ -3038,18 +3038,7 @@ static void emitCXXDestructor(CodeGenMod
   if (dtorType == StructorType::Base && !CGM.TryEmitBaseDestructorAsAlias(dtor))
     return;
 
-  const CGFunctionInfo &fnInfo =
-      CGM.getTypes().arrangeCXXStructorDeclaration(dtor, dtorType);
-
-  auto *fn = cast<llvm::Function>(
-      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,

Modified: cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp?rev=217813&r1=217812&r2=217813&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp (original)
+++ cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp Mon Sep 15 14:43:47 2014
@@ -2903,18 +2903,7 @@ static void emitCXXDestructor(CodeGenMod
   if (dtorType == StructorType::Base && !CGM.TryEmitBaseDestructorAsAlias(dtor))
     return;
 
-  const CGFunctionInfo &fnInfo =
-      CGM.getTypes().arrangeCXXStructorDeclaration(dtor, dtorType);
-
-  auto *fn = cast<llvm::Function>(
-      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,





More information about the cfe-commits mailing list