Browse Source

Fix per-thread file system in opt.exe for testing

Tex Riddell 7 years ago
parent
commit
c25719477e
1 changed files with 5 additions and 0 deletions
  1. 5 0
      tools/opt/opt.cpp

+ 5 - 0
tools/opt/opt.cpp

@@ -301,6 +301,11 @@ void initializePollyPasses(llvm::PassRegistry &Registry);
 // HLSL Change: changed calling convention to __cdecl
 int __cdecl main(int argc, char **argv) {
   // HLSL Change Starts
+  if (llvm::sys::fs::SetupPerThreadFileSystem())
+    return 1;
+  llvm::sys::fs::AutoCleanupPerThreadFileSystem auto_cleanup_fs;
+  if (FAILED(DxcInitThreadMalloc())) return 1;
+  DxcSetThreadMallocOrDefault(nullptr);
   llvm::sys::fs::MSFileSystem* msfPtr;
   if (FAILED(CreateMSFileSystemForDisk(&msfPtr))) return 1;
   std::unique_ptr<llvm::sys::fs::MSFileSystem> msf(msfPtr);