aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGExpr.cpp
diff options
context:
space:
mode:
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.