meson-plus-plus icon indicating copy to clipboard operation
meson-plus-plus copied to clipboard

nested target promotion

Open dcbaker opened this issue 4 years ago • 1 comments

We really want to have all of our targets at the top level, so if we come across code like:

test(
  'mytest',
  executable(...),
)

we need to transform it into something like, like

___mesonpp_generated_target_for_mytest = executable(...)
test('mytest', ___mesonpp_generated_target_for_mytest)

This simplifies the backend's ability to generate rules.

In reality, we probably don't need to generate the assignment, just move the executable, then create a reference to it in the test.

This likely needs to run in a late set of passes. It's also possible that this will undo something that constant-combining has done, and still creates a position where the backend needs to know about assignments, something I'm not sure it does.

dcbaker avatar Oct 10 '21 05:10 dcbaker