diff options
author | Chandler Carruth <chandlerc@gmail.com> | 2012-03-30 19:44:53 +0000 |
---|---|---|
committer | Chandler Carruth <chandlerc@gmail.com> | 2012-03-30 19:44:53 +0000 |
commit | 0f30a12ce7b3d4d86c9ca9072f587da77c8eef34 (patch) | |
tree | 7065652fa4ad45d8dce3c6cb377f1c8c0f904cab /lib/CodeGen/CodeGenFunction.h | |
parent | 40afb7d4f3840e5b9dcdf77086d9e4843fd5463a (diff) |
Revert r153723, and its follow-ups r153728 and r153733.
These patches cause us to miscompile and/or reject code with static
function-local variables in an extern-C context. Previously, we were
papering over this as long as the variables are within the same
translation unit, and had not seen any failures in the wild. We still
need a proper fix, which involves mangling static locals inside of an
extern-C block (as GCC already does), but this patch causes pretty
widespread regressions. Firefox, and many other applications no longer
build.
Lots of test cases have been posted to the list in response to this
commit, so there should be no problem reproducing the issues.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153768 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CodeGenFunction.h')
-rw-r--r-- | lib/CodeGen/CodeGenFunction.h | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/lib/CodeGen/CodeGenFunction.h b/lib/CodeGen/CodeGenFunction.h index 02346cf026..85cbd143d8 100644 --- a/lib/CodeGen/CodeGenFunction.h +++ b/lib/CodeGen/CodeGenFunction.h @@ -2392,17 +2392,17 @@ public: /// CreateStaticVarDecl - Create a zero-initialized LLVM global for /// a static local variable. - llvm::Constant *CreateStaticVarDecl(const VarDecl &D, - const char *Separator, - llvm::GlobalValue::LinkageTypes Linkage); + llvm::GlobalVariable *CreateStaticVarDecl(const VarDecl &D, + const char *Separator, + 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 - /// force the underlying variable to change. Otherwise it just - /// returns it. - llvm::Constant * - AddInitializerToStaticVarDecl(const VarDecl &D, llvm::Constant *GV); + /// 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 + /// one. Otherwise it just returns GV. + llvm::GlobalVariable * + AddInitializerToStaticVarDecl(const VarDecl &D, + llvm::GlobalVariable *GV); /// EmitCXXGlobalVarDeclInit - Create the initializer for a C++ @@ -2420,7 +2420,7 @@ public: /// possible to prove that an initialization will be done exactly /// once, e.g. with a static local variable or a static data member /// of a class template. - void EmitCXXGuardedInit(const VarDecl &D, llvm::Constant *addr, + void EmitCXXGuardedInit(const VarDecl &D, llvm::GlobalVariable *DeclPtr, bool PerformInit); /// GenerateCXXGlobalInitFunc - Generates code for initializing global |