diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2015-12-01 01:10:48 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2015-12-01 01:10:48 +0000 |
commit | 5a99c49d2e232c3a5076b2f99549ccd595598a4c (patch) | |
tree | 7961878cd4a73b96ba7506a7f9cafd199dce4b84 /clang/lib/CodeGen/CodeGenModule.h | |
parent | 21ed3b13bd1a9c9d3cca49553cdd7274c4de5993 (diff) | |
download | bcm5719-llvm-5a99c49d2e232c3a5076b2f99549ccd595598a4c.tar.gz bcm5719-llvm-5a99c49d2e232c3a5076b2f99549ccd595598a4c.zip |
Fix use-after-free when a C++ thread_local variable gets replaced (because its
type changes when the initializer is attached). Don't hold onto the
GlobalVariable*; recompute it from the VarDecl* instead.
llvm-svn: 254359
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.h')
-rw-r--r-- | clang/lib/CodeGen/CodeGenModule.h | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.h b/clang/lib/CodeGen/CodeGenModule.h index 9133ecfb02b..d1a3efbeaeb 100644 --- a/clang/lib/CodeGen/CodeGenModule.h +++ b/clang/lib/CodeGen/CodeGenModule.h @@ -378,13 +378,12 @@ private: StaticExternCMap StaticExternCValues; /// \brief thread_local variables defined or used in this TU. - std::vector<std::pair<const VarDecl *, llvm::GlobalVariable *> > - CXXThreadLocals; + std::vector<const VarDecl *> CXXThreadLocals; /// \brief thread_local variables with initializers that need to run /// before any thread_local variable in this TU is odr-used. std::vector<llvm::Function *> CXXThreadLocalInits; - std::vector<llvm::GlobalVariable *> CXXThreadLocalInitVars; + std::vector<const VarDecl *> CXXThreadLocalInitVars; /// Global variables with initializers that need to run before main. std::vector<llvm::Function *> CXXGlobalInits; |