2
0
Эх сурвалжийг харах

Unbuffer raw_string_stream (#4872)

Double buffering a string stream writing in memory is silly. Upstream
LLVM made this change a few years ago based on analysis that most string
implementations are sane:

https://github.com/llvm/llvm-project/commit/65b1361
Chris B 2 жил өмнө
parent
commit
35736a719e

+ 1 - 1
include/llvm/Support/raw_ostream.h

@@ -516,7 +516,7 @@ class raw_string_ostream : public raw_ostream {
   /// currently in the buffer.
   uint64_t current_pos() const override { return OS.size(); }
 public:
-  explicit raw_string_ostream(std::string &O) : OS(O) {}
+  explicit raw_string_ostream(std::string &O) : OS(O) { SetUnbuffered(); }
   ~raw_string_ostream() override;
 
   /// Flushes the stream contents to the target string and returns  the string's

+ 0 - 0
tools/clang/test/DXC/Inputs/empty.h


+ 4 - 0
tools/clang/test/DXC/show-includes.hlsl

@@ -0,0 +1,4 @@
+// RUN: %dxc -E main -T lib_6_3 %s -H | FileCheck %s
+#include "Inputs/empty.h"
+
+// CHECK: ; Opening file [{{.*}}/Inputs/empty.h], stack top [0]

+ 2 - 2
utils/hct/hcttestcmds.cmd

@@ -453,8 +453,8 @@ mkdir inc       2>nul
 copy "%testfiles%\include-declarations.h" inc  >nul
 call :run dxc.exe -Tps_6_0 -Vi -I inc "%testfiles%\include-main.hlsl"
 if %Failed% neq 0 goto :failed
-call :check-file log find "; Opening file ["
-call :check-file log find "inc\include-declarations.h], stack top [0]"
+call :check_file log find "; Opening file ["
+call :check_file log find "include-declarations.h], stack top [0]"
 if %Failed% neq 0 goto :failed
 
 set testname=Test Version macro