OSDN Git Service

Fix LLVM 3.0 build issue.
authorNicolas Capens <capn@google.com>
Mon, 28 Jan 2019 16:36:01 +0000 (11:36 -0500)
committerNicolas Capens <nicolascapens@google.com>
Mon, 28 Jan 2019 16:54:33 +0000 (16:54 +0000)
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>
src/Reactor/LLVMReactor.cpp

index 344fe52..6c8d9c6 100644 (file)
@@ -906,12 +906,14 @@ namespace rr
 
                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 @@ namespace rr
 
                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);
                }