aboutsummaryrefslogtreecommitdiff
path: root/CodeGen/CGExpr.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-12-02 07:09:19 +0000
committerChris Lattner <sabre@nondot.org>2007-12-02 07:09:19 +0000
commit9cd4fe4af6d3e8b6dcfce9c2cdefcaafca7eed7c (patch)
tree951b238ba836eba03ff31ab6a77b8de7e0f9de57 /CodeGen/CGExpr.cpp
parent5a2fa14860813a8b93f68a84063dd20c690f045a (diff)
Handle global variable definitions which change the type of a definition, such as:
extern int x[]; void foo() { x[0] = 1; } int x[10]; void bar() { x[0] = 1; } git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44509 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'CodeGen/CGExpr.cpp')
-rw-r--r--CodeGen/CGExpr.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/CodeGen/CGExpr.cpp b/CodeGen/CGExpr.cpp
index 93f3d71eaf..e7bd712f31 100644
--- a/CodeGen/CGExpr.cpp
+++ b/CodeGen/CGExpr.cpp
@@ -268,8 +268,10 @@ LValue CodeGenFunction::EmitDeclRefLValue(const DeclRefExpr *E) {
llvm::Value *V = LocalDeclMap[D];
assert(V && "BlockVarDecl not entered in LocalDeclMap?");
return LValue::MakeAddr(V);
- } else if (isa<FunctionDecl>(D) || isa<FileVarDecl>(D)) {
- return LValue::MakeAddr(CGM.GetAddrOfGlobalDecl(D));
+ } else if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) {
+ return LValue::MakeAddr(CGM.GetAddrOfFunctionDecl(FD, false));
+ } else if (const FileVarDecl *FVD = dyn_cast<FileVarDecl>(D)) {
+ return LValue::MakeAddr(CGM.GetAddrOfFileVarDecl(FVD, false));
}
assert(0 && "Unimp declref");
//an invalid LValue, but the assert will