@@ -59,52 +59,52 @@ using EncodingInfo = std::pair<UnicodeEncodingForm, unsigned>;
59
59
// / and how long the byte order mark is if one exists.
60
60
static EncodingInfo getUnicodeEncoding (StringRef Input) {
61
61
if (Input.empty ())
62
- return std::make_pair ( UEF_Unknown, 0 ) ;
62
+ return { UEF_Unknown, 0 } ;
63
63
64
64
switch (uint8_t (Input[0 ])) {
65
65
case 0x00 :
66
66
if (Input.size () >= 4 ) {
67
67
if ( Input[1 ] == 0
68
68
&& uint8_t (Input[2 ]) == 0xFE
69
69
&& uint8_t (Input[3 ]) == 0xFF )
70
- return std::make_pair ( UEF_UTF32_BE, 4 ) ;
70
+ return { UEF_UTF32_BE, 4 } ;
71
71
if (Input[1 ] == 0 && Input[2 ] == 0 && Input[3 ] != 0 )
72
- return std::make_pair ( UEF_UTF32_BE, 0 ) ;
72
+ return { UEF_UTF32_BE, 0 } ;
73
73
}
74
74
75
75
if (Input.size () >= 2 && Input[1 ] != 0 )
76
- return std::make_pair ( UEF_UTF16_BE, 0 ) ;
77
- return std::make_pair ( UEF_Unknown, 0 ) ;
76
+ return { UEF_UTF16_BE, 0 } ;
77
+ return { UEF_Unknown, 0 } ;
78
78
case 0xFF :
79
79
if ( Input.size () >= 4
80
80
&& uint8_t (Input[1 ]) == 0xFE
81
81
&& Input[2 ] == 0
82
82
&& Input[3 ] == 0 )
83
- return std::make_pair ( UEF_UTF32_LE, 4 ) ;
83
+ return { UEF_UTF32_LE, 4 } ;
84
84
85
85
if (Input.size () >= 2 && uint8_t (Input[1 ]) == 0xFE )
86
- return std::make_pair ( UEF_UTF16_LE, 2 ) ;
87
- return std::make_pair ( UEF_Unknown, 0 ) ;
86
+ return { UEF_UTF16_LE, 2 } ;
87
+ return { UEF_Unknown, 0 } ;
88
88
case 0xFE :
89
89
if (Input.size () >= 2 && uint8_t (Input[1 ]) == 0xFF )
90
- return std::make_pair ( UEF_UTF16_BE, 2 ) ;
91
- return std::make_pair ( UEF_Unknown, 0 ) ;
90
+ return { UEF_UTF16_BE, 2 } ;
91
+ return { UEF_Unknown, 0 } ;
92
92
case 0xEF :
93
93
if ( Input.size () >= 3
94
94
&& uint8_t (Input[1 ]) == 0xBB
95
95
&& uint8_t (Input[2 ]) == 0xBF )
96
- return std::make_pair ( UEF_UTF8, 3 ) ;
97
- return std::make_pair ( UEF_Unknown, 0 ) ;
96
+ return { UEF_UTF8, 3 } ;
97
+ return { UEF_Unknown, 0 } ;
98
98
}
99
99
100
100
// It could still be utf-32 or utf-16.
101
101
if (Input.size () >= 4 && Input[1 ] == 0 && Input[2 ] == 0 && Input[3 ] == 0 )
102
- return std::make_pair ( UEF_UTF32_LE, 0 ) ;
102
+ return { UEF_UTF32_LE, 0 } ;
103
103
104
104
if (Input.size () >= 2 && Input[1 ] == 0 )
105
- return std::make_pair ( UEF_UTF16_LE, 0 ) ;
105
+ return { UEF_UTF16_LE, 0 } ;
106
106
107
- return std::make_pair ( UEF_UTF8, 0 ) ;
107
+ return { UEF_UTF8, 0 } ;
108
108
}
109
109
110
110
// / Pin the vtables to this file.
@@ -199,7 +199,7 @@ static UTF8Decoded decodeUTF8(StringRef Range) {
199
199
// 1 byte: [0x00, 0x7f]
200
200
// Bit pattern: 0xxxxxxx
201
201
if (Position < End && (*Position & 0x80 ) == 0 ) {
202
- return std::make_pair ( *Position, 1 ) ;
202
+ return { *Position, 1 } ;
203
203
}
204
204
// 2 bytes: [0x80, 0x7ff]
205
205
// Bit pattern: 110xxxxx 10xxxxxx
@@ -208,7 +208,7 @@ static UTF8Decoded decodeUTF8(StringRef Range) {
208
208
uint32_t codepoint = ((*Position & 0x1F ) << 6 ) |
209
209
(*(Position + 1 ) & 0x3F );
210
210
if (codepoint >= 0x80 )
211
- return std::make_pair ( codepoint, 2 ) ;
211
+ return { codepoint, 2 } ;
212
212
}
213
213
// 3 bytes: [0x8000, 0xffff]
214
214
// Bit pattern: 1110xxxx 10xxxxxx 10xxxxxx
@@ -222,7 +222,7 @@ static UTF8Decoded decodeUTF8(StringRef Range) {
222
222
// they are high / low surrogate halves used by UTF-16.
223
223
if (codepoint >= 0x800 &&
224
224
(codepoint < 0xD800 || codepoint > 0xDFFF ))
225
- return std::make_pair ( codepoint, 3 ) ;
225
+ return { codepoint, 3 } ;
226
226
}
227
227
// 4 bytes: [0x10000, 0x10FFFF]
228
228
// Bit pattern: 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
@@ -235,9 +235,9 @@ static UTF8Decoded decodeUTF8(StringRef Range) {
235
235
((*(Position + 2 ) & 0x3F ) << 6 ) |
236
236
(*(Position + 3 ) & 0x3F );
237
237
if (codepoint >= 0x10000 && codepoint <= 0x10FFFF )
238
- return std::make_pair ( codepoint, 4 ) ;
238
+ return { codepoint, 4 } ;
239
239
}
240
- return std::make_pair ( 0 , 0 ) ;
240
+ return { 0 , 0 } ;
241
241
}
242
242
243
243
namespace llvm {
0 commit comments