diff options
author | Reid Kleckner <reid@kleckner.net> | 2014-10-08 01:07:54 +0000 |
---|---|---|
committer | Reid Kleckner <reid@kleckner.net> | 2014-10-08 01:07:54 +0000 |
commit | 453e0564673e85dc9b98e60e0e54f2e65d42d81b (patch) | |
tree | 4e5f1f501f3249a9288869cd76d5139a0f0ce28e /clang/lib/CodeGen/CodeGenFunction.h | |
parent | 1256198bbcccc66632810d0d3df748af38351b0f (diff) | |
download | llvm-453e0564673e85dc9b98e60e0e54f2e65d42d81b.zip llvm-453e0564673e85dc9b98e60e0e54f2e65d42d81b.tar.gz llvm-453e0564673e85dc9b98e60e0e54f2e65d42d81b.tar.bz2 |
Fix IRGen for referencing a static local before emitting its decl
Summary:
Previously CodeGen assumed that static locals were emitted before they
could be accessed, which is true for automatic storage duration locals.
However, it is possible to have CodeGen emit a nested function that uses
a static local before emitting the function that defines the static
local, breaking that assumption.
Fix it by creating the static local upon access and ensuring that the
deferred function body gets emitted. We may not be able to emit the
initializer properly from outside the function body, so don't try.
Fixes PR18020. See also previous attempts to fix static locals in
PR6769 and PR7101.
Reviewers: rsmith
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D4787
llvm-svn: 219265
Diffstat (limited to 'clang/lib/CodeGen/CodeGenFunction.h')
-rw-r--r-- | clang/lib/CodeGen/CodeGenFunction.h | 5 |
1 files changed, 0 insertions, 5 deletions
diff --git a/clang/lib/CodeGen/CodeGenFunction.h b/clang/lib/CodeGen/CodeGenFunction.h index 8f9d930..ff905e4 100644 --- a/clang/lib/CodeGen/CodeGenFunction.h +++ b/clang/lib/CodeGen/CodeGenFunction.h @@ -2495,11 +2495,6 @@ public: /// EmitLoadOfComplex - Load a complex number from the specified l-value. ComplexPairTy EmitLoadOfComplex(LValue src, SourceLocation loc); - /// CreateStaticVarDecl - Create a zero-initialized LLVM global for - /// a static local variable. - llvm::Constant *CreateStaticVarDecl(const VarDecl &D, - llvm::GlobalValue::LinkageTypes Linkage); - /// AddInitializerToStaticVarDecl - Add the initializer for 'D' to the /// global variable that has already been created for it. If the initializer /// has a different type than GV does, this may free GV and return a different |