diff --git a/eosio_llvm b/eosio_llvm index 423a4ac7a7..82d049e1d4 160000 --- a/eosio_llvm +++ b/eosio_llvm @@ -1 +1 @@ -Subproject commit 423a4ac7a7074e139c4f4c2f786d6b71d1b0965e +Subproject commit 82d049e1d469b32a070307b966e9fdf328e3842c diff --git a/libraries/eosiolib/contracts/eosio/contract.hpp b/libraries/eosiolib/contracts/eosio/contract.hpp index d60d47241c..3505aa0f91 100644 --- a/libraries/eosiolib/contracts/eosio/contract.hpp +++ b/libraries/eosiolib/contracts/eosio/contract.hpp @@ -18,6 +18,7 @@ #define CONTRACT class [[eosio::contract]] #define ACTION [[eosio::action]] void #define TABLE struct [[eosio::table]] +#define STRUCTURE struct [[eosio::structure]] namespace eosio { diff --git a/tests/toolchain/abigen-pass/structure_test.abi b/tests/toolchain/abigen-pass/structure_test.abi new file mode 100644 index 0000000000..bac11228d5 --- /dev/null +++ b/tests/toolchain/abigen-pass/structure_test.abi @@ -0,0 +1,73 @@ +{ + "____comment": "This file was generated with eosio-abigen. DO NOT EDIT ", + "version": "eosio::abi/1.2", + "types": [], + "structs": [ + { + "name": "fee_payer", + "base": "", + "fields": [ + { + "name": "payer", + "type": "name" + }, + { + "name": "quantity", + "type": "uint64" + } + ] + }, + { + "name": "getpayer", + "base": "", + "fields": [] + }, + { + "name": "printfeepyr", + "base": "", + "fields": [ + { + "name": "pyr", + "type": "fee_payer" + } + ] + }, + { + "name": "setfeepyr", + "base": "", + "fields": [ + { + "name": "pyr", + "type": "fee_payer" + } + ] + } + ], + "actions": [ + { + "name": "getpayer", + "type": "getpayer", + "ricardian_contract": "" + }, + { + "name": "printfeepyr", + "type": "printfeepyr", + "ricardian_contract": "" + }, + { + "name": "setfeepyr", + "type": "setfeepyr", + "ricardian_contract": "" + } + ], + "tables": [], + "kv_tables": {}, + "ricardian_clauses": [], + "variants": [], + "action_results": [ + { + "name": "getpayer", + "result_type": "fee_payer" + } + ] +} \ No newline at end of file diff --git a/tests/toolchain/abigen-pass/structure_test.cpp b/tests/toolchain/abigen-pass/structure_test.cpp new file mode 100644 index 0000000000..2404d5807a --- /dev/null +++ b/tests/toolchain/abigen-pass/structure_test.cpp @@ -0,0 +1,33 @@ +#include + +using namespace eosio; + +class [[eosio::contract]] structure_test : public eosio::contract { +public: + using contract::contract; + + struct [[eosio::structure]] fee_payer { + name payer; + uint64_t quantity; + }; + + [[eosio::action]] + fee_payer getpayer() { + fee_payer pyr; + pyr.payer = _self; + pyr.quantity = 1000; + + return pyr; + } + + [[eosio::action]] + void setfeepyr(fee_payer& pyr) { + pyr.payer = "respyr"_n; + pyr.quantity = 10; + } + + [[eosio::action]] + void printfeepyr(fee_payer pyr) { + print(pyr.payer, pyr.quantity); + } +}; diff --git a/tests/toolchain/abigen-pass/structure_test.json b/tests/toolchain/abigen-pass/structure_test.json new file mode 100644 index 0000000000..6d99272cd2 --- /dev/null +++ b/tests/toolchain/abigen-pass/structure_test.json @@ -0,0 +1,9 @@ +{ + "tests": [ + { + "expected": { + "abi-file": "structure_test.abi" + } + } + ] +}