[PATCH] D109609: [C++4OpenCL] Add support for multiple address spaced destructors

Ronan Keryell via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 13 01:21:56 PDT 2021


keryell added a comment.

While it might be possible to extend arbitrarily C++, I have the feeling that having just 1 destructor and have a different code path-code according the address space would not be enough.
It is possible to write:

  ~MyDestructor() {
    if constexpr (SomeAPIReturningAddressSpace() == ...::Global) {
      /* Global address space code */
    }
    else if constexpr (...) {
    }
  }

It is possible to build higher-level dispatching constructs from this in OpenCL C++ library, for example à la `std::visit` from `std::variant`.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109609/new/

https://reviews.llvm.org/D109609



More information about the cfe-commits mailing list