aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGDecl.cpp
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2010-05-26 21:45:50 +0000
committerFariborz Jahanian <fjahanian@apple.com>2010-05-26 21:45:50 +0000
commit4c464b9702af8ec5e76d5eb184e76df1d40c23ec (patch)
treeb7f8a1d2f3432922eee057be149b02d36d6a1d46 /lib/CodeGen/CGDecl.cpp
parentf0af777aff72b58333edcf258e30998e865bdef3 (diff)
Patch to fix a irgen crash accessing an initialized local static
variable in a local function. Fixes pr7101. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104743 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGDecl.cpp')
-rw-r--r--lib/CodeGen/CGDecl.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/CodeGen/CGDecl.cpp b/lib/CodeGen/CGDecl.cpp
index 8115e384db..07edca0f5f 100644
--- a/lib/CodeGen/CGDecl.cpp
+++ b/lib/CodeGen/CGDecl.cpp
@@ -239,8 +239,6 @@ void CodeGenFunction::EmitStaticBlockVarDecl(const VarDecl &D,
// Store into LocalDeclMap before generating initializer to handle
// circular references.
DMEntry = GV;
- if (getContext().getLangOptions().CPlusPlus)
- CGM.setStaticLocalDeclAddress(&D, GV);
// We can't have a VLA here, but we can have a pointer to a VLA,
// even though that doesn't really make any sense.
@@ -269,6 +267,9 @@ void CodeGenFunction::EmitStaticBlockVarDecl(const VarDecl &D,
if (D.hasAttr<UsedAttr>())
CGM.AddUsedGlobal(GV);
+ if (getContext().getLangOptions().CPlusPlus)
+ CGM.setStaticLocalDeclAddress(&D, GV);
+
// We may have to cast the constant because of the initializer
// mismatch above.
//