From ecf9bf0158835d6be37905a71d50d6a43f071968 Mon Sep 17 00:00:00 2001 From: Anders Carlsson Date: Thu, 10 Sep 2009 23:43:36 +0000 Subject: [PATCH] GlobalDecl doesn't have an explicit constructor anymore. llvm-svn: 81481 --- clang/lib/CodeGen/CGCXX.cpp | 18 ++++++++---------- clang/lib/CodeGen/CGDecl.cpp | 2 +- clang/lib/CodeGen/CGExpr.cpp | 2 +- clang/lib/CodeGen/CGExprConstant.cpp | 2 +- clang/lib/CodeGen/CodeGenModule.cpp | 13 +++++++------ 5 files changed, 18 insertions(+), 19 deletions(-) diff --git a/clang/lib/CodeGen/CGCXX.cpp b/clang/lib/CodeGen/CGCXX.cpp index 828892a24148..e169881eeca1 100644 --- a/clang/lib/CodeGen/CGCXX.cpp +++ b/clang/lib/CodeGen/CGCXX.cpp @@ -227,7 +227,7 @@ RValue CodeGenFunction::EmitCXXMemberCallExpr(const CXXMemberCallExpr *CE) { = dyn_cast(MD)) Callee = CGM.GetAddrOfFunction(GlobalDecl(Destructor, Dtor_Complete), Ty); else - Callee = CGM.GetAddrOfFunction(GlobalDecl(MD), Ty); + Callee = CGM.GetAddrOfFunction(MD, Ty); return EmitCXXMemberCall(MD, Callee, This, CE->arg_begin(), CE->arg_end()); @@ -256,7 +256,7 @@ CodeGenFunction::EmitCXXOperatorMemberCallExpr(const CXXOperatorCallExpr *E, const llvm::Type *Ty = CGM.getTypes().GetFunctionType(CGM.getTypes().getFunctionInfo(MD), FPT->isVariadic()); - llvm::Constant *Callee = CGM.GetAddrOfFunction(GlobalDecl(MD), Ty); + llvm::Constant *Callee = CGM.GetAddrOfFunction(MD, Ty); llvm::Value *This = EmitLValue(E->getArg(0)).getAddress(); @@ -576,8 +576,7 @@ llvm::Value *CodeGenFunction::EmitCXXNewExpr(const CXXNewExpr *E) { // Emit the call to new. RValue RV = EmitCall(CGM.getTypes().getFunctionInfo(NewFTy->getResultType(), NewArgs), - CGM.GetAddrOfFunction(GlobalDecl(NewFD)), - NewArgs, NewFD); + CGM.GetAddrOfFunction(NewFD), NewArgs, NewFD); // If an allocation function is declared with an empty exception specification // it returns null to indicate failure to allocate storage. [expr.new]p13. @@ -699,7 +698,7 @@ void CodeGenFunction::EmitCXXDeleteExpr(const CXXDeleteExpr *E) { // Emit the call to delete. EmitCall(CGM.getTypes().getFunctionInfo(DeleteFTy->getResultType(), DeleteArgs), - CGM.GetAddrOfFunction(GlobalDecl(DeleteFD)), + CGM.GetAddrOfFunction(DeleteFD), DeleteArgs, DeleteFD); EmitBlock(DeleteEnd); @@ -900,7 +899,7 @@ public: mi != e; ++mi) { const CXXMethodDecl *OMD = *mi; llvm::Constant *om; - om = CGM.GetAddrOfFunction(GlobalDecl(OMD), Ptr8Ty); + om = CGM.GetAddrOfFunction(OMD, Ptr8Ty); om = llvm::ConstantExpr::getBitCast(om, Ptr8Ty); for (Index_t i = 0, e = submethods.size(); @@ -964,8 +963,7 @@ public: ++mi) if (mi->isVirtual()) { const CXXMethodDecl *MD = *mi; - llvm::Constant *m = wrap(CGM.GetAddrOfFunction(GlobalDecl(MD), - Ptr8Ty)); + llvm::Constant *m = wrap(CGM.GetAddrOfFunction(MD, Ptr8Ty)); OverrideMethod(MD, m, MorallyVirtual, Offset); } } @@ -1440,7 +1438,7 @@ void CodeGenFunction::EmitClassAggrCopyAssignment(llvm::Value *Dest, const llvm::Type *LTy = CGM.getTypes().GetFunctionType(CGM.getTypes().getFunctionInfo(MD), FPT->isVariadic()); - llvm::Constant *Callee = CGM.GetAddrOfFunction(GlobalDecl(MD), LTy); + llvm::Constant *Callee = CGM.GetAddrOfFunction(MD, LTy); CallArgList CallArgs; // Push the this (Dest) ptr. @@ -1532,7 +1530,7 @@ void CodeGenFunction::EmitClassCopyAssignment( const llvm::Type *LTy = CGM.getTypes().GetFunctionType(CGM.getTypes().getFunctionInfo(MD), FPT->isVariadic()); - llvm::Constant *Callee = CGM.GetAddrOfFunction(GlobalDecl(MD), LTy); + llvm::Constant *Callee = CGM.GetAddrOfFunction(MD, LTy); CallArgList CallArgs; // Push the this (Dest) ptr. diff --git a/clang/lib/CodeGen/CGDecl.cpp b/clang/lib/CodeGen/CGDecl.cpp index 5abe31e25272..82c1c02bf826 100644 --- a/clang/lib/CodeGen/CGDecl.cpp +++ b/clang/lib/CodeGen/CGDecl.cpp @@ -468,7 +468,7 @@ void CodeGenFunction::EmitLocalBlockVarDecl(const VarDecl &D) { if (const CleanupAttr *CA = D.getAttr()) { const FunctionDecl *FD = CA->getFunctionDecl(); - llvm::Constant* F = CGM.GetAddrOfFunction(GlobalDecl(FD)); + llvm::Constant* F = CGM.GetAddrOfFunction(FD); assert(F && "Could not find function!"); CleanupScope scope(*this); diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp index dde6899c29bf..ba9828c87905 100644 --- a/clang/lib/CodeGen/CGExpr.cpp +++ b/clang/lib/CodeGen/CGExpr.cpp @@ -744,7 +744,7 @@ LValue CodeGenFunction::EmitDeclRefLValue(const DeclRefExpr *E) { LV.SetGlobalObjCRef(LV, true); return LV; } else if (const FunctionDecl *FD = dyn_cast(E->getDecl())) { - llvm::Value* V = CGM.GetAddrOfFunction(GlobalDecl(FD)); + llvm::Value* V = CGM.GetAddrOfFunction(FD); if (!FD->hasPrototype()) { if (const FunctionProtoType *Proto = FD->getType()->getAsFunctionProtoType()) { diff --git a/clang/lib/CodeGen/CGExprConstant.cpp b/clang/lib/CodeGen/CGExprConstant.cpp index bea6d80b43dc..4f1b29bcb994 100644 --- a/clang/lib/CodeGen/CGExprConstant.cpp +++ b/clang/lib/CodeGen/CGExprConstant.cpp @@ -601,7 +601,7 @@ public: case Expr::QualifiedDeclRefExprClass: { NamedDecl *Decl = cast(E)->getDecl(); if (const FunctionDecl *FD = dyn_cast(Decl)) - return CGM.GetAddrOfFunction(GlobalDecl(FD)); + return CGM.GetAddrOfFunction(FD); if (const VarDecl* VD = dyn_cast(Decl)) { // We can never refer to a variable with local storage. if (!VD->hasLocalStorage()) { diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index 37e283a9b63c..064f3efcc598 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -743,7 +743,7 @@ void CodeGenModule::DeferredCopyAssignmentToEmit(GlobalDecl CopyAssignDecl) { if (!BaseClassDecl->hasTrivialCopyAssignment() && !BaseClassDecl->hasUserDeclaredCopyAssignment() && BaseClassDecl->hasConstCopyAssignment(getContext(), MD)) - GetAddrOfFunction(GlobalDecl(MD), 0); + GetAddrOfFunction(MD, 0); } for (CXXRecordDecl::field_iterator Field = ClassDecl->field_begin(), @@ -761,7 +761,7 @@ void CodeGenModule::DeferredCopyAssignmentToEmit(GlobalDecl CopyAssignDecl) { if (!FieldClassDecl->hasTrivialCopyAssignment() && !FieldClassDecl->hasUserDeclaredCopyAssignment() && FieldClassDecl->hasConstCopyAssignment(getContext(), MD)) - GetAddrOfFunction(GlobalDecl(MD), 0); + GetAddrOfFunction(MD, 0); } } DeferredDeclsToEmit.push_back(CopyAssignDecl); @@ -919,7 +919,7 @@ void CodeGenModule::EmitTentativeDefinition(const VarDecl *D) { // later. const char *MangledName = getMangledName(D); if (GlobalDeclMap.count(MangledName) == 0) { - DeferredDecls[MangledName] = GlobalDecl(D); + DeferredDecls[MangledName] = D; return; } } @@ -1640,10 +1640,11 @@ void CodeGenModule::EmitTopLevelDecl(Decl *D) { if (cast(D)->getDescribedFunctionTemplate()) return; - // Fall through - + EmitGlobal(cast(D)); + break; + case Decl::Var: - EmitGlobal(GlobalDecl(cast(D))); + EmitGlobal(cast(D)); break; // C++ Decls