Skip to content

Commit 788cf3d

Browse files
committed
Merge remote-tracking branch 'origin/main' into feature/regular_expression_metafunction
2 parents b99d10e + 8168a2d commit 788cf3d

File tree

8 files changed

+25
-27
lines changed

8 files changed

+25
-27
lines changed

include/cpp2util.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -762,20 +762,20 @@ constexpr auto process_type_name(std::string_view name) -> std::string_view {
762762
constexpr auto types_close_parenthesis = '>';
763763
#endif
764764
auto pos = name.find(type_prefix);
765-
if (pos != std::string_view::npos) {
765+
if (pos != name.npos) {
766766
name = name.substr(pos);
767767
name.remove_prefix(type_prefix.size());
768768
}
769769

770770
pos = name.find_last_of(types_close_parenthesis);
771-
if (pos != std::string_view::npos) {
771+
if (pos != name.npos) {
772772
name = name.substr(0, pos);
773773
}
774774

775775
#if defined(__GNUC__)
776776
constexpr auto type_separator = ';';
777777
pos = name.find(type_separator);
778-
if (pos != std::string_view::npos) {
778+
if (pos != name.npos) {
779779
name = name.substr(0, pos);
780780
}
781781
#endif

regression-tests/test-results/version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
cppfront compiler v0.7.1 Build 9713:1156
2+
cppfront compiler v0.7.1 Build 9714:0930
33
Copyright(c) Herb Sutter All rights reserved
44

55
SPDX-License-Identifier: CC-BY-NC-ND-4.0

source/build.info

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
"9713:1156"
1+
"9714:0930"

source/io.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ auto starts_with_whitespace_slash_star_and_no_star_slash(std::string const& line
175175
&& line[i + 1] == '*'
176176
)
177177
{
178-
return line.find("*/", i) == std::string::npos;
178+
return line.find("*/", i) == line.npos;
179179
}
180180
else {
181181
return false;
@@ -604,7 +604,7 @@ auto process_cpp_line(
604604
}
605605
else if (in_raw_string_literal) {
606606
auto end_pos = line.find(raw_string_closing_seq, i);
607-
if (end_pos == std::string::npos) {
607+
if (end_pos == line.npos) {
608608
return r;
609609
}
610610
in_raw_string_literal = false;
@@ -626,7 +626,7 @@ auto process_cpp_line(
626626
if (i < ssize(line) - 1)
627627
{
628628
if (auto paren_pos = line.find("(", i);
629-
paren_pos != std::string::npos
629+
paren_pos != line.npos
630630
)
631631
{
632632
raw_string_closing_seq = ")"+line.substr(i, paren_pos-i)+"\"";

source/lex.h

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1267,7 +1267,7 @@ auto lex_line(
12671267
// raw string was not expanded
12681268

12691269
raw_string_multiline.value().text += part;
1270-
if (end_pos == std::string::npos) {
1270+
if (end_pos == line.npos) {
12711271
raw_string_multiline.value().text += '\n';
12721272
break;
12731273
}
@@ -1328,7 +1328,7 @@ auto lex_line(
13281328
comment::comment_kind::line_comment,
13291329
{lineno, i},
13301330
{lineno, _as<colno_t>(std::ssize(line))},
1331-
std::string(&line[i], std::ssize(line) - i)
1331+
line.substr(i)
13321332
});
13331333
in_comment = false;
13341334
goto END;
@@ -1484,7 +1484,7 @@ auto lex_line(
14841484
auto R_pos = i + 1;
14851485
auto seq_pos = i + 3;
14861486

1487-
if (auto paren_pos = line.find("(", seq_pos); paren_pos != std::string::npos) {
1487+
if (auto paren_pos = line.find("(", seq_pos); paren_pos != line.npos) {
14881488
auto opening_seq = line.substr(i, paren_pos - i + 1);
14891489
auto closing_seq = ")"+line.substr(seq_pos, paren_pos-seq_pos)+"\"";
14901490

@@ -1532,7 +1532,7 @@ auto lex_line(
15321532
else {
15331533
errors.emplace_back(
15341534
source_position(lineno, i + 1),
1535-
"invalid new-line in raw string delimiter \"" + std::string(&line[i],3)
1535+
"invalid new-line in raw string delimiter \"" + line.substr(i, 3)
15361536
+ "\" - stray 'R' in program \""
15371537
);
15381538
}
@@ -1579,7 +1579,6 @@ auto lex_line(
15791579
source_position(lineno, i),
15801580
"binary literal cannot be empty (0B must be followed by binary digits)"
15811581
);
1582-
++i;
15831582
}
15841583
}
15851584
else if (peek1 == 'x' || peek1 == 'X') {
@@ -1593,7 +1592,6 @@ auto lex_line(
15931592
source_position(lineno, i),
15941593
"hexadecimal literal cannot be empty (0X must be followed by hexadecimal digits)"
15951594
);
1596-
++i;
15971595
}
15981596
}
15991597
}
@@ -1703,7 +1701,7 @@ auto lex_line(
17031701
if (peek(j-2) == 'R') {
17041702
auto seq_pos = i + j;
17051703

1706-
if (auto paren_pos = line.find("(", seq_pos); paren_pos != std::string::npos) {
1704+
if (auto paren_pos = line.find("(", seq_pos); paren_pos != line.npos) {
17071705
auto opening_seq = line.substr(i, paren_pos - i + 1);
17081706
auto closing_seq = ")"+line.substr(seq_pos, paren_pos-seq_pos)+"\"";
17091707

@@ -1724,7 +1722,7 @@ auto lex_line(
17241722
else {
17251723
errors.emplace_back(
17261724
source_position(lineno, i + j - 2),
1727-
"invalid new-line in raw string delimiter \"" + std::string(&line[i],j)
1725+
"invalid new-line in raw string delimiter \"" + line.substr(i, j)
17281726
+ "\" - stray 'R' in program \""
17291727
);
17301728
}
@@ -1734,7 +1732,7 @@ auto lex_line(
17341732
if (peek(j) != '\"') {
17351733
errors.emplace_back(
17361734
source_position(lineno, i),
1737-
"string literal \"" + std::string(&line[i+1],j)
1735+
"string literal \"" + line.substr(i+1, j)
17381736
+ "\" is missing its closing \""
17391737
);
17401738
}
@@ -1781,7 +1779,7 @@ auto lex_line(
17811779
assert (j > 1);
17821780
errors.emplace_back(
17831781
source_position(lineno, i),
1784-
"character literal '" + std::string(&line[i+1],j-1)
1782+
"character literal '" + line.substr(i+1, j-1)
17851783
+ "' is missing its closing '"
17861784
);
17871785
}

source/reflect.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -881,7 +881,7 @@ auto newline_pos{CPP2_UFCS(find)(source, '\n')};
881881
if ( cpp2::impl::cmp_greater(CPP2_UFCS(ssize)(source),1)
882882
&& newline_pos != source.npos)
883883
{
884-
while( newline_pos != std::string_view::npos )
884+
while( newline_pos != source.npos )
885885
{
886886
add_line(CPP2_UFCS(substr)(source, 0, newline_pos));
887887
CPP2_UFCS(remove_prefix)(source, newline_pos + 1);

source/reflect.h2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ compiler_services: @polymorphic_base @copyable type =
102102
if source.ssize() > 1
103103
&& newline_pos != source.npos
104104
{
105-
while newline_pos != std::string_view::npos
105+
while newline_pos != source.npos
106106
{
107107
add_line( source.substr(0, newline_pos) );
108108
source.remove_prefix( newline_pos+1 );

source/to_cpp1.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -343,9 +343,9 @@ class positional_printer
343343
// and where the last one was which determines our current colno
344344
if (track_curr_pos)
345345
{
346-
auto last_newline = std::string::npos; // the last newline we found in the string
346+
auto last_newline = s.npos; // the last newline we found in the string
347347
auto newline_pos = std::size_t(0); // the current newline we found in the string
348-
while ((newline_pos = s.find('\n', newline_pos)) != std::string::npos)
348+
while ((newline_pos = s.find('\n', newline_pos)) != s.npos)
349349
{
350350
// For each line break we find, reset pad and inc current lineno
351351
pad_for_this_line = 0;
@@ -355,7 +355,7 @@ class positional_printer
355355
}
356356

357357
// Now also adjust the colno
358-
if (last_newline != std::string::npos) {
358+
if (last_newline != s.npos) {
359359
// If we found a newline, it's the distance from the last newline to EOL
360360
curr_pos.colno = unsafe_narrow<colno_t>(s.length() - last_newline);
361361
}
@@ -415,7 +415,7 @@ class positional_printer
415415
if (c.kind == comment::comment_kind::line_comment) {
416416
print( pad( c.start.colno - curr_pos.colno + 1 ) );
417417
print( c.text );
418-
assert( c.text.find("\n") == std::string::npos ); // we shouldn't have newlines
418+
assert( c.text.find("\n") == c.text.npos ); // we shouldn't have newlines
419419
print("\n");
420420
}
421421

@@ -792,7 +792,7 @@ class positional_printer
792792
&& newline_pos != s.npos
793793
)
794794
{
795-
while (newline_pos != std::string_view::npos)
795+
while (newline_pos != s.npos)
796796
{
797797
// Print the text before the next newline
798798
if (newline_pos > 0) {
@@ -4424,8 +4424,8 @@ class cppfront
44244424
tparam->declaration->is_type()
44254425
&& (
44264426
name == tparam_name
4427-
|| name.find("<"+tparam_name) != std::string_view::npos
4428-
|| name.find(","+tparam_name) != std::string_view::npos
4427+
|| name.find("<"+tparam_name) != name.npos
4428+
|| name.find(","+tparam_name) != name.npos
44294429
)
44304430
)
44314431
{

0 commit comments

Comments
 (0)