[PATCH] D51611: Set console mode when -fansi-escape-codes is enabled

Dávid Bolvanský via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 4 12:24:11 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL341396: Set console mode when -fansi-escape-codes is enabled  (authored by xbolva00, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D51611?vs=163879&id=163885#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D51611

Files:
  llvm/trunk/lib/Support/Windows/Process.inc


Index: llvm/trunk/lib/Support/Windows/Process.inc
===================================================================
--- llvm/trunk/lib/Support/Windows/Process.inc
+++ llvm/trunk/lib/Support/Windows/Process.inc
@@ -328,6 +328,15 @@
 
 static bool UseANSI = false;
 void Process::UseANSIEscapeCodes(bool enable) {
+#if defined(ENABLE_VIRTUAL_TERMINAL_PROCESSING)
+  if (enable) {
+    HANDLE Console = GetStdHandle(STD_OUTPUT_HANDLE);
+    DWORD Mode;
+    GetConsoleMode(Console, &Mode);
+    Mode |= ENABLE_VIRTUAL_TERMINAL_PROCESSING;
+    SetConsoleMode(Console, Mode);
+  }
+#endif
   UseANSI = enable;
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D51611.163885.patch
Type: text/x-patch
Size: 613 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180904/6894a9bf/attachment.bin>


More information about the llvm-commits mailing list