aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGExpr.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-06-17 18:05:57 +0000
committerChris Lattner <sabre@nondot.org>2008-06-17 18:05:57 +0000
commit4111024be81e7c0525e42dadcc126d27e5bf2425 (patch)
treee29124f0d892b86e0c4a155f0366c82117dbedaa /lib/CodeGen/CGExpr.cpp
parente5d12e8003acab516a58a01f71aae012458a4572 (diff)
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
Diffstat (limited to 'lib/CodeGen/CGExpr.cpp')
-rw-r--r--lib/CodeGen/CGExpr.cpp9
1 files changed, 8 insertions, 1 deletions
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<VarDecl>(E->getDecl());
- if (VD && (VD->isBlockVarDecl() || isa<ParmVarDecl>(VD))) {
+ if (VD && (VD->isBlockVarDecl() || isa<ParmVarDecl>(VD) ||
+ isa<ImplicitParamDecl>(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<ImplicitParamDecl>(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.