From 03f83e58f75d2f762fa15ec2cf3392e392b6cbb9 Mon Sep 17 00:00:00 2001 From: Anders Carlsson Date: Sat, 7 Nov 2009 22:43:34 +0000 Subject: [PATCH] We only need to call SetObjCNonGC for local variables. No functionality change. llvm-svn: 86410 --- clang/lib/CodeGen/CGExpr.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp index 62e16e8ba234..fbb593983deb 100644 --- a/clang/lib/CodeGen/CGExpr.cpp +++ b/clang/lib/CodeGen/CGExpr.cpp @@ -819,14 +819,14 @@ LValue CodeGenFunction::EmitDeclRefLValue(const DeclRefExpr *E) { if (VD && (VD->isBlockVarDecl() || isa(VD) || isa(VD))) { LValue LV; - bool NonGCable = VD->hasLocalStorage() && - !VD->hasAttr(); if (VD->hasExternalStorage()) { llvm::Value *V = CGM.GetAddrOfGlobalVar(VD); if (VD->getType()->isReferenceType()) V = Builder.CreateLoad(V, "tmp"); LV = LValue::MakeAddr(V, MakeQualifiers(E->getType())); } else { + bool NonGCable = VD->hasLocalStorage() && !VD->hasAttr(); + llvm::Value *V = LocalDeclMap[VD]; assert(V && "DeclRefExpr not entered in LocalDeclMap?"); @@ -844,8 +844,8 @@ LValue CodeGenFunction::EmitDeclRefLValue(const DeclRefExpr *E) { if (VD->getType()->isReferenceType()) V = Builder.CreateLoad(V, "tmp"); LV = LValue::MakeAddr(V, Quals); + LValue::SetObjCNonGC(LV, NonGCable); } - LValue::SetObjCNonGC(LV, NonGCable); setObjCGCLValueClass(getContext(), E, LV); return LV; }