Skip to content

Commit

Permalink
Enable debugging with LLDB (Xcode, Qt Creator, etc)
Browse files Browse the repository at this point in the history
* Print line directives before function definitions
* Add command line option to enable absolute paths in line directives (defaults to off)

These changes are required to enable debugging with LLDB (turn on absolute paths).

Update test-results with line directives before function definitions
  • Loading branch information
bluetarpmedia committed Jan 11, 2024
1 parent 4952e0a commit fabcafa
Show file tree
Hide file tree
Showing 64 changed files with 185 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ auto add_42_to_subrange(auto& rng, cpp2::in<int> start, cpp2::in<int> end) -> vo
std::cout << i << "\n";
}

#line 10 "mixed-bounds-safety-with-assert-2.cpp2"
auto add_42_to_subrange(auto& rng, cpp2::in<int> start, cpp2::in<int> end) -> void
{
if (cpp2::Bounds.has_handler() && !(cpp2::cmp_less_eq(0,start)) ) { cpp2::Bounds.report_violation(""); }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ auto print_subrange(auto const& rng, cpp2::in<int> start, cpp2::in<int> end) ->
print_subrange(std::move(v), 1, 13);
}

#line 9 "mixed-bounds-safety-with-assert.cpp2"
auto print_subrange(auto const& rng, cpp2::in<int> start, cpp2::in<int> end) -> void{
if (cpp2::Bounds.has_handler() && !(cpp2::cmp_less_eq(0,start)) ) { cpp2::Bounds.report_violation(""); }
if (cpp2::Bounds.has_handler() && !(cpp2::cmp_less_eq(end,CPP2_UFCS(ssize)(rng))) ) { cpp2::Bounds.report_violation(""); }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,10 @@ namespace ns {
#line 21 "mixed-bugfix-for-ufcs-non-local.cpp2"
template<t<CPP2_UFCS_NONLOCAL(f)(o)> _> auto g() -> void{}// Fails on GCC ([GCC109781][]) and Clang 12 (a lambda expression cannot appear in this context)

#line 23 "mixed-bugfix-for-ufcs-non-local.cpp2"
auto g([[maybe_unused]] cpp2::in<t<CPP2_UFCS_NONLOCAL(f)(o)>> unnamed_param_1) -> void{}// Fails on Clang 12 (lambda in unevaluated context).

#line 25 "mixed-bugfix-for-ufcs-non-local.cpp2"
auto g() -> void{
if (cpp2::Default.has_handler() && !(CPP2_UFCS(f)(o)) ) { cpp2::Default.report_violation(""); }}

Expand All @@ -100,5 +102,6 @@ auto g() -> void{
#line 45 "mixed-bugfix-for-ufcs-non-local.cpp2"
}

#line 47 "mixed-bugfix-for-ufcs-non-local.cpp2"
auto main() -> int{}

Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ auto insert_at(cpp2::in<int> where, cpp2::in<int> val) -> void;

std::vector<int> vec {};

#line 19 "mixed-captures-in-expressions-and-postconditions.cpp2"
auto insert_at(cpp2::in<int> where, cpp2::in<int> val) -> void

#line 22 "mixed-captures-in-expressions-and-postconditions.cpp2"
Expand Down
1 change: 1 addition & 0 deletions regression-tests/test-results/mixed-float-literals.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ auto literals_cpp2() -> void{
// 1.E-10F;
}

#line 114 "mixed-float-literals.cpp2"
[[nodiscard]] auto main() -> int{
literals_cpp1();
literals_cpp2();
Expand Down
3 changes: 3 additions & 0 deletions regression-tests/test-results/mixed-forwarding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ CPP2_REQUIRES (std::is_same_v<CPP2_TYPEOF(t), std::pair<X,X>>) ;
#line 11 "mixed-forwarding.cpp2"
auto copy_from([[maybe_unused]] auto unnamed_param_1) -> void{}

#line 13 "mixed-forwarding.cpp2"
auto use([[maybe_unused]] auto const& unnamed_param_1) -> void{}

#line 16 "mixed-forwarding.cpp2"
Expand All @@ -53,13 +54,15 @@ requires (std::is_same_v<CPP2_TYPEOF(t), std::pair<X,X>>) {
copy_from(t.first); // copies
copy_from(CPP2_FORWARD(t).second);// moves
}
#line 20 "mixed-forwarding.cpp2"
auto apply_explicit_forward(auto&& t) -> void
requires (std::is_same_v<CPP2_TYPEOF(t), std::pair<X,X>>) {
#line 21 "mixed-forwarding.cpp2"
copy_from(CPP2_FORWARD(t).first);// moves
copy_from(CPP2_FORWARD(t).second);// moves
}

#line 25 "mixed-forwarding.cpp2"
[[nodiscard]] auto main() -> int{
std::pair<X,X> t1 {1, 2};
apply_implicit_forward(t1);
Expand Down
1 change: 1 addition & 0 deletions regression-tests/test-results/mixed-hello.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ auto main() -> int {
return s;
}

#line 11 "mixed-hello.cpp2"
auto decorate(std::string& s) -> void{
s = "[" + s + "]";
}
Expand Down
3 changes: 3 additions & 0 deletions regression-tests/test-results/mixed-increment-decrement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,13 +188,16 @@ requires (bool(Op & 2)) { auto ret = x; ++x; return ret; }
auto operator++(number_line_pre_increment<0>& x) -> number_line_pre_increment<0>& { return x; }
#line 51 "mixed-increment-decrement.cpp2"
auto operator++(number_line_pre_increment<0>& x,int) -> number_line_pre_increment<0> { auto ret = x; ++x; return ret; }
#line 52 "mixed-increment-decrement.cpp2"
auto operator--(number_line_pre_decrement<0>& x) -> number_line_pre_decrement<0>& { return x; }
#line 52 "mixed-increment-decrement.cpp2"
auto operator--(number_line_pre_decrement<0>& x,int) -> number_line_pre_decrement<0> { auto ret = x; ++x; return ret; }

#line 54 "mixed-increment-decrement.cpp2"
auto operator++(number_line_pre_increment<1>& x) -> number_line_pre_increment<1> const& { return x; }
#line 54 "mixed-increment-decrement.cpp2"
auto operator++(number_line_pre_increment<1>& x,int) -> number_line_pre_increment<1> const { auto ret = x; ++x; return ret; }
#line 55 "mixed-increment-decrement.cpp2"
auto operator--(number_line_pre_decrement<1>& x) -> number_line_pre_decrement<1> const& { return x; }
#line 55 "mixed-increment-decrement.cpp2"
auto operator--(number_line_pre_decrement<1>& x,int) -> number_line_pre_decrement<1> const { auto ret = x; ++x; return ret; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ bool flip_a_coin() {
print_decorated(std::move(x.value()));
}

#line 18 "mixed-initialization-safety-3-contract-violation.cpp2"
auto fill(
cpp2::out<std::string> x,
cpp2::in<std::string> value,
Expand All @@ -66,5 +67,6 @@ auto fill(
x.construct(CPP2_UFCS(substr)(value, 0, count));
}

#line 28 "mixed-initialization-safety-3-contract-violation.cpp2"
auto print_decorated(auto const& x) -> void { std::cout << ">> [" << x << "]\n"; }

Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ auto print_decorated(auto const& x) -> void;
print_decorated(std::move(x.value()));
}

#line 16 "mixed-initialization-safety-3.cpp2"
auto fill(
cpp2::out<std::string> x,
cpp2::in<std::string> value,
Expand All @@ -60,6 +61,7 @@ auto fill(
x.construct(CPP2_UFCS(substr)(value, 0, count));
}

#line 26 "mixed-initialization-safety-3.cpp2"
auto print_decorated(auto const& x) -> void { std::cout << ">> [" << x << "]\n"; }

#line 30 "mixed-initialization-safety-3.cpp2"
Expand Down
2 changes: 2 additions & 0 deletions regression-tests/test-results/mixed-inspect-templates.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ struct my_type {};
();
}

#line 18 "mixed-inspect-templates.cpp2"
[[nodiscard]] auto fun2(auto const& v) -> std::string{
if (cpp2::is<std::vector>(v)) {return "std::vector"; }
if (cpp2::is<std::array>(v)) {return "std::array"; }
Expand All @@ -50,6 +51,7 @@ struct my_type {};
return "unknown";
}

#line 26 "mixed-inspect-templates.cpp2"
[[nodiscard]] auto main() -> int{
std::vector<int> vec {1, 2, 3};
std::array<int,4> arr {1, 2, 3, 4};
Expand Down
2 changes: 2 additions & 0 deletions regression-tests/test-results/mixed-inspect-values.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ auto test(auto const& x) -> void;
#line 5 "mixed-inspect-values.cpp2"
[[nodiscard]] auto in_2_3(cpp2::in<int> x) -> bool { return cpp2::cmp_less_eq(2,x) && cpp2::cmp_less_eq(x,3); }

#line 7 "mixed-inspect-values.cpp2"
[[nodiscard]] auto main() -> int{
std::variant<double,std::string,double> v {};
v = "rev dodgson";
Expand All @@ -54,6 +55,7 @@ auto test(auto const& x) -> void;
test(3.14);
}

#line 31 "mixed-inspect-values.cpp2"
auto test(auto const& x) -> void{
auto forty_two {42};
std::cout << [&] () -> std::string { auto&& _expr = x;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ auto calc() {
();
}

#line 14 "mixed-inspect-with-typeof-of-template-arg-list.cpp2"
[[nodiscard]] auto main() -> int{
return fun(42);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ auto try_pointer_stuff() -> void{
// to show -n
}

#line 21 "mixed-lifetime-safety-and-null-contracts.cpp2"
auto call_my_framework(char const* msg) -> void{
std::cout
<< "sending error to my framework... ["
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ bool flip_a_coin() {
print_and_decorate(*cpp2::assert_not_null(std::move(p.value())));
}

#line 21 "mixed-lifetime-safety-pointer-init-4.cpp2"
auto print_and_decorate(auto const& thing) -> void {
std::cout << ">> " << thing << "\n"; }

Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ bool flip_a_coin() {
return { std::move(i.value()), std::move(s.value()) };
}

#line 22 "mixed-multiple-return-values.cpp2"
auto do_print(cpp2::in<std::string> name, auto const& value) -> void {
std::cout << name << " is " << value << "\n"; }

5 changes: 5 additions & 0 deletions regression-tests/test-results/mixed-out-destruction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,17 @@ int main() {

#line 22 "mixed-out-destruction.cpp2"
auto f00() -> void { C auto_22_28 {"f00"}; cpp2::deferred_init<X> x; f01(cpp2::out(&x));}
#line 23 "mixed-out-destruction.cpp2"
auto f01(cpp2::out<X> x) -> void{C auto_23_28 {"f01"}; x.construct();throw_1();}

#line 27 "mixed-out-destruction.cpp2"
auto f10() -> void { C auto_27_28 {"f10"}; cpp2::deferred_init<X> x; f11(cpp2::out(&x));}
#line 28 "mixed-out-destruction.cpp2"
auto f11(cpp2::out<X> x) -> void{C auto_28_28 {"f11"}; f12(cpp2::out(&x));}
#line 29 "mixed-out-destruction.cpp2"
auto f12(cpp2::out<X> x) -> void{C auto_29_28 {"f12"}; f13(cpp2::out(&x));throw_1();}
#line 30 "mixed-out-destruction.cpp2"
auto f13(cpp2::out<X> x) -> void{C auto_30_28 {"f13"}; f14(cpp2::out(&x));}
#line 31 "mixed-out-destruction.cpp2"
auto f14(cpp2::out<X> x) -> void{C auto_31_28 {"f14"}; x.construct();}

Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ auto f(auto x_) -> void{
x.construct(42);
}

#line 15 "mixed-parameter-passing-generic-out.cpp2"
[[nodiscard]] auto main() -> int{
cpp2::deferred_init<int> a;
f(cpp2::out(&a));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ CPP2_REQUIRES (std::is_same_v<CPP2_TYPEOF(e), std::string>)
#line 6 "mixed-parameter-passing-with-forward.cpp2"
auto copy_from([[maybe_unused]] auto unnamed_param_1) -> void{}

#line 8 "mixed-parameter-passing-with-forward.cpp2"
auto parameter_styles(
[[maybe_unused]] cpp2::in<std::string> unnamed_param_1,
std::string b,
Expand Down Expand Up @@ -76,5 +77,6 @@ requires (std::is_same_v<CPP2_TYPEOF(e), std::string>)

}

#line 42 "mixed-parameter-passing-with-forward.cpp2"
[[nodiscard]] auto main() -> int{}

2 changes: 2 additions & 0 deletions regression-tests/test-results/mixed-parameter-passing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ auto parameter_styles(
#line 6 "mixed-parameter-passing.cpp2"
auto copy_from([[maybe_unused]] auto unnamed_param_1) -> void{}

#line 8 "mixed-parameter-passing.cpp2"
auto parameter_styles(
[[maybe_unused]] cpp2::in<std::string> unnamed_param_1,
std::string b,
Expand Down Expand Up @@ -68,5 +69,6 @@ auto parameter_styles(

}

#line 40 "mixed-parameter-passing.cpp2"
[[nodiscard]] auto main() -> int{}

Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ struct make_strings_ret { std::string a; std::string b; };

std::vector<int> vec {};

#line 16 "mixed-postexpression-with-capture.cpp2"
auto insert_at(cpp2::in<int> where, cpp2::in<int> val) -> void

#line 19 "mixed-postexpression-with-capture.cpp2"
Expand All @@ -64,6 +65,7 @@ auto insert_at(cpp2::in<int> where, cpp2::in<int> val) -> void
CPP2_UFCS(push_back)(vec, val);
}

#line 23 "mixed-postexpression-with-capture.cpp2"
[[nodiscard]] auto make_string() -> make_string_ret

{
Expand All @@ -74,6 +76,7 @@ auto insert_at(cpp2::in<int> where, cpp2::in<int> val) -> void
ret += " and ";
cpp2_finally_presuccess.run(); return std::move(ret); }

#line 29 "mixed-postexpression-with-capture.cpp2"
[[nodiscard]] auto make_strings() -> make_strings_ret

#line 35 "mixed-postexpression-with-capture.cpp2"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ auto call([[maybe_unused]] auto const& unnamed_param_1, [[maybe_unused]] auto co
#line 2 "mixed-postfix-expression-custom-formatting.cpp2"
auto call([[maybe_unused]] auto const& unnamed_param_1, [[maybe_unused]] auto const& unnamed_param_2, [[maybe_unused]] auto const& unnamed_param_3, [[maybe_unused]] auto const& unnamed_param_4, [[maybe_unused]] auto const& unnamed_param_5) -> void{}

#line 4 "mixed-postfix-expression-custom-formatting.cpp2"
[[nodiscard]] auto test(auto const& a) -> std::string{
return call(a,
++*cpp2::assert_not_null(CPP2_UFCS(b)(a, a.c)), "hello", /* polite
Expand All @@ -38,5 +39,6 @@ auto call([[maybe_unused]] auto const& unnamed_param_1, [[maybe_unused]] auto co
);
}

#line 15 "mixed-postfix-expression-custom-formatting.cpp2"
[[nodiscard]] auto main() -> int{}

1 change: 1 addition & 0 deletions regression-tests/test-results/mixed-type-safety-1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ auto print(cpp2::in<std::string> msg, cpp2::in<bool> b) -> void;
auto print(cpp2::in<std::string> msg, auto const& x) -> void {
std::cout << msg << x << "\n"; }

#line 16 "mixed-type-safety-1.cpp2"
auto print(cpp2::in<std::string> msg, cpp2::in<bool> b) -> void
{
cpp2::deferred_init<char const*> bmsg;
Expand Down
1 change: 1 addition & 0 deletions regression-tests/test-results/pure2-bounds-safety-span.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ auto print_and_decorate(auto const& thing) -> void;
}
}

#line 15 "pure2-bounds-safety-span.cpp2"
auto print_and_decorate(auto const& thing) -> void {
std::cout << ">> " << thing << "\n"; }

Loading

0 comments on commit fabcafa

Please sign in to comment.