@@ -585,15 +585,6 @@ void Remangler::mangleBoundGenericOtherNominalType(Node *node) {
585
585
mangleAnyNominalType (node);
586
586
}
587
587
588
- template <size_t N>
589
- static bool stripPrefix (StringRef &string, const char (&data)[N]) {
590
- constexpr size_t prefixLength = N - 1 ;
591
- if (!string.startswith (StringRef (data, prefixLength)))
592
- return false ;
593
- string = string.drop_front (prefixLength);
594
- return true ;
595
- }
596
-
597
588
void Remangler::mangleBuiltinTypeName (Node *node) {
598
589
Buffer << ' B' ;
599
590
StringRef text = node->getText ();
@@ -612,17 +603,17 @@ void Remangler::mangleBuiltinTypeName(Node *node) {
612
603
Buffer << ' t' ;
613
604
} else if (text == BUILTIN_TYPE_NAME_WORD) {
614
605
Buffer << ' w' ;
615
- } else if (stripPrefix ( text, BUILTIN_TYPE_NAME_INT)) {
606
+ } else if (text. consume_front ( BUILTIN_TYPE_NAME_INT)) {
616
607
Buffer << ' i' << text << ' _' ;
617
- } else if (stripPrefix ( text, BUILTIN_TYPE_NAME_FLOAT)) {
608
+ } else if (text. consume_front ( BUILTIN_TYPE_NAME_FLOAT)) {
618
609
Buffer << ' f' << text << ' _' ;
619
- } else if (stripPrefix ( text, BUILTIN_TYPE_NAME_VEC)) {
610
+ } else if (text. consume_front ( BUILTIN_TYPE_NAME_VEC)) {
620
611
auto split = text.split (' x' );
621
612
if (split.second == " RawPointer" ) {
622
613
Buffer << ' p' ;
623
- } else if (stripPrefix ( split.second , " Float" )) {
614
+ } else if (split.second . consume_front ( " Float" )) {
624
615
Buffer << ' f' << split.second << ' _' ;
625
- } else if (stripPrefix ( split.second , " Int" )) {
616
+ } else if (split.second . consume_front ( " Int" )) {
626
617
Buffer << ' i' << split.second << ' _' ;
627
618
} else {
628
619
unreachable (" unexpected builtin vector type" );
0 commit comments