[PATCH] D142446: [MC] Disable copying and moving of MCInstrDescs the C++20 way

Sergei Barannikov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 25 17:49:16 PST 2023


barannikov88 added a comment.

What if not introduce a dummy class but instead extract a part of `MCInstrDesc` that is not directly used by clients? E.g.

  struct Hack {
    unsigned short Opc;
    constexpr Hack(unsigned short Opc) : Opc(Opc) {}
    Hack (const Hack&) = delete;
    Hack &operator=(const Hack&) = delete;
  };
  
  struct MCInstrDesc {
    Hack Opcode;
    unsigned short NumOperands;
  };
  
  MCInstrDesc global{{1}, 2};

https://gcc.godbolt.org/z/nchKhM1Wd

No attribute is required.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D142446



More information about the llvm-commits mailing list