From 248a753f6b670692523c99afaeb8fe98f7ae3ca7 Mon Sep 17 00:00:00 2001 From: Steve Naroff Date: Tue, 15 Apr 2008 22:42:06 +0000 Subject: Remove FileVarDecl and BlockVarDecl. They are replaced by VarDecl::isBlockVarDecl() and VarDecl::isFileVarDecl(). This is a fairly mechanical/large change. As a result, I avoided making any changes/simplifications that weren't directly related. I did break two Analysis tests. I also have a couple FIXME's in UninitializedValues.cpp. Ted, can you take a look? If the bug isn't obvious, I am happy to dig in and fix it (since I broke it). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49748 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CGExpr.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'lib/CodeGen/CGExpr.cpp') diff --git a/lib/CodeGen/CGExpr.cpp b/lib/CodeGen/CGExpr.cpp index 8175730171..5714f3cde9 100644 --- a/lib/CodeGen/CGExpr.cpp +++ b/lib/CodeGen/CGExpr.cpp @@ -338,20 +338,20 @@ void CodeGenFunction::EmitStoreThroughOCUComponentLValue(RValue Src, LValue Dst, LValue CodeGenFunction::EmitDeclRefLValue(const DeclRefExpr *E) { - const ValueDecl *D = E->getDecl(); - if (isa(D) || isa(D)) { - const VarDecl *VD = cast(D); + const VarDecl *VD = dyn_cast(E->getDecl()); + + if (VD && (VD->isBlockVarDecl() || isa(VD))) { if (VD->getStorageClass() == VarDecl::Extern) return LValue::MakeAddr(CGM.GetAddrOfGlobalVar(VD, false)); else { - llvm::Value *V = LocalDeclMap[D]; + llvm::Value *V = LocalDeclMap[VD]; assert(V && "BlockVarDecl not entered in LocalDeclMap?"); return LValue::MakeAddr(V); } - } else if (const FunctionDecl *FD = dyn_cast(D)) { + } else if (VD && VD->isFileVarDecl()) { + return LValue::MakeAddr(CGM.GetAddrOfGlobalVar(VD, false)); + } else if (const FunctionDecl *FD = dyn_cast(E->getDecl())) { return LValue::MakeAddr(CGM.GetAddrOfFunctionDecl(FD, false)); - } else if (const FileVarDecl *FVD = dyn_cast(D)) { - return LValue::MakeAddr(CGM.GetAddrOfGlobalVar(FVD, false)); } assert(0 && "Unimp declref"); //an invalid LValue, but the assert will -- cgit v1.2.3-70-g09d2