Skip to content

Commit 0fa4217

Browse files
committed
Cleanup and simplification of comment and #line emission logic
Another step preparing to separate decl/defn comment emission, but for now continue to emit all the comments on the definitions While we're at it, add a "no comment left behind" debug check
1 parent 3a87189 commit 0fa4217

File tree

72 files changed

+412
-368
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+412
-368
lines changed

regression-tests/test-results/mixed-allcpp1-hello.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,3 @@ auto main() -> int
1313
auto s = std::string{"world\n"};
1414
std::cout << "Hello " << s;
1515
}
16-

regression-tests/test-results/mixed-as-for-variant-20-types.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,13 @@ struct X { operator int() const { return I; } };
55

66
#include "cpp2util.h"
77

8-
98
#line 4 "mixed-as-for-variant-20-types.cpp2"
109
[[nodiscard]] auto main() -> int;
1110

1211
//=== Cpp2 definitions ==========================================================
1312

14-
#line 3 "mixed-as-for-variant-20-types.cpp2"
1513

14+
#line 4 "mixed-as-for-variant-20-types.cpp2"
1615
[[nodiscard]] auto main() -> int{
1716

1817
std::variant<X<0>,X<1>,X<2>,X<3>,X<4>,X<5>,X<6>,X<7>,X<8>,X<9>,X<10>,X<11>,X<12>,X<13>,X<14>,X<15>,X<16>,X<17>,X<18>,X<19>> v {

regression-tests/test-results/mixed-bounds-check.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,13 @@
55

66
#include "cpp2util.h"
77

8-
98
#line 4 "mixed-bounds-check.cpp2"
109
[[nodiscard]] auto main() -> int;
1110

1211
//=== Cpp2 definitions ==========================================================
1312

14-
#line 3 "mixed-bounds-check.cpp2"
1513

14+
#line 4 "mixed-bounds-check.cpp2"
1615
[[nodiscard]] auto main() -> int{
1716
std::vector v {1, 2, 3, 4, 5, -999};
1817
CPP2_UFCS_0(pop_back, v);

regression-tests/test-results/mixed-bounds-safety-with-assert-2.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
#include "cpp2util.h"
44

5-
65
#line 2 "mixed-bounds-safety-with-assert-2.cpp2"
76
[[nodiscard]] auto main() -> int;
7+
88
#line 10 "mixed-bounds-safety-with-assert-2.cpp2"
99
auto add_42_to_subrange(auto& rng, cpp2::in<int> start, cpp2::in<int> end) -> void;
1010
#line 23 "mixed-bounds-safety-with-assert-2.cpp2"
@@ -15,8 +15,8 @@ auto add_42_to_subrange(auto& rng, cpp2::in<int> start, cpp2::in<int> end) -> vo
1515

1616
//=== Cpp2 definitions ==========================================================
1717

18-
#line 1 "mixed-bounds-safety-with-assert-2.cpp2"
1918

19+
#line 2 "mixed-bounds-safety-with-assert-2.cpp2"
2020
[[nodiscard]] auto main() -> int{
2121
std::vector<int> v {1, 2, 3, 4, 5};
2222
add_42_to_subrange(v, 1, 3);

regression-tests/test-results/mixed-bounds-safety-with-assert.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
#include "cpp2util.h"
44

5-
65
#line 2 "mixed-bounds-safety-with-assert.cpp2"
76
[[nodiscard]] auto main() -> int;
7+
88
#line 7 "mixed-bounds-safety-with-assert.cpp2"
99
auto print_subrange(auto const& rng, cpp2::in<int> start, cpp2::in<int> end) -> void;
1010
#line 19 "mixed-bounds-safety-with-assert.cpp2"
@@ -15,8 +15,8 @@ auto print_subrange(auto const& rng, cpp2::in<int> start, cpp2::in<int> end) ->
1515

1616
//=== Cpp2 definitions ==========================================================
1717

18-
#line 1 "mixed-bounds-safety-with-assert.cpp2"
1918

19+
#line 2 "mixed-bounds-safety-with-assert.cpp2"
2020
[[nodiscard]] auto main() -> int{
2121
std::vector<int> v {1, 2, 3, 4, 5};
2222
print_subrange(std::move(v), 1, 13);

regression-tests/test-results/mixed-captures-in-expressions-and-postconditions.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,16 @@
66

77
#include "cpp2util.h"
88

9-
109
#line 5 "mixed-captures-in-expressions-and-postconditions.cpp2"
1110
[[nodiscard]] auto main() -> int;
12-
#line 17 "mixed-captures-in-expressions-and-postconditions.cpp2"
11+
1312
#line 19 "mixed-captures-in-expressions-and-postconditions.cpp2"
1413
auto insert_at(cpp2::in<int> where, cpp2::in<int> val) -> void;
1514

1615
//=== Cpp2 definitions ==========================================================
1716

18-
#line 4 "mixed-captures-in-expressions-and-postconditions.cpp2"
1917

18+
#line 5 "mixed-captures-in-expressions-and-postconditions.cpp2"
2019
[[nodiscard]] auto main() -> int{
2120
std::vector<std::string> vec {
2221
"hello", "2022"};
@@ -32,11 +31,11 @@ auto insert_at(cpp2::in<int> where, cpp2::in<int> val) -> void;
3231
std::vector<int> vec {};
3332

3433
auto insert_at(cpp2::in<int> where, cpp2::in<int> val) -> void
35-
{
34+
35+
#line 22 "mixed-captures-in-expressions-and-postconditions.cpp2"
36+
{
3637
cpp2::Default.expects(cpp2::cmp_less_eq(0,where) && cpp2::cmp_less_eq(where,CPP2_UFCS_0(ssize, vec)), "");
3738
auto post_21_5 = cpp2::finally_success([_0 = CPP2_UFCS_0(ssize, vec)]{cpp2::Default.expects(CPP2_UFCS_0(ssize, vec)==_0 + 1, "");} );
38-
#line 21 "mixed-captures-in-expressions-and-postconditions.cpp2"
39-
4039
#line 23 "mixed-captures-in-expressions-and-postconditions.cpp2"
4140
CPP2_UFCS(insert, vec, CPP2_UFCS_0(begin, vec) + where, val);
4241
}

regression-tests/test-results/mixed-fixed-type-aliases.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,16 @@ namespace my {
99

1010
#include "cpp2util.h"
1111

12-
1312
#line 8 "mixed-fixed-type-aliases.cpp2"
1413
auto test(auto const& x) -> void;
14+
1515
#line 15 "mixed-fixed-type-aliases.cpp2"
1616
[[nodiscard]] auto main(int const argc_, char const* const* const argv_) -> int;
1717

1818
//=== Cpp2 definitions ==========================================================
1919

20-
#line 7 "mixed-fixed-type-aliases.cpp2"
2120

21+
#line 8 "mixed-fixed-type-aliases.cpp2"
2222
auto test(auto const& x) -> void{
2323
std::cout
2424
<< std::boolalpha

regression-tests/test-results/mixed-float-literals.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,16 +58,16 @@ void literals_cpp1() {
5858

5959
#include "cpp2util.h"
6060

61-
6261
#line 57 "mixed-float-literals.cpp2"
6362
auto literals_cpp2() -> void;
63+
6464
#line 114 "mixed-float-literals.cpp2"
6565
[[nodiscard]] auto main() -> int;
6666

6767
//=== Cpp2 definitions ==========================================================
6868

69-
#line 56 "mixed-float-literals.cpp2"
7069

70+
#line 57 "mixed-float-literals.cpp2"
7171
auto literals_cpp2() -> void{
7272
// integers
7373
123;

regression-tests/test-results/mixed-forwarding.cpp

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,37 +12,41 @@ struct X {
1212

1313
#include "cpp2util.h"
1414

15-
1615
#line 11 "mixed-forwarding.cpp2"
1716
auto copy_from(auto x) -> void;
18-
#line 13 "mixed-forwarding.cpp2"
17+
1918
auto use(auto const& x) -> void;
19+
2020
#line 16 "mixed-forwarding.cpp2"
2121
auto apply_implicit_forward(auto&& t) -> void;
22+
2223
#line 20 "mixed-forwarding.cpp2"
2324
auto apply_explicit_forward(auto&& t) -> void;
25+
2426
#line 25 "mixed-forwarding.cpp2"
2527
[[nodiscard]] auto main() -> int;
2628

2729
//=== Cpp2 definitions ==========================================================
2830

29-
#line 10 "mixed-forwarding.cpp2"
3031

32+
#line 11 "mixed-forwarding.cpp2"
3133
auto copy_from(auto x) -> void{}
3234

3335
auto use(auto const& x) -> void{}
3436

3537
// invoking each of these with an rvalue std::pair argument ...
3638
auto apply_implicit_forward(auto&& t) -> void
3739
requires std::is_same_v<CPP2_TYPEOF(t), std::pair<X,X>>
38-
#line 17 "mixed-forwarding.cpp2"
39-
{ copy_from(t.first); // copies
40+
#line 16 "mixed-forwarding.cpp2"
41+
{
42+
copy_from(t.first); // copies
4043
copy_from(CPP2_FORWARD(t).second);// moves
4144
}
4245
auto apply_explicit_forward(auto&& t) -> void
4346
requires std::is_same_v<CPP2_TYPEOF(t), std::pair<X,X>>
44-
#line 21 "mixed-forwarding.cpp2"
45-
{ copy_from( CPP2_FORWARD(t).first);// moves
47+
#line 20 "mixed-forwarding.cpp2"
48+
{
49+
copy_from( CPP2_FORWARD(t).first);// moves
4650
copy_from( CPP2_FORWARD(t).second);// moves
4751
}
4852

regression-tests/test-results/mixed-function-expression-and-std-for-each.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,13 @@
88

99
#include "cpp2util.h"
1010

11-
1211
#line 7 "mixed-function-expression-and-std-for-each.cpp2"
1312
[[nodiscard]] auto main() -> int;
1413

1514
//=== Cpp2 definitions ==========================================================
1615

17-
#line 6 "mixed-function-expression-and-std-for-each.cpp2"
1816

17+
#line 7 "mixed-function-expression-and-std-for-each.cpp2"
1918
[[nodiscard]] auto main() -> int{
2019
std::vector<std::string> vec {
2120
"hello", "2022"};

0 commit comments

Comments
 (0)