diff options
| -rw-r--r-- | clang/lib/CodeGen/CGCXX.cpp | 25 | ||||
| -rw-r--r-- | clang/lib/CodeGen/CGClass.cpp | 7 | ||||
| -rw-r--r-- | clang/lib/CodeGen/CGDeclCXX.cpp | 2 | ||||
| -rw-r--r-- | clang/lib/CodeGen/CGException.cpp | 2 | ||||
| -rw-r--r-- | clang/lib/CodeGen/CGExpr.cpp | 4 | ||||
| -rw-r--r-- | clang/lib/CodeGen/CGExprCXX.cpp | 3 | ||||
| -rw-r--r-- | clang/lib/CodeGen/CodeGenModule.h | 24 | ||||
| -rw-r--r-- | clang/lib/CodeGen/ItaniumCXXABI.cpp | 2 | ||||
| -rw-r--r-- | clang/lib/CodeGen/MicrosoftCXXABI.cpp | 2 | 
9 files changed, 21 insertions, 50 deletions
diff --git a/clang/lib/CodeGen/CGCXX.cpp b/clang/lib/CodeGen/CGCXX.cpp index 583017cfcd9..6244c3b3d2b 100644 --- a/clang/lib/CodeGen/CGCXX.cpp +++ b/clang/lib/CodeGen/CGCXX.cpp @@ -215,8 +215,8 @@ void CodeGenModule::EmitCXXConstructor(const CXXConstructorDecl *ctor,    const CGFunctionInfo &fnInfo =        getTypes().arrangeCXXStructorDeclaration(ctor, getFromCtorType(ctorType)); -  auto *fn = cast<llvm::Function>( -      GetAddrOfCXXConstructor(ctor, ctorType, &fnInfo, true)); +  auto *fn = cast<llvm::Function>(getAddrOfCXXStructor( +      ctor, getFromCtorType(ctorType), &fnInfo, nullptr, true));    setFunctionLinkage(GlobalDecl(ctor, ctorType), fn);    CodeGenFunction(*this).GenerateCode(GlobalDecl(ctor, ctorType), fn, fnInfo); @@ -251,13 +251,6 @@ llvm::GlobalValue *CodeGenModule::getAddrOfCXXStructor(                                                        DontDefer));  } -llvm::GlobalValue *CodeGenModule::GetAddrOfCXXConstructor( -    const CXXConstructorDecl *ctor, CXXCtorType ctorType, -    const CGFunctionInfo *fnInfo, bool DontDefer) { -  return getAddrOfCXXStructor(ctor, getFromCtorType(ctorType), fnInfo, nullptr, -                              DontDefer); -} -  void CodeGenModule::EmitCXXDestructor(const CXXDestructorDecl *dtor,                                        CXXDtorType dtorType) {    // The complete destructor is equivalent to the base destructor for @@ -285,8 +278,8 @@ void CodeGenModule::EmitCXXDestructor(const CXXDestructorDecl *dtor,    const CGFunctionInfo &fnInfo =        getTypes().arrangeCXXStructorDeclaration(dtor, getFromDtorType(dtorType)); -  auto *fn = cast<llvm::Function>( -      GetAddrOfCXXDestructor(dtor, dtorType, &fnInfo, nullptr, true)); +  auto *fn = cast<llvm::Function>(getAddrOfCXXStructor( +      dtor, getFromDtorType(dtorType), &fnInfo, nullptr, true));    setFunctionLinkage(GlobalDecl(dtor, dtorType), fn);    CodeGenFunction(*this).GenerateCode(GlobalDecl(dtor, dtorType), fn, fnInfo); @@ -295,16 +288,6 @@ void CodeGenModule::EmitCXXDestructor(const CXXDestructorDecl *dtor,    SetLLVMFunctionAttributesForDefinition(dtor, fn);  } -llvm::GlobalValue * -CodeGenModule::GetAddrOfCXXDestructor(const CXXDestructorDecl *dtor, -                                      CXXDtorType dtorType, -                                      const CGFunctionInfo *fnInfo, -                                      llvm::FunctionType *fnType, -                                      bool DontDefer) { -  return getAddrOfCXXStructor(dtor, getFromDtorType(dtorType), fnInfo, fnType, -                              DontDefer); -} -  static llvm::Value *BuildAppleKextVirtualCall(CodeGenFunction &CGF,                                                GlobalDecl GD,                                                llvm::Type *Ty, diff --git a/clang/lib/CodeGen/CGClass.cpp b/clang/lib/CodeGen/CGClass.cpp index 73afe234e91..1de325feea3 100644 --- a/clang/lib/CodeGen/CGClass.cpp +++ b/clang/lib/CodeGen/CGClass.cpp @@ -1681,7 +1681,7 @@ void CodeGenFunction::EmitCXXConstructorCall(const CXXConstructorDecl *D,        *this, D, Type, ForVirtualBase, Delegating, Args);    // Emit the call. -  llvm::Value *Callee = CGM.GetAddrOfCXXConstructor(D, Type); +  llvm::Value *Callee = CGM.getAddrOfCXXStructor(D, getFromCtorType(Type));    const CGFunctionInfo &Info =        CGM.getTypes().arrangeCXXConstructorCall(Args, D, Type, ExtraArgs);    EmitCall(Info, Callee, ReturnValueSlot(), Args, D); @@ -1698,7 +1698,7 @@ CodeGenFunction::EmitSynthesizedCXXCopyCtorCall(const CXXConstructorDecl *D,      EmitAggregateCopy(This, Src, E->arg_begin()->getType());      return;    } -  llvm::Value *Callee = CGM.GetAddrOfCXXConstructor(D, clang::Ctor_Complete); +  llvm::Value *Callee = CGM.getAddrOfCXXStructor(D, StructorType::Complete);    assert(D->isInstance() &&           "Trying to emit a member call expr on a static method!"); @@ -1758,7 +1758,8 @@ CodeGenFunction::EmitDelegateCXXConstructorCall(const CXXConstructorDecl *Ctor,      EmitDelegateCallArg(DelegateArgs, param, Loc);    } -  llvm::Value *Callee = CGM.GetAddrOfCXXConstructor(Ctor, CtorType); +  llvm::Value *Callee = +      CGM.getAddrOfCXXStructor(Ctor, getFromCtorType(CtorType));    EmitCall(CGM.getTypes()                 .arrangeCXXStructorDeclaration(Ctor, getFromCtorType(CtorType)),             Callee, ReturnValueSlot(), DelegateArgs, Ctor); diff --git a/clang/lib/CodeGen/CGDeclCXX.cpp b/clang/lib/CodeGen/CGDeclCXX.cpp index 79a05586927..3e5f42e18c2 100644 --- a/clang/lib/CodeGen/CGDeclCXX.cpp +++ b/clang/lib/CodeGen/CGDeclCXX.cpp @@ -96,7 +96,7 @@ static void EmitDeclDestroy(CodeGenFunction &CGF, const VarDecl &D,      assert(!record->hasTrivialDestructor());      CXXDestructorDecl *dtor = record->getDestructor(); -    function = CGM.GetAddrOfCXXDestructor(dtor, Dtor_Complete); +    function = CGM.getAddrOfCXXStructor(dtor, StructorType::Complete);      argument = llvm::ConstantExpr::getBitCast(          addr, CGF.getTypes().ConvertType(type)->getPointerTo()); diff --git a/clang/lib/CodeGen/CGException.cpp b/clang/lib/CodeGen/CGException.cpp index 49f84965608..05eb6ebca30 100644 --- a/clang/lib/CodeGen/CGException.cpp +++ b/clang/lib/CodeGen/CGException.cpp @@ -456,7 +456,7 @@ void CodeGenFunction::EmitCXXThrowExpr(const CXXThrowExpr *E,      CXXRecordDecl *Record = cast<CXXRecordDecl>(RecordTy->getDecl());      if (!Record->hasTrivialDestructor()) {        CXXDestructorDecl *DtorD = Record->getDestructor(); -      Dtor = CGM.GetAddrOfCXXDestructor(DtorD, Dtor_Complete); +      Dtor = CGM.getAddrOfCXXStructor(DtorD, StructorType::Complete);        Dtor = llvm::ConstantExpr::getBitCast(Dtor, Int8PtrTy);      }    } diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp index 61818db2858..4fe37546b60 100644 --- a/clang/lib/CodeGen/CGExpr.cpp +++ b/clang/lib/CodeGen/CGExpr.cpp @@ -267,8 +267,8 @@ pushTemporaryCleanup(CodeGenFunction &CGF, const MaterializeTemporaryExpr *M,            dyn_cast_or_null<VarDecl>(M->getExtendingDecl()));        CleanupArg = llvm::Constant::getNullValue(CGF.Int8PtrTy);      } else { -      CleanupFn = -        CGF.CGM.GetAddrOfCXXDestructor(ReferenceTemporaryDtor, Dtor_Complete); +      CleanupFn = CGF.CGM.getAddrOfCXXStructor(ReferenceTemporaryDtor, +                                               StructorType::Complete);        CleanupArg = cast<llvm::Constant>(ReferenceTemporary);      }      CGF.CGM.getCXXABI().registerGlobalDtor( diff --git a/clang/lib/CodeGen/CGExprCXX.cpp b/clang/lib/CodeGen/CGExprCXX.cpp index a3e444a3f51..7d41af40f6a 100644 --- a/clang/lib/CodeGen/CGExprCXX.cpp +++ b/clang/lib/CodeGen/CGExprCXX.cpp @@ -200,7 +200,8 @@ RValue CodeGenFunction::EmitCXXMemberCallExpr(const CXXMemberCallExpr *CE,            ME->hasQualifier())          Callee = BuildAppleKextVirtualCall(MD, ME->getQualifier(), Ty);        else if (!DevirtualizedMethod) -        Callee = CGM.GetAddrOfCXXDestructor(Dtor, Dtor_Complete, FInfo, Ty); +        Callee = +            CGM.getAddrOfCXXStructor(Dtor, StructorType::Complete, FInfo, Ty);        else {          const CXXDestructorDecl *DDtor =            cast<CXXDestructorDecl>(DevirtualizedMethod); diff --git a/clang/lib/CodeGen/CodeGenModule.h b/clang/lib/CodeGen/CodeGenModule.h index c4d1a3b9761..3b4417b351f 100644 --- a/clang/lib/CodeGen/CodeGenModule.h +++ b/clang/lib/CodeGen/CodeGenModule.h @@ -661,11 +661,11 @@ public:    llvm::Constant *GetAddrOfGlobal(GlobalDecl GD) {      if (isa<CXXConstructorDecl>(GD.getDecl())) -      return GetAddrOfCXXConstructor(cast<CXXConstructorDecl>(GD.getDecl()), -                                     GD.getCtorType()); +      return getAddrOfCXXStructor(cast<CXXConstructorDecl>(GD.getDecl()), +                                  getFromCtorType(GD.getCtorType()));      else if (isa<CXXDestructorDecl>(GD.getDecl())) -      return GetAddrOfCXXDestructor(cast<CXXDestructorDecl>(GD.getDecl()), -                                     GD.getDtorType()); +      return getAddrOfCXXStructor(cast<CXXDestructorDecl>(GD.getDecl()), +                                  getFromDtorType(GD.getDtorType()));      else if (isa<FunctionDecl>(GD.getDecl()))        return GetAddrOfFunction(GD);      else @@ -801,28 +801,14 @@ public:    /// \brief Retrieve the record type that describes the state of an    /// Objective-C fast enumeration loop (for..in).    QualType getObjCFastEnumerationStateType(); -   -  /// Return the address of the constructor of the given type. +  /// Return the address of the constructor/destructor of the given type.    llvm::GlobalValue *    getAddrOfCXXStructor(const CXXMethodDecl *MD, StructorType Type,                         const CGFunctionInfo *FnInfo = nullptr,                         llvm::FunctionType *FnType = nullptr,                         bool DontDefer = false); -  llvm::GlobalValue * -  GetAddrOfCXXConstructor(const CXXConstructorDecl *ctor, CXXCtorType ctorType, -                          const CGFunctionInfo *fnInfo = nullptr, -                          bool DontDefer = false); - -  /// Return the address of the constructor of the given type. -  llvm::GlobalValue * -  GetAddrOfCXXDestructor(const CXXDestructorDecl *dtor, -                         CXXDtorType dtorType, -                         const CGFunctionInfo *fnInfo = nullptr, -                         llvm::FunctionType *fnType = nullptr, -                         bool DontDefer = false); -    /// Given a builtin id for a function like "__builtin_fabsf", return a    /// Function* for "fabsf".    llvm::Value *getBuiltinLibFunction(const FunctionDecl *FD, diff --git a/clang/lib/CodeGen/ItaniumCXXABI.cpp b/clang/lib/CodeGen/ItaniumCXXABI.cpp index b6d08409a88..25e2715daaf 100644 --- a/clang/lib/CodeGen/ItaniumCXXABI.cpp +++ b/clang/lib/CodeGen/ItaniumCXXABI.cpp @@ -1177,7 +1177,7 @@ void ItaniumCXXABI::EmitDestructorCall(CodeGenFunction &CGF,      Callee = CGF.BuildAppleKextVirtualDestructorCall(DD, Type, DD->getParent());    if (!Callee) -    Callee = CGM.GetAddrOfCXXDestructor(DD, Type); +    Callee = CGM.getAddrOfCXXStructor(DD, getFromDtorType(Type));    CGF.EmitCXXMemberOrOperatorCall(DD, Callee, ReturnValueSlot(), This, VTT,                                    VTTTy, nullptr); diff --git a/clang/lib/CodeGen/MicrosoftCXXABI.cpp b/clang/lib/CodeGen/MicrosoftCXXABI.cpp index e308a15ef13..173099a6bba 100644 --- a/clang/lib/CodeGen/MicrosoftCXXABI.cpp +++ b/clang/lib/CodeGen/MicrosoftCXXABI.cpp @@ -1145,7 +1145,7 @@ void MicrosoftCXXABI::EmitDestructorCall(CodeGenFunction &CGF,                                           const CXXDestructorDecl *DD,                                           CXXDtorType Type, bool ForVirtualBase,                                           bool Delegating, llvm::Value *This) { -  llvm::Value *Callee = CGM.GetAddrOfCXXDestructor(DD, Type); +  llvm::Value *Callee = CGM.getAddrOfCXXStructor(DD, getFromDtorType(Type));    if (DD->isVirtual()) {      assert(Type != CXXDtorType::Dtor_Deleting &&  | 

