]> granicus.if.org Git - clang/commitdiff
Reduce code duplication a bit more. NFC.
authorRafael Espindola <rafael.espindola@gmail.com>
Mon, 15 Sep 2014 19:43:47 +0000 (19:43 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Mon, 15 Sep 2014 19:43:47 +0000 (19:43 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217813 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/ItaniumCXXABI.cpp
lib/CodeGen/MicrosoftCXXABI.cpp

index 22839cd0fae7d205463da29e9a1ccafc017cdcbd..91e9d4d7a08dd91c7eb803b05276d1cac31da5eb 100644 (file)
@@ -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<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,
index 42cb29c8b44e2b9e614d0a2bd0d6913a6579935e..36392bc5ed0cf0d39c62aa3b378ed90b2c6695ae 100644 (file)
@@ -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<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,