Fix LLVM 3.0 build issue. LLVM 3.0's raw_fd_ostream doesn't take an std::string as file name. Bug swiftshader:123 Bug b/123193054 Change-Id: I994f6fe5ce98c573d4be48737934b7c6c0127434 Reviewed-on: https://swiftshader-review.googlesource.com/c/24088 Tested-by: Nicolas Capens <nicolascapens@google.com> Reviewed-by: Alexis Hétu <sugoi@google.com>
diff --git a/src/Reactor/LLVMReactor.cpp b/src/Reactor/LLVMReactor.cpp index 344fe52..6c8d9c6 100644 --- a/src/Reactor/LLVMReactor.cpp +++ b/src/Reactor/LLVMReactor.cpp
@@ -906,12 +906,14 @@ if(false) { -#if REACTOR_LLVM_VERSION < 7 - std::string error; -#else - std::error_code error; -#endif - llvm::raw_fd_ostream file(std::string(name) + "-llvm-dump-unopt.txt", error); + #if REACTOR_LLVM_VERSION < 7 + std::string error; + llvm::raw_fd_ostream file((std::string(name) + "-llvm-dump-unopt.txt").c_str(), error); + #else + std::error_code error; + llvm::raw_fd_ostream file(std::string(name) + "-llvm-dump-unopt.txt", error); + #endif + ::module->print(file, 0); } @@ -922,12 +924,14 @@ if(false) { -#if REACTOR_LLVM_VERSION < 7 - std::string error; -#else - std::error_code error; -#endif - llvm::raw_fd_ostream file(std::string(name) + "-llvm-dump-opt.txt", error); + #if REACTOR_LLVM_VERSION < 7 + std::string error; + llvm::raw_fd_ostream file((std::string(name) + "-llvm-dump-opt.txt").c_str(), error); + #else + std::error_code error; + llvm::raw_fd_ostream file(std::string(name) + "-llvm-dump-opt.txt", error); + #endif + ::module->print(file, 0); }