瀏覽代碼

Don't require null terminator when create MemBuffer for module data. (#274)

Xiang Li 8 年之前
父節點
當前提交
4ddd43fd66
共有 2 個文件被更改,包括 30 次插入4 次删除
  1. 2 1
      tools/clang/tools/dxcompiler/dxcassembler.cpp
  2. 28 3
      utils/hct/hcttestcmds.cmd

+ 2 - 1
tools/clang/tools/dxcompiler/dxcassembler.cpp

@@ -74,8 +74,9 @@ HRESULT STDMETHODCALLTYPE DxcAssembler::AssembleToContainer(
     }
     }
 
 
     StringRef InputData((char *)pBytes, bytesLen);
     StringRef InputData((char *)pBytes, bytesLen);
+    const bool RequiresNullTerminator = false;
     std::unique_ptr<MemoryBuffer> memBuf =
     std::unique_ptr<MemoryBuffer> memBuf =
-        MemoryBuffer::getMemBuffer(InputData);
+        MemoryBuffer::getMemBuffer(InputData, "", RequiresNullTerminator);
 
 
     // Parse IR
     // Parse IR
     LLVMContext Context;
     LLVMContext Context;

+ 28 - 3
utils/hct/hcttestcmds.cmd

@@ -371,6 +371,13 @@ if %errorlevel% neq 0 (
   exit /b 1
   exit /b 1
 )
 )
 
 
+dxc.exe -dumpbin smoke.cso > smoke.ll
+if %errorlevel% neq 0 (
+  echo Failed to dumpbin from blob.
+  call :cleanup 2>nul
+  exit /b 1
+)
+
 echo Smoke test for dxa command line program ...
 echo Smoke test for dxa command line program ...
 dxa.exe smoke.cso -listfiles 1> nul
 dxa.exe smoke.cso -listfiles 1> nul
 if %errorlevel% neq 0 (
 if %errorlevel% neq 0 (
@@ -407,9 +414,23 @@ if %errorlevel% neq 0 (
   exit /b 1
   exit /b 1
 )
 )
 
 
-dxa.exe smoke.cso -extractpart module -o smoke.cso.plain.ll 1>nul
+dxa.exe smoke.cso -extractpart module -o smoke.cso.plain.bc 1>nul
+if %errorlevel% neq 0 (
+  echo Failed to extract plain module via dxa.exe smoke.cso -extractpart module -o smoke.cso.plain.bc
+  call :cleanup 2>nul
+  exit /b 1
+)
+
+dxa.exe smoke.cso.plain.bc -o smoke.rebuilt-container.cso 1>nul
+if %errorlevel% neq 0 (
+  echo Failed to rebuild container from plain module via dxa.exe smoke.cso.plain.bc -o smoke.rebuilt-container.cso
+  call :cleanup 2>nul
+  exit /b 1
+)
+
+dxa.exe smoke.ll -o smoke.rebuilt-container2.cso 1>nul
 if %errorlevel% neq 0 (
 if %errorlevel% neq 0 (
-  echo Failed to extract plain module via dxa.exe smoke.cso -extractpart module -o smoke.cso.plain.ll
+  echo Failed to rebuild container from plain module via dxa.exe smoke.ll -o smoke.rebuilt-container2.cso
   call :cleanup 2>nul
   call :cleanup 2>nul
   exit /b 1
   exit /b 1
 )
 )
@@ -436,8 +457,12 @@ del %CD%\noprivdebugroot.cso
 del %CD%\norootsignature.cso
 del %CD%\norootsignature.cso
 del %CD%\NonUniformNoRootSig.cso
 del %CD%\NonUniformNoRootSig.cso
 del %CD%\TextVS.cso
 del %CD%\TextVS.cso
-del %CD%\smoke.cso.plain.ll
+del %CD%\smoke.ll
 del %CD%\smoke.cso.ll
 del %CD%\smoke.cso.ll
+del %CD%\smoke.cso.plain.bc
+del %CD%\smoke.rebuilt-container.cso
+del %CD%\smoke.rebuilt-container2.cso
+
 
 
 exit /b 0
 exit /b 0