summaryrefslogtreecommitdiffstats
path: root/clang/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
commit5f81b9f3f610400f09becc5d1cf005ed45c9c984 (patch)
tree121b05e8141489e12da3026079bbbf84d49069b8 /clang/lib/CodeGen/CGDecl.cpp
parent34ddec630c9d069f641c99812c4b68eb3f2ff565 (diff)
downloadbcm5719-llvm-5f81b9f3f610400f09becc5d1cf005ed45c9c984.tar.gz
bcm5719-llvm-5f81b9f3f610400f09becc5d1cf005ed45c9c984.zip
Patch to fix a irgen crash accessing an initialized local static
variable in a local function. Fixes pr7101. llvm-svn: 104743
Diffstat (limited to 'clang/lib/CodeGen/CGDecl.cpp')
-rw-r--r--clang/lib/CodeGen/CGDecl.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CGDecl.cpp b/clang/lib/CodeGen/CGDecl.cpp
index 8115e384db8..07edca0f5fe 100644
--- a/clang/lib/CodeGen/CGDecl.cpp
+++ b/clang/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.
//
OpenPOWER on IntegriCloud