diff options
| author | 2012-03-06 17:26:37 -0800 | |
|---|---|---|
| committer | 2012-03-06 21:53:05 -0800 | |
| commit | 63deaad18853e55097761e47a9eedd12eb0c1e58 (patch) | |
| tree | 4eb14783cac63b87c7985409a8f8d70ebceaa4e5 /src/compiler_llvm/compiler_llvm.h | |
| parent | adb8c67f6d87a160d4e3a8afea7cb93f6c14568b (diff) | |
Fix memory corruption due to premature llvm_shutdown().
Under LLVM, multiple compiler-related gtests randomly crashes from time
to time, because common_test.h has code to new multiple compiler
instances. Multiple CompilerLLVM instances may cause crash if one
shuts down LLVM prematurely.
This fix uses static class member. Destructor is where we shut
down LLVM.
Change-Id: Ied371794af7ca9eb2c9fe6b278fd779a61a4a753
Diffstat (limited to 'src/compiler_llvm/compiler_llvm.h')
| -rw-r--r-- | src/compiler_llvm/compiler_llvm.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/compiler_llvm/compiler_llvm.h b/src/compiler_llvm/compiler_llvm.h index 7481c8c2e2..6332fb3886 100644 --- a/src/compiler_llvm/compiler_llvm.h +++ b/src/compiler_llvm/compiler_llvm.h @@ -107,6 +107,13 @@ class CompilerLLVM { std::string bitcode_filename_; + class LLVMInitializer { + public: + LLVMInitializer(); + ~LLVMInitializer(); + }; + static LLVMInitializer llvm_initialize_guard; + DISALLOW_COPY_AND_ASSIGN(CompilerLLVM); }; |