1 #include "llvm/Config/llvm-config.h"
2 #include "llvm/Support/Locale.h"
3 #include "llvm/Support/Unicode.h"
9 int columnWidth(StringRef Text) {
13 return llvm::sys::unicode::columnWidthUTF8(Text);
17 bool isPrint(int UCS) {
19 // Restrict characters that we'll try to print to the lower part of ASCII
20 // except for the control characters (0x20 - 0x7E). In general one can not
21 // reliably output code points U+0080 and higher using narrow character C/C++
22 // output functions in Windows, because the meaning of the upper 128 codes is
23 // determined by the active code page in the console.
24 return ' ' <= UCS && UCS <= '~';
26 return llvm::sys::unicode::isPrintable(UCS);