• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #include "llvm/Support/Locale.h"
2 #include "llvm/Support/Unicode.h"
3 
4 namespace llvm {
5 namespace sys {
6 namespace locale {
7 
columnWidth(StringRef Text)8 int columnWidth(StringRef Text) {
9 #if LLVM_ON_WIN32
10   return Text.size();
11 #else
12   return llvm::sys::unicode::columnWidthUTF8(Text);
13 #endif
14 }
15 
isPrint(int UCS)16 bool isPrint(int UCS) {
17 #if LLVM_ON_WIN32
18   // Restrict characters that we'll try to print to the the lower part of ASCII
19   // except for the control characters (0x20 - 0x7E). In general one can not
20   // reliably output code points U+0080 and higher using narrow character C/C++
21   // output functions in Windows, because the meaning of the upper 128 codes is
22   // determined by the active code page in the console.
23   return ' ' <= UCS && UCS <= '~';
24 #else
25   return llvm::sys::unicode::isPrintable(UCS);
26 #endif
27 }
28 
29 } // namespace locale
30 } // namespace sys
31 } // namespace llvm
32