Skip to content

Commit

Permalink
Merge pull request #182 from AntelopeIO/4.0-stable
Browse files Browse the repository at this point in the history
4.0-rc1 to stable
  • Loading branch information
Bucky Kittinger authored May 23, 2023
2 parents 34ccbaf + 17cfeb8 commit ca03025
Show file tree
Hide file tree
Showing 8 changed files with 73 additions and 16 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ jobs:
run: |
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release -GNinja ..
ninja
cmake -DCMAKE_BUILD_TYPE=Release ..
make -j $(nproc)
cd tests
ctest -j $(nproc) --output-on-failure
- name: Package (Ubuntu 18 only)
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ project(cdt)
set(VERSION_MAJOR 4)
set(VERSION_MINOR 0)
set(VERSION_PATCH 0)
set(VERSION_SUFFIX rc1)
set(VERSION_SUFFIX "")

if (VERSION_SUFFIX)
set(VERSION_FULL "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}-${VERSION_SUFFIX}")
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ CDT currently supports Linux x86_64 Debian packages. Visit the [release page](ht
Download the appropriate version of the Debian package and then install it. To download and install the latest version, run the following:

```sh
wget https://github.com/AntelopeIO/cdt/releases/download/v4.0.0-rc1/cdt_4.0.0-rc1_amd64.deb
sudo apt install ./cdt_4.0.0-rc1_amd64.deb
wget https://github.com/AntelopeIO/cdt/releases/download/v4.0.0/cdt_4.0.0_amd64.deb
sudo apt install ./cdt_4.0.0_amd64.deb
```
### Debian package uninstall

Expand Down
31 changes: 31 additions & 0 deletions tests/toolchain/abigen-pass/singleton_contract_simple.abi
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"____comment": "This file was generated with eosio-abigen. DO NOT EDIT ",
"version": "eosio::abi/1.2",
"types": [],
"structs": [
{
"name": "whatever",
"base": "",
"fields": []
}
],
"actions": [
{
"name": "whatever",
"type": "whatever",
"ricardian_contract": ""
}
],
"tables": [
{
"name": "smpl.config",
"type": "name",
"index_type": "i64",
"key_names": [],
"key_types": []
}
],
"ricardian_clauses": [],
"variants": [],
"action_results": []
}
16 changes: 16 additions & 0 deletions tests/toolchain/abigen-pass/singleton_contract_simple.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#include <eosio/asset.hpp>
#include <eosio/eosio.hpp>
#include <eosio/name.hpp>
#include <eosio/singleton.hpp>

using namespace eosio;

class [[eosio::contract("singleton_contract_simple")]] singleton_contract_simple : public contract {
public:
using contract::contract;

[[eosio::action]]
void whatever() {};

typedef eosio::singleton<"smpl.config"_n, name> config;
};
10 changes: 10 additions & 0 deletions tests/toolchain/abigen-pass/singleton_contract_simple.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"tests" : [
{
"expected" : {
"abi-file" : "singleton_contract_simple.abi"
}
}
]
}

20 changes: 10 additions & 10 deletions tools/include/eosio/abigen.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -243,14 +243,13 @@ namespace eosio { namespace cdt {
ctables.insert(t);
}

void add_table( uint64_t name, const clang::CXXRecordDecl* decl ) {
if (!(decl->isEosioTable() && abigen::is_eosio_contract(decl, get_contract_name())))
return;

abi_table t;
t.type = decl->getNameAsString();
t.name = name_to_string(name);
_abi.tables.insert(t);
void add_table( uint64_t name, const clang::CXXRecordDecl* decl, bool force=false ) {
if (force || decl->isEosioTable() && abigen::is_eosio_contract(decl, get_contract_name())) {
abi_table t;
t.type = decl->getNameAsString();
t.name = name_to_string(name);
_abi.tables.insert(t);
}
}

void add_clauses( const std::vector<std::pair<std::string, std::string>>& clauses ) {
Expand Down Expand Up @@ -802,9 +801,10 @@ namespace eosio { namespace cdt {
}
virtual bool VisitDecl(clang::Decl* decl) {
if (const auto* d = dyn_cast<clang::ClassTemplateSpecializationDecl>(decl)) {
if (d->getName() == "multi_index" || d->getName() == "singleton") {
bool is_singleton = d->getName() == "singleton";
if (d->getName() == "multi_index" || is_singleton) {
ag.add_table(d->getTemplateArgs()[0].getAsIntegral().getExtValue(),
(clang::CXXRecordDecl*)((clang::RecordType*)d->getTemplateArgs()[1].getAsType().getTypePtr())->getDecl());
d->getTemplateArgs()[1].getAsType().getTypePtr()->getAsCXXRecordDecl(), is_singleton);
}
}
return true;
Expand Down

0 comments on commit ca03025

Please sign in to comment.