Fix lambda object mapping in OpenMP C++ target offloading.
Restores correct mapping of lambda objects within aggregates for OpenMP C++ target offloading.
This commit fixes a regression in OpenMP C++ target offloading where lambda objects used as subobjects of aggregates were no longer correctly mapped. The C++ front-end failed to recognize lambda bases wrapped in location wrappers (VIEW_CONVERT_EXPR). The fix involves stripping these location wrappers when searching for the lambda object’s base, thereby re-enabling correct offloading for such constructs and un-XFAILing related test cases.
In Details
This patch addresses PR 127559, specifically a regression introduced in GCC 84d5fecd2694ad70f391a20451d43d82fde37eb5. The C++ front-end's finish_omp_target_clauses_r function, when processing OpenMP target directives, now correctly handles lambda objects that are members of aggregates (e.g., c.x where c is an aggregate containing a lambda x). Previously, it failed to recognize such lambdas if their base declaration was wrapped in a VIEW_CONVERT_EXPR (a location wrapper). The fix strips these wrappers, allowing the recognition of the lambda's base VAR_DECL, PARM_DECL, or `RESULT_…
- OpenMP target offloading
- A feature of OpenMP that allows parts of a program to be executed on a separate device, such as a GPU, while the rest runs on the host CPU.
- Lambda object
- An object representing an anonymous function defined using C++ lambda syntax (e.g.,
[](){ ... }). - Aggregate
- A C++ class or struct that has no user-declared constructors, no private or protected non-static data members, no base classes, and no virtual functions. Examples include structs and arrays.
- VIEW_CONVERT_EXPR
- An internal GCC representation node indicating a cast or conversion that views data in a different type or format, often used for temporary object wrappers or type coercions within the compiler's intermediate representation.
- XFAIL
- In test suites, 'Expected Failure'. A test case marked as XFAIL is expected to fail, and the test runner considers it a pass if it fails as expected, and a failure if it unexpectedly passes.