This patch rebases and creates a new revision for http://reviews.llvm.org/D11361 as requested by John.
Here's the adapted original summary (the global captures issue has been fixed in the meantime):
This patch implements the outlining for offloading functions for code annotated with the OpenMP target directive. It uses a temporary naming of the outlined functions that will have to be updated later on once target side codegen and registration of offloading libraries is implemented - the naming needs to be made unique in the produced library.
Unlike other captured regions, target offloading cannot use directly the Capture declaration, as each captured field has to be passed explicitly to the runtime library and associated with potentially different mapping types (to/from/alloc...). A proxy function is used to wrap the default capturing implemented in clang and adapt it to what OpenMP offloading requires.
Thanks!
Samuel
Turn this to LValue like CGF.MakeAddrLValue(CGF.CreateMemTemp(OffloadErrorQType, ".run_host_version"), OffloadErrorQType); and use this Lvalue rather than Address.