[PATCH] D92361: [trivial-abi] Support types without a copy or move constructor.

Akira Hatanaka via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 1 17:53:11 PST 2020


ahatanak added a comment.

In the following example, should `S1` be passed directly or indirectly? The current patch passes it indirectly.

  struct __attribute__((trivial_abi)) S0 {
    S0();
    S0(const S0 &) = delete;
    S0(S0 &&) = delete;
    int a;
  };
  
  struct S1 {
    S0 s0;
  };
  
  void foo1(S1);
  
  void test1() {
    foo1(S1());
  }

In contrast, `S3` in the following example is passed directly.

  struct __attribute__((trivial_abi)) S2 {
    S2();
    S2(const S2 &);
    S2(S2 &&);
    int a;
  };
  
  struct S3 {
    S2 s2;
  };
  
  void foo3(S3);
  
  void test3() {
    foo3(S3());
  }

Both `S1` and `S3` have a member whose type is annotated with `trivial_abi`. The only difference is that, in the first case, the copy and move constructors of member type `S0` are both deleted.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D92361



More information about the cfe-commits mailing list