@@ -59,52 +59,52 @@ using EncodingInfo = std::pair<UnicodeEncodingForm, unsigned>;
5959// / and how long the byte order mark is if one exists.
6060static EncodingInfo getUnicodeEncoding (StringRef Input) {
6161 if (Input.empty ())
62- return std::make_pair ( UEF_Unknown, 0 ) ;
62+ return { UEF_Unknown, 0 } ;
6363
6464 switch (uint8_t (Input[0 ])) {
6565 case 0x00 :
6666 if (Input.size () >= 4 ) {
6767 if ( Input[1 ] == 0
6868 && uint8_t (Input[2 ]) == 0xFE
6969 && uint8_t (Input[3 ]) == 0xFF )
70- return std::make_pair ( UEF_UTF32_BE, 4 ) ;
70+ return { UEF_UTF32_BE, 4 } ;
7171 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 } ;
7373 }
7474
7575 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 } ;
7878 case 0xFF :
7979 if ( Input.size () >= 4
8080 && uint8_t (Input[1 ]) == 0xFE
8181 && Input[2 ] == 0
8282 && Input[3 ] == 0 )
83- return std::make_pair ( UEF_UTF32_LE, 4 ) ;
83+ return { UEF_UTF32_LE, 4 } ;
8484
8585 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 } ;
8888 case 0xFE :
8989 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 } ;
9292 case 0xEF :
9393 if ( Input.size () >= 3
9494 && uint8_t (Input[1 ]) == 0xBB
9595 && 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 } ;
9898 }
9999
100100 // It could still be utf-32 or utf-16.
101101 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 } ;
103103
104104 if (Input.size () >= 2 && Input[1 ] == 0 )
105- return std::make_pair ( UEF_UTF16_LE, 0 ) ;
105+ return { UEF_UTF16_LE, 0 } ;
106106
107- return std::make_pair ( UEF_UTF8, 0 ) ;
107+ return { UEF_UTF8, 0 } ;
108108}
109109
110110// / Pin the vtables to this file.
@@ -199,7 +199,7 @@ static UTF8Decoded decodeUTF8(StringRef Range) {
199199 // 1 byte: [0x00, 0x7f]
200200 // Bit pattern: 0xxxxxxx
201201 if (Position < End && (*Position & 0x80 ) == 0 ) {
202- return std::make_pair ( *Position, 1 ) ;
202+ return { *Position, 1 } ;
203203 }
204204 // 2 bytes: [0x80, 0x7ff]
205205 // Bit pattern: 110xxxxx 10xxxxxx
@@ -208,7 +208,7 @@ static UTF8Decoded decodeUTF8(StringRef Range) {
208208 uint32_t codepoint = ((*Position & 0x1F ) << 6 ) |
209209 (*(Position + 1 ) & 0x3F );
210210 if (codepoint >= 0x80 )
211- return std::make_pair ( codepoint, 2 ) ;
211+ return { codepoint, 2 } ;
212212 }
213213 // 3 bytes: [0x8000, 0xffff]
214214 // Bit pattern: 1110xxxx 10xxxxxx 10xxxxxx
@@ -222,7 +222,7 @@ static UTF8Decoded decodeUTF8(StringRef Range) {
222222 // they are high / low surrogate halves used by UTF-16.
223223 if (codepoint >= 0x800 &&
224224 (codepoint < 0xD800 || codepoint > 0xDFFF ))
225- return std::make_pair ( codepoint, 3 ) ;
225+ return { codepoint, 3 } ;
226226 }
227227 // 4 bytes: [0x10000, 0x10FFFF]
228228 // Bit pattern: 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
@@ -235,9 +235,9 @@ static UTF8Decoded decodeUTF8(StringRef Range) {
235235 ((*(Position + 2 ) & 0x3F ) << 6 ) |
236236 (*(Position + 3 ) & 0x3F );
237237 if (codepoint >= 0x10000 && codepoint <= 0x10FFFF )
238- return std::make_pair ( codepoint, 4 ) ;
238+ return { codepoint, 4 } ;
239239 }
240- return std::make_pair ( 0 , 0 ) ;
240+ return { 0 , 0 } ;
241241}
242242
243243namespace llvm {
0 commit comments