diff options
Diffstat (limited to 'clang/lib/CodeGen/CGObjC.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGObjC.cpp | 40 |
1 files changed, 22 insertions, 18 deletions
diff --git a/clang/lib/CodeGen/CGObjC.cpp b/clang/lib/CodeGen/CGObjC.cpp index bfb31337b2c..d497179a533 100644 --- a/clang/lib/CodeGen/CGObjC.cpp +++ b/clang/lib/CodeGen/CGObjC.cpp @@ -1125,8 +1125,9 @@ static void emitStructSetterCall(CodeGenFunction &CGF, ObjCMethodDecl *OMD, // The second argument is the address of the parameter variable. ParmVarDecl *argVar = *OMD->param_begin(); - DeclRefExpr argRef(argVar, false, argVar->getType().getNonReferenceType(), - VK_LValue, SourceLocation()); + DeclRefExpr argRef(CGF.getContext(), argVar, false, + argVar->getType().getNonReferenceType(), VK_LValue, + SourceLocation()); llvm::Value *argAddr = CGF.EmitLValue(&argRef).getPointer(); argAddr = CGF.Builder.CreateBitCast(argAddr, CGF.Int8PtrTy); args.add(RValue::get(argAddr), CGF.getContext().VoidPtrTy); @@ -1170,8 +1171,9 @@ static void emitCPPObjectAtomicSetterCall(CodeGenFunction &CGF, // The second argument is the address of the parameter variable. ParmVarDecl *argVar = *OMD->param_begin(); - DeclRefExpr argRef(argVar, false, argVar->getType().getNonReferenceType(), - VK_LValue, SourceLocation()); + DeclRefExpr argRef(CGF.getContext(), argVar, false, + argVar->getType().getNonReferenceType(), VK_LValue, + SourceLocation()); llvm::Value *argAddr = CGF.EmitLValue(&argRef).getPointer(); argAddr = CGF.Builder.CreateBitCast(argAddr, CGF.Int8PtrTy); args.add(RValue::get(argAddr), CGF.getContext().VoidPtrTy); @@ -1343,7 +1345,7 @@ CodeGenFunction::generateObjCSetterBody(const ObjCImplementationDecl *classImpl, // Otherwise, fake up some ASTs and emit a normal assignment. ValueDecl *selfDecl = setterMethod->getSelfDecl(); - DeclRefExpr self(selfDecl, false, selfDecl->getType(), + DeclRefExpr self(getContext(), selfDecl, false, selfDecl->getType(), VK_LValue, SourceLocation()); ImplicitCastExpr selfLoad(ImplicitCastExpr::OnStack, selfDecl->getType(), CK_LValueToRValue, &self, @@ -1354,7 +1356,8 @@ CodeGenFunction::generateObjCSetterBody(const ObjCImplementationDecl *classImpl, ParmVarDecl *argDecl = *setterMethod->param_begin(); QualType argType = argDecl->getType().getNonReferenceType(); - DeclRefExpr arg(argDecl, false, argType, VK_LValue, SourceLocation()); + DeclRefExpr arg(getContext(), argDecl, false, argType, VK_LValue, + SourceLocation()); ImplicitCastExpr argLoad(ImplicitCastExpr::OnStack, argType.getUnqualifiedType(), CK_LValueToRValue, &arg, VK_RValue); @@ -1516,7 +1519,8 @@ void CodeGenFunction::GenerateObjCCtorDtorMethod(ObjCImplementationDecl *IMP, llvm::Value *CodeGenFunction::LoadObjCSelf() { VarDecl *Self = cast<ObjCMethodDecl>(CurFuncDecl)->getSelfDecl(); - DeclRefExpr DRE(Self, /*is enclosing local*/ (CurFuncDecl != CurCodeDecl), + DeclRefExpr DRE(getContext(), Self, + /*is enclosing local*/ (CurFuncDecl != CurCodeDecl), Self->getType(), VK_LValue, SourceLocation()); return EmitLoadOfScalar(EmitDeclRefLValue(&DRE), SourceLocation()); } @@ -1702,9 +1706,9 @@ void CodeGenFunction::EmitObjCForCollectionStmt(const ObjCForCollectionStmt &S){ // Initialize the variable, in case it's a __block variable or something. EmitAutoVarInit(variable); - const VarDecl* D = cast<VarDecl>(SD->getSingleDecl()); - DeclRefExpr tempDRE(const_cast<VarDecl*>(D), false, D->getType(), - VK_LValue, SourceLocation()); + const VarDecl *D = cast<VarDecl>(SD->getSingleDecl()); + DeclRefExpr tempDRE(getContext(), const_cast<VarDecl *>(D), false, + D->getType(), VK_LValue, SourceLocation()); elementLValue = EmitLValue(&tempDRE); elementType = D->getType(); elementIsVariable = true; @@ -3374,13 +3378,13 @@ CodeGenFunction::GenerateObjCAtomicSetterCopyHelperFunction( StartFunction(FD, ReturnTy, Fn, FI, args); - DeclRefExpr DstExpr(&DstDecl, false, DestTy, - VK_RValue, SourceLocation()); + DeclRefExpr DstExpr(getContext(), &DstDecl, false, DestTy, VK_RValue, + SourceLocation()); UnaryOperator DST(&DstExpr, UO_Deref, DestTy->getPointeeType(), VK_LValue, OK_Ordinary, SourceLocation(), false); - DeclRefExpr SrcExpr(&SrcDecl, false, SrcTy, - VK_RValue, SourceLocation()); + DeclRefExpr SrcExpr(getContext(), &SrcDecl, false, SrcTy, VK_RValue, + SourceLocation()); UnaryOperator SRC(&SrcExpr, UO_Deref, SrcTy->getPointeeType(), VK_LValue, OK_Ordinary, SourceLocation(), false); @@ -3457,8 +3461,8 @@ CodeGenFunction::GenerateObjCAtomicGetterCopyHelperFunction( StartFunction(FD, ReturnTy, Fn, FI, args); - DeclRefExpr SrcExpr(&SrcDecl, false, SrcTy, - VK_RValue, SourceLocation()); + DeclRefExpr SrcExpr(getContext(), &SrcDecl, false, SrcTy, VK_RValue, + SourceLocation()); UnaryOperator SRC(&SrcExpr, UO_Deref, SrcTy->getPointeeType(), VK_LValue, OK_Ordinary, SourceLocation(), false); @@ -3483,8 +3487,8 @@ CodeGenFunction::GenerateObjCAtomicGetterCopyHelperFunction( CXXConstExpr->getConstructionKind(), SourceRange()); - DeclRefExpr DstExpr(&DstDecl, false, DestTy, - VK_RValue, SourceLocation()); + DeclRefExpr DstExpr(getContext(), &DstDecl, false, DestTy, VK_RValue, + SourceLocation()); RValue DV = EmitAnyExpr(&DstExpr); CharUnits Alignment |