From 4111024be81e7c0525e42dadcc126d27e5bf2425 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Tue, 17 Jun 2008 18:05:57 +0000 Subject: Change self/_cmd to be instances of ImplicitParamDecl instead of ParmVarDecl. Patch by David Chisnall! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52422 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CGExpr.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'lib/CodeGen/CGExpr.cpp') diff --git a/lib/CodeGen/CGExpr.cpp b/lib/CodeGen/CGExpr.cpp index 5856531f43..9420f95ad1 100644 --- a/lib/CodeGen/CGExpr.cpp +++ b/lib/CodeGen/CGExpr.cpp @@ -370,7 +370,8 @@ void CodeGenFunction::EmitStoreThroughExtVectorComponentLValue(RValue Src, LValue CodeGenFunction::EmitDeclRefLValue(const DeclRefExpr *E) { const VarDecl *VD = dyn_cast(E->getDecl()); - if (VD && (VD->isBlockVarDecl() || isa(VD))) { + if (VD && (VD->isBlockVarDecl() || isa(VD) || + isa(VD))) { if (VD->getStorageClass() == VarDecl::Extern) return LValue::MakeAddr(CGM.GetAddrOfGlobalVar(VD, false), E->getType().getCVRQualifiers()); @@ -386,6 +387,12 @@ LValue CodeGenFunction::EmitDeclRefLValue(const DeclRefExpr *E) { return LValue::MakeAddr(CGM.GetAddrOfFunctionDecl(FD, false), E->getType().getCVRQualifiers()); } + else if (const ImplicitParamDecl *IPD = + dyn_cast(E->getDecl())) { + llvm::Value *V = LocalDeclMap[IPD]; + assert(V && "BlockVarDecl not entered in LocalDeclMap?"); + return LValue::MakeAddr(V, E->getType().getCVRQualifiers()); + } assert(0 && "Unimp declref"); //an invalid LValue, but the assert will //ensure that this point is never reached. -- cgit v1.2.3